Ruby SDK

Ruby SDK

  • Docs

›Basics

Basics

  • Getting started
  • Interactive Ruby Console
  • Scripting
  • Connecting to Gooddata Platform
  • Handling Credentials Securely
  • Using GoodData Platform
  • Command line functionality
  • Logging and Testing

Advanced Guides

  • Working with Projects
  • Working with Users
  • Working with Data Sources
  • Setting Permissions
  • Model Setup
  • Working with Your Data
  • Working with Reports
  • Using Dashboards
  • Deployment How-tos
  • Automation and Performance
  • Working with Lifecycle

Blueprints

  • Creating Project from Blueprint
  • Loading Data to Project
  • Advanced Blueprint Examples

Logging

Logging

If your script doesn’t work or throws a weird error, you want to see detailed logging information to understand what is going on.

GoodData Ruby SDK uses the standard Ruby logger that you can use in standard way

# encoding: utf-8

require 'gooddata'

logger = Logger.new(STDOUT)
logger.level = Logger::DEBUG
GoodData.logger = logger

You can also use following abbreviated syntax for logging to standard output using DEBUG level

# encoding: utf-8

require 'gooddata'

GoodData.logging_http_on

or using INFO level

# encoding: utf-8

require 'gooddata'

GoodData.logging_on

another option is to specify the debug level explicitly

# encoding: utf-8

require 'gooddata'

GoodData.logging_on(Logger::DEBUG)

There are quite a few options to choose from. Feel free to use whatever you like the best.

Testing

There is another way how to debug your progress. This is a test that checks whether reports return exptected results. This is a basis for delving later into test driven BI projects.

# encoding: utf-8

require 'gooddata'

GoodData.with_connection('user', 'password') do |client|
  GoodData.with_project('project_pid') do |project|
    report = project.reports(32)
    result = report.execute
    fail "Report has unexpected result" unless result == [[1, 2, 3]]
  end
end
← Command line functionalityWorking with Projects →
  • Logging
  • Testing
Copyright © 2007–2018 GoodData Corporation. All Rights Reserved. Code licensed under an BSD License.