Module: GoodData

Defined in:
lib/gooddata.rb,
lib/gooddata/client.rb,
lib/gooddata/app/app.rb,
lib/gooddata/cli/cli.rb,
lib/gooddata/extract.rb,
lib/gooddata/lcm/lcm.rb,
lib/gooddata/version.rb,
lib/gooddata/lcm/lcm2.rb,
lib/gooddata/core/rest.rb,
lib/gooddata/core/user.rb,
lib/gooddata/rest/rest.rb,
lib/gooddata/cli/shared.rb,
lib/gooddata/connection.rb,
lib/gooddata/rest/phmap.rb,
lib/gooddata_brick_base.rb,
lib/gooddata/lcm/dsl/dsl.rb,
lib/gooddata/rest/client.rb,
lib/gooddata/rest/object.rb,
lib/gooddata/bricks/brick.rb,
lib/gooddata/bricks/utils.rb,
lib/gooddata/cli/terminal.rb,
lib/gooddata/commands/api.rb,
lib/gooddata/core/logging.rb,
lib/gooddata/core/project.rb,
lib/gooddata/data/guesser.rb,
lib/gooddata/mixins/links.rb,
lib/gooddata/models/links.rb,
lib/gooddata/models/model.rb,
lib/gooddata/commands/auth.rb,
lib/gooddata/commands/base.rb,
lib/gooddata/commands/role.rb,
lib/gooddata/commands/user.rb,
lib/gooddata/mixins/author.rb,
lib/gooddata/mixins/obj_id.rb,
lib/gooddata/models/client.rb,
lib/gooddata/models/domain.rb,
lib/gooddata/rest/resource.rb,
lib/gooddata/core/gd_logger.rb,
lib/gooddata/mixins/is_fact.rb,
lib/gooddata/mixins/md_json.rb,
lib/gooddata/mixins/md_lock.rb,
lib/gooddata/mixins/to_json.rb,
lib/gooddata/models/process.rb,
lib/gooddata/models/profile.rb,
lib/gooddata/models/project.rb,
lib/gooddata/models/segment.rb,
lib/gooddata/bricks/pipeline.rb,
lib/gooddata/commands/domain.rb,
lib/gooddata/core/nil_logger.rb,
lib/gooddata/lcm/types/param.rb,
lib/gooddata/mixins/is_label.rb,
lib/gooddata/mixins/not_fact.rb,
lib/gooddata/models/metadata.rb,
lib/gooddata/models/schedule.rb,
lib/gooddata/rest/connection.rb,
lib/gooddata/commands/process.rb,
lib/gooddata/commands/project.rb,
lib/gooddata/commands/runners.rb,
lib/gooddata/lcm/actions/help.rb,
lib/gooddata/lcm/brick_logger.rb,
lib/gooddata/lcm/dsl/type_dsl.rb,
lib/gooddata/mixins/inspector.rb,
lib/gooddata/mixins/is_folder.rb,
lib/gooddata/mixins/not_group.rb,
lib/gooddata/mixins/not_label.rb,
lib/gooddata/models/execution.rb,
lib/gooddata/models/from_wire.rb,
lib/gooddata/bricks/help_brick.rb,
lib/gooddata/commands/datasets.rb,
lib/gooddata/commands/projects.rb,
lib/gooddata/commands/scaffold.rb,
lib/gooddata/mixins/md_finders.rb,
lib/gooddata/mixins/not_metric.rb,
lib/gooddata/mixins/timestamps.rb,
lib/gooddata/mixins/uri_getter.rb,
lib/gooddata/models/invitation.rb,
lib/gooddata/models/ldm_layout.rb,
lib/gooddata/models/membership.rb,
lib/gooddata/models/user_group.rb,
lib/gooddata/helpers/csv_helper.rb,
lib/gooddata/helpers/erb_helper.rb,
lib/gooddata/lcm/dsl/params_dsl.rb,
lib/gooddata/mixins/contributor.rb,
lib/gooddata/mixins/data_getter.rb,
lib/gooddata/mixins/md_grantees.rb,
lib/gooddata/mixins/meta_getter.rb,
lib/gooddata/models/data_source.rb,
lib/gooddata/models/tab_builder.rb,
lib/gooddata/goodzilla/goodzilla.rb,
lib/gooddata/helpers/data_helper.rb,
lib/gooddata/lcm/types/base_type.rb,
lib/gooddata/mixins/is_attribute.rb,
lib/gooddata/mixins/is_dimension.rb,
lib/gooddata/mixins/md_id_to_uri.rb,
lib/gooddata/mixins/md_object_id.rb,
lib/gooddata/mixins/md_relations.rb,
lib/gooddata/mixins/rest_getters.rb,
lib/gooddata/models/data_product.rb,
lib/gooddata/models/project_role.rb,
lib/gooddata/models/subscription.rb,
lib/gooddata/rest/object_factory.rb,
lib/gooddata/bricks/base_pipeline.rb,
lib/gooddata/cli/commands/api_cmd.rb,
lib/gooddata/helpers/auth_helpers.rb,
lib/gooddata/mixins/not_attribute.rb,
lib/gooddata/mixins/rest_resource.rb,
lib/gooddata/models/datawarehouse.rb,
lib/gooddata/models/metadata/fact.rb,
lib/gooddata/models/style_setting.rb,
lib/gooddata/rest/rest_aggregator.rb,
lib/gooddata/cli/commands/auth_cmd.rb,
lib/gooddata/helpers/crypto_helper.rb,
lib/gooddata/lcm/types/class/class.rb,
lib/gooddata/lcm/types/scalar/bool.rb,
lib/gooddata/lcm/types/scalar/hash.rb,
lib/gooddata/lcm/types/special/any.rb,
lib/gooddata/mixins/content_getter.rb,
lib/gooddata/mixins/not_exportable.rb,
lib/gooddata/models/metadata/label.rb,
lib/gooddata/bricks/base_downloader.rb,
lib/gooddata/commands/datawarehouse.rb,
lib/gooddata/helpers/global_helpers.rb,
lib/gooddata/lcm/types/special/enum.rb,
lib/gooddata/lcm/user_bricks_helper.rb,
lib/gooddata/mixins/md_object_query.rb,
lib/gooddata/mixins/root_key_getter.rb,
lib/gooddata/mixins/root_key_setter.rb,
lib/gooddata/models/dataset_mapping.rb,
lib/gooddata/models/metadata/folder.rb,
lib/gooddata/models/metadata/metric.rb,
lib/gooddata/models/metadata/report.rb,
lib/gooddata/models/project_creator.rb,
lib/gooddata/cli/commands/domain_cmd.rb,
lib/gooddata/exceptions/export_clone.rb,
lib/gooddata/exceptions/import_clone.rb,
lib/gooddata/lcm/actions/base_action.rb,
lib/gooddata/lcm/actions/hello_world.rb,
lib/gooddata/lcm/helpers/tags_helper.rb,
lib/gooddata/lcm/types/scalar/object.rb,
lib/gooddata/lcm/types/scalar/string.rb,
lib/gooddata/lcm/types/special/array.rb,
lib/gooddata/models/ads_output_stage.rb,
lib/gooddata/models/execution_detail.rb,
lib/gooddata/models/metadata/dataset.rb,
lib/gooddata/models/module_constants.rb,
lib/gooddata/models/project_metadata.rb,
lib/gooddata/bricks/hello_world_brick.rb,
lib/gooddata/cli/commands/process_cmd.rb,
lib/gooddata/cli/commands/project_cmd.rb,
lib/gooddata/lcm/actions/collect_meta.rb,
lib/gooddata/lcm/helpers/check_helper.rb,
lib/gooddata/lcm/types/complex/tokens.rb,
lib/gooddata/lcm/types/scalar/integer.rb,
lib/gooddata/mixins/md_object_indexer.rb,
lib/gooddata/mixins/property_accessor.rb,
lib/gooddata/models/blueprint/to_wire.rb,
lib/gooddata/models/metadata/variable.rb,
lib/gooddata/models/notification_rule.rb,
lib/gooddata/exceptions/command_failed.rb,
lib/gooddata/exceptions/malformed_user.rb,
lib/gooddata/exceptions/maql_execution.rb,
lib/gooddata/lcm/actions/purge_clients.rb,
lib/gooddata/lcm/types/class/gd_client.rb,
lib/gooddata/lcm/types/class/gd_logger.rb,
lib/gooddata/lcm/types/complex/complex.rb,
lib/gooddata/lcm/types/complex/segment.rb,
lib/gooddata/models/metadata/attribute.rb,
lib/gooddata/models/metadata/dashboard.rb,
lib/gooddata/models/metadata/dimension.rb,
lib/gooddata/models/report_data_result.rb,
lib/gooddata/lcm/types/class/ads_client.rb,
lib/gooddata/lcm/types/class/gd_product.rb,
lib/gooddata/lcm/types/class/gd_project.rb,
lib/gooddata/lcm/types/class/smart_hash.rb,
lib/gooddata/exceptions/no_project_error.rb,
lib/gooddata/exceptions/object_migration.rb,
lib/gooddata/exceptions/validation_error.rb,
lib/gooddata/lcm/actions/collect_clients.rb,
lib/gooddata/lcm/actions/segments_filter.rb,
lib/gooddata/lcm/actions/synchronize_cas.rb,
lib/gooddata/lcm/actions/synchronize_ldm.rb,
lib/gooddata/mixins/data_property_reader.rb,
lib/gooddata/mixins/data_property_writer.rb,
lib/gooddata/mixins/meta_property_reader.rb,
lib/gooddata/mixins/meta_property_writer.rb,
lib/gooddata/models/blueprint/fact_field.rb,
lib/gooddata/core/splunk_logger_decorator.rb,
lib/gooddata/exceptions/invalid_env_error.rb,
lib/gooddata/exceptions/project_not_found.rb,
lib/gooddata/exceptions/segment_not_empty.rb,
lib/gooddata/lcm/actions/collect_segments.rb,
lib/gooddata/lcm/actions/synchronize_meta.rb,
lib/gooddata/models/blueprint/label_field.rb,
lib/gooddata/models/blueprint/to_manifest.rb,
lib/gooddata/models/channel_configuration.rb,
lib/gooddata/models/project_log_formatter.rb,
lib/gooddata/exceptions/filter_maqlization.rb,
lib/gooddata/helpers/global_helpers_params.rb,
lib/gooddata/lcm/actions/apply_custom_maql.rb,
lib/gooddata/lcm/actions/associate_clients.rb,
lib/gooddata/lcm/actions/execute_schedules.rb,
lib/gooddata/lcm/actions/provision_clients.rb,
lib/gooddata/lcm/actions/synchronize_users.rb,
lib/gooddata/models/blueprint/anchor_field.rb,
lib/gooddata/models/blueprint/bridge_field.rb,
lib/gooddata/models/metadata/dashboard_tab.rb,
lib/gooddata/exceptions/uncomputable_report.rb,
lib/gooddata/lcm/actions/collect_ca_metrics.rb,
lib/gooddata/lcm/actions/set_master_project.rb,
lib/gooddata/mixins/content_property_reader.rb,
lib/gooddata/mixins/content_property_writer.rb,
lib/gooddata/models/metadata/scheduled_mail.rb,
lib/gooddata/lcm/actions/collect_ldm_objects.rb,
lib/gooddata/lcm/actions/synchronize_clients.rb,
lib/gooddata/lcm/helpers/safe_failure_helper.rb,
lib/gooddata/lcm/types/complex/release_query.rb,
lib/gooddata/models/blueprint/date_dimension.rb,
lib/gooddata/models/blueprint/schema_builder.rb,
lib/gooddata/models/user_filters/user_filter.rb,
lib/gooddata/bricks/middleware/aws_middleware.rb,
lib/gooddata/bricks/middleware/dwh_middleware.rb,
lib/gooddata/lcm/actions/collect_data_product.rb,
lib/gooddata/lcm/actions/ensure_release_table.rb,
lib/gooddata/lcm/actions/update_release_table.rb,
lib/gooddata/lcm/helpers/release_table_helper.rb,
lib/gooddata/models/blueprint/attribute_field.rb,
lib/gooddata/models/blueprint/blueprint_field.rb,
lib/gooddata/models/blueprint/project_builder.rb,
lib/gooddata/models/blueprint/reference_field.rb,
lib/gooddata/bricks/middleware/base_middleware.rb,
lib/gooddata/bricks/middleware/context_manager.rb,
lib/gooddata/exceptions/attr_element_not_found.rb,
lib/gooddata/lcm/actions/synchronize_processes.rb,
lib/gooddata/lcm/actions/synchronize_schedules.rb,
lib/gooddata/lcm/actions/update_metric_formats.rb,
lib/gooddata/models/blueprint/schema_blueprint.rb,
lib/gooddata/models/metadata/report_definition.rb,
lib/gooddata/bricks/middleware/bench_middleware.rb,
lib/gooddata/cloud_resources/mssql/mssql_client.rb,
lib/gooddata/cloud_resources/mysql/mysql_client.rb,
lib/gooddata/lcm/actions/collect_tagged_objects.rb,
lib/gooddata/lcm/actions/create_segment_masters.rb,
lib/gooddata/lcm/actions/synchronize_ldm_layout.rb,
lib/gooddata/lcm/exceptions/lcm_execution_error.rb,
lib/gooddata/models/automated_data_distribution.rb,
lib/gooddata/models/blueprint/dashboard_builder.rb,
lib/gooddata/models/blueprint/dataset_blueprint.rb,
lib/gooddata/models/blueprint/project_blueprint.rb,
lib/gooddata/bricks/middleware/logger_middleware.rb,
lib/gooddata/bricks/middleware/stdout_middleware.rb,
lib/gooddata/exceptions/execution_limit_exceeded.rb,
lib/gooddata/exceptions/user_in_different_domain.rb,
lib/gooddata/lcm/actions/collect_client_projects.rb,
lib/gooddata/lcm/actions/collect_segment_clients.rb,
lib/gooddata/lcm/actions/synchronize_label_types.rb,
lib/gooddata/lcm/actions/synchronize_tag_objects.rb,
lib/gooddata/lcm/actions/synchronize_user_groups.rb,
lib/gooddata/lcm/types/complex/update_preference.rb,
lib/gooddata/models/metadata/dashboard/text_item.rb,
lib/gooddata/bricks/middleware/twitter_middleware.rb,
lib/gooddata/lcm/actions/synchronize_new_segments.rb,
lib/gooddata/lcm/actions/synchronize_user_filters.rb,
lib/gooddata/lcm/exceptions/lcm_execution_warning.rb,
lib/gooddata/lcm/types/complex/users_brick_config.rb,
lib/gooddata/models/client_synchronization_result.rb,
lib/gooddata/models/metadata/analytical_dashboard.rb,
lib/gooddata/models/metadata/visualization_object.rb,
lib/gooddata/bricks/middleware/gooddata_middleware.rb,
lib/gooddata/cloud_resources/cloud_resource_client.rb,
lib/gooddata/lcm/actions/collect_users_brick_users.rb,
lib/gooddata/lcm/actions/import_object_collections.rb,
lib/gooddata/lcm/actions/synchronize_color_palette.rb,
lib/gooddata/models/metadata/dashboard/filter_item.rb,
lib/gooddata/models/metadata/dashboard/iframe_item.rb,
lib/gooddata/models/metadata/dashboard/report_item.rb,
lib/gooddata/bricks/middleware/fs_upload_middleware.rb,
lib/gooddata/bricks/middleware/restforce_middleware.rb,
lib/gooddata/cloud_resources/cloud_resource_factory.rb,
lib/gooddata/lcm/actions/migrate_gdc_date_dimension.rb,
lib/gooddata/lcm/types/complex/synchronization_info.rb,
lib/gooddata/lcm/types/special/enum/synchronize_ldm.rb,
lib/gooddata/bricks/middleware/mask_logger_decorator.rb,
lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb,
lib/gooddata/models/metadata/dashboard/headline_item.rb,
lib/gooddata/models/user_filters/user_filter_builder.rb,
lib/gooddata/bricks/middleware/fs_download_middleware.rb,
lib/gooddata/cloud_resources/bigquery/bigquery_client.rb,
lib/gooddata/cloud_resources/redshift/redshift_client.rb,
lib/gooddata/lcm/actions/synchronize_dataset_mappings.rb,
lib/gooddata/models/metadata/dashboard/dashboard_item.rb,
lib/gooddata/models/metadata/dashboard/geo_chart_item.rb,
lib/gooddata/models/user_filters/variable_user_filter.rb,
lib/gooddata/bricks/middleware/undot_params_middleware.rb,
lib/gooddata/lcm/actions/ensure_technical_users_domain.rb,
lib/gooddata/models/user_filters/mandatory_user_filter.rb,
lib/gooddata/bricks/middleware/context_logger_decorator.rb,
lib/gooddata/bricks/middleware/decode_params_middleware.rb,
lib/gooddata/cloud_resources/snowflake/snowflake_client.rb,
lib/gooddata/lcm/actions/ensure_technical_users_project.rb,
lib/gooddata/lcm/actions/collect_dynamic_schedule_params.rb,
lib/gooddata/lcm/actions/collect_projects_warning_status.rb,
lib/gooddata/lcm/actions/rename_existing_client_projects.rb,
lib/gooddata/models/metadata/dashboard/filter_apply_item.rb,
lib/gooddata/cloud_resources/postgresql/postgresql_client.rb,
lib/gooddata/lcm/actions/collect_multiple_projects_column.rb,
lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb,
lib/gooddata/models/client_synchronization_result_details.rb,
lib/gooddata/bricks/middleware/execution_result_middleware.rb,
lib/gooddata/cloud_resources/blobstorage/blobstorage_client.rb,
lib/gooddata/lcm/actions/initialize_continue_on_error_option.rb,
lib/gooddata/lcm/actions/synchronize_kd_dashboard_permission.rb,
lib/gooddata/lcm/actions/synchronize_pp_dashboard_permission.rb,
lib/gooddata/models/metadata/analytical_visualization_object.rb,
lib/gooddata/models/metadata/scheduled_mail/report_attachment.rb,
lib/gooddata/models/metadata/scheduled_mail/dashboard_attachment.rb

Overview

Copyright (c) 2010-2017 GoodData Corporation. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.

Defined Under Namespace

Modules: Bricks, CLI, CloudResources, Command, ContextLoggerDecorator, ContextManager, Data, Extract, Helpers, LCM, LCM2, Mixin, Model, Rest, SmallGoodZilla, UserFilterBuilder Classes: AdsOutputStage, AnalyticalDashboard, AnalyticalVisualizationObject, App, Attribute, AttributeElementNotFound, AutomatedDataDistribution, BlobStorageClient, BrickFileLogger, ChannelConfiguration, Client, ClientSynchronizationResult, ClientSynchronizationResultDetails, CommandFailed, Dashboard, DashboardAttachment, DashboardItem, DashboardTab, DataProduct, DataSource, DataWarehouse, Dataset, DatasetMapping, Dimension, Domain, Execution, ExecutionDetail, ExecutionLimitExceeded, ExportCloneError, Fact, FilterApplyItem, FilterItem, FilterMaqlizationError, Folder, GdLogger, GeoChartItem, HeadlineItem, IframeItem, ImportCloneError, InvalidEnvError, Invitation, Label, LcmExecutionError, LcmExecutionWarning, LdmLayout, Links, MalformedUserError, MandatoryUserFilter, MaqlExecutionError, MdObject, Membership, Metric, NilLogger, NoProjectError, NotificationRule, ObjectsExportError, ObjectsImportError, ObjectsMigrationError, Process, Profile, Project, ProjectLogFormatter, ProjectMetadata, ProjectNotFound, ProjectRole, Report, ReportAttachment, ReportDataResult, ReportDefinition, ReportItem, Schedule, ScheduledMail, Segment, SegmentNotEmpty, SplunkLoggerDecorator, StyleSetting, Subscription, TextItem, UncomputableReport, UserFilter, UserGroup, UserInDifferentDomainError, ValidationError, Variable, VariableUserFilter, VisualizationObject

Constant Summary collapse

VERSION =
File.open(File.expand_path('../../SDK_VERSION', File.dirname(__FILE__))) { |f| f.readline.strip }
BRICKS_VERSION =
File.open(File.expand_path('../../VERSION', File.dirname(__FILE__))) { |f| f.readline.strip }
DEFAULT_SSO_OPTIONS =
{
  :url => '/gdc/app/account/bootstrap',
  :valid => 24 * 60 * 60
}
DEFAULT_LOG_LEVEL =
Logger::INFO
DEFAULT_LOG_OUTPUT =
STDOUT
DEFAULT_LOGGER_CLASS =
Logger
DEFAULT_RESTLOG_LEVEL =
Logger::DEBUG
DEFAULT_RESTLOG_OUTPUT =
STDOUT
DEFAULT_RESTLOGGER_CLASS =
Logger
DEFAULT_SPLUNKLOG_LEVEL =
Logger::INFO
DEFAULT_SPLUNKLOG_OUTPUT =
STDERR
DisplayForm =
GoodData::Label

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.gd_loggerObject

Returns the value of attribute gd_logger.



26
27
28
# File 'lib/gooddata/core/logging.rb', line 26

def gd_logger
  @gd_logger
end

.loggerObject

Returns the value of attribute logger.



26
27
28
# File 'lib/gooddata/core/logging.rb', line 26

def logger
  @logger
end

.projectObject

Returns the value of attribute project.



44
45
46
# File 'lib/gooddata/core/project.rb', line 44

def project
  @project
end

.rest_loggerObject

Returns the value of attribute rest_logger.



26
27
28
# File 'lib/gooddata/core/logging.rb', line 26

def rest_logger
  @rest_logger
end

.stats=(value) ⇒ Object (writeonly)

Sets the attribute stats

Parameters:

  • value

    the value to set the attribute stats to.



27
28
29
# File 'lib/gooddata/core/logging.rb', line 27

def stats=(value)
  @stats = value
end

Class Method Details

.bricks_versionObject

LCM bricks version

Returns:

  • brick version



23
24
25
# File 'lib/gooddata/version.rb', line 23

def bricks_version
  BRICKS_VERSION
end

.connect(options = nil, second_options = nil, third_options = {}) ⇒ Object

Connect to the GoodData API

Parameters:

  • options (defaults to: nil)
  • second_options (defaults to: nil)
  • third_options (defaults to: {})


36
37
38
# File 'lib/gooddata/connection.rb', line 36

def connect(options = nil, second_options = nil, third_options = {})
  Rest::Client.connect(options, second_options, third_options)
end

.connect_sso(login, provider, url = GoodData::Rest::Connection::DEFAULT_URL, opts = {}) ⇒ GoodData::Rest::Client

Connect to GoodData using SSO

This SSO implementation is custom implementation provided by GoodData that allows your application to sign in an existing GoodData user. The authentication is done not by username and password but by generating a session specific token using pair of PGP keys.

Parameters:

  • login (String)

    Email address used for logging into gooddata

  • provider (String)

    Name of SSO provider

Returns:

See Also:



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/gooddata/connection.rb', line 118

def connect_sso(, provider, url = GoodData::Rest::Connection::DEFAULT_URL, opts = {})
  url, params = sso_url(, provider, url)

  RestClient::Request.execute(opts.merge(method: :post, url: url, payload: params)) do |response, _request, _result|
    return Rest::Client.connect_sso(
      opts.merge(
        headers:
           {
             x_gdc_authsst: response.cookies['GDCAuthSST'],
             x_gdc_authtt: response.cookies['GDCAuthTT']
           }
      )
    )
  end
end

.connectionObject Also known as: client

Returns the active GoodData connection earlier initialized via GoodData.connect call

See Also:



23
24
25
26
# File 'lib/gooddata/connection.rb', line 23

def connection
  # TODO: Remove this after successful rest-factory transition
  Rest::Client.connection # || fail('Please authenticate with GoodData.connect first')
end

.delete(path, options = {}) ⇒ Object

Performs a HTTP DELETE request.

Retuns the JSON response formatted as a Hash object.

Examples

GoodData.delete '/gdc/project/1'

Parameters:

  • path

    The HTTP path on the GoodData server (must be prefixed with a forward slash)



65
66
67
# File 'lib/gooddata/core/rest.rb', line 65

def delete(path, options = {})
  connection.delete path, options
end

.disconnectObject

Disconnect (logout) if logged in



41
42
43
# File 'lib/gooddata/connection.rb', line 41

def disconnect
  Rest::Client.disconnect
end

.download_from_project_webdav(file, where, options = {}) ⇒ Object

Download from project directory



92
93
94
95
96
# File 'lib/gooddata/core/rest.rb', line 92

def download_from_project_webdav(file, where, options = {})
  options = merge_options(options)
  url = project_webdav_path(options)
  connection.download(file, where, options.merge(:staging_url => url))
end

.download_from_user_webdav(file, where, options = {}) ⇒ Object

Download from user directory



106
107
108
109
# File 'lib/gooddata/core/rest.rb', line 106

def download_from_user_webdav(file, where, options = {})
  url = user_webdav_path({ :client => GoodData.client }.merge(options))
  connection.download(file, where, options.merge(:staging_url => url))
end

.gem_version_stringObject

Identifier of gem version

Returns:

  • Formatted gem version



29
30
31
# File 'lib/gooddata/version.rb', line 29

def gem_version_string
  "gooddata-gem/#{VERSION}/#{RUBY_PLATFORM}/#{RUBY_VERSION}"
end

.get(path, options = {}) ⇒ Object

Performs a HTTP GET request.

Retuns the JSON response formatted as a Hash object.

Examples

GoodData.get '/gdc/projects'

Parameters:

  • path

    The HTTP path on the GoodData server (must be prefixed with a forward slash)



19
20
21
# File 'lib/gooddata/core/rest.rb', line 19

def get(path, options = {})
  connection.get(path, options)
end

.get_client(opts) ⇒ Object



288
289
290
291
292
293
# File 'lib/gooddata/helpers/global_helpers.rb', line 288

def get_client(opts)
  client = opts[:client]
  fail ArgumentError, 'No :client specified' if client.nil?

  client
end

.get_client_and_project(opts) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/gooddata/helpers/global_helpers.rb', line 295

def get_client_and_project(opts)
  client = opts[:client]
  fail ArgumentError, 'No :client specified' if client.nil?

  p = opts[:project]
  fail ArgumentError, 'No :project specified' if p.nil?

  project = GoodData::Project[p, opts]
  fail ArgumentError, 'Wrong :project specified' if project.nil?

  [client, project]
end

.init_moduleObject

Initializes required dynamically loaded classes



46
47
48
49
50
51
52
53
54
55
# File 'lib/gooddata/client.rb', line 46

def init_module
  # Metadata packages, such as report.rb, require this to be loaded first
  require_relative 'models/metadata.rb'

  # Load models from models folder
  Dir[File.dirname(__FILE__) + '/models/*.rb'].each { |file| require file }

  # Load collections
  Dir[File.dirname(__FILE__) + '/collections/*.rb'].each { |file| require file }
end

.logging_http_offObject



62
63
64
# File 'lib/gooddata/core/logging.rb', line 62

def logging_http_off
  @rest_logger = NilLogger.new
end

.logging_http_on(level = DEFAULT_RESTLOG_LEVEL, output = DEFAULT_RESTLOG_OUTPUT, klass = DEFAULT_RESTLOGGER_CLASS) ⇒ Object



56
57
58
59
60
# File 'lib/gooddata/core/logging.rb', line 56

def logging_http_on(level = DEFAULT_RESTLOG_LEVEL, output = DEFAULT_RESTLOG_OUTPUT, klass = DEFAULT_RESTLOGGER_CLASS)
  @rest_logger = klass.new(output)
  @rest_logger.level = level
  @rest_logger
end

.logging_http_on?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/gooddata/core/logging.rb', line 66

def logging_http_on?
  !@rest_logger.instance_of?(NilLogger)
end

.logging_offObject



48
49
50
# File 'lib/gooddata/core/logging.rb', line 48

def logging_off
  @logger = NilLogger.new
end

.logging_on(level = DEFAULT_LOG_LEVEL, output = DEFAULT_LOG_OUTPUT, klass = DEFAULT_LOGGER_CLASS) ⇒ Object

Turn logging on

Example

# Turn of default logging
GoodData.logging_on

# Log only WARN and higher
GoodData.logging_on(Logger::WARN)

# Log DEBUG and above to file
GoodData.logging_on(Logger::DEBUG, 'log.txt')


42
43
44
45
46
# File 'lib/gooddata/core/logging.rb', line 42

def logging_on(level = DEFAULT_LOG_LEVEL, output = DEFAULT_LOG_OUTPUT, klass = DEFAULT_LOGGER_CLASS)
  @logger = klass.new(output)
  @logger.level = level
  @logger
end

.logging_on?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/gooddata/core/logging.rb', line 52

def logging_on?
  !@logger.instance_of?(NilLogger)
end

.poll_on_code(link, options = {}) ⇒ Hash

Generalizaton of poller. Since we have quite a variation of how async proceses are handled this is a helper that should help you with resources where the information about “Are we done” is the http code of response. By default we repeat as long as the code == 202. You can change the code if necessary. It expects the URI as an input where it can poll. It returns the value of last poll. In majority of cases these are the data that you need.

Parameters:

  • link (String)

    Link for polling

  • options (Hash) (defaults to: {})

    Options

Returns:

  • (Hash)

    Result of polling



120
121
122
123
124
# File 'lib/gooddata/core/rest.rb', line 120

def poll_on_code(link, options = {})
  client = options[:client]
  fail ArgumentError, 'No :client specified' if client.nil?
  client.poll_on_code(link, options)
end

.poll_on_response(link, options = {}, &bl) ⇒ Hash

Generalizaton of poller. Since we have quite a variation of how async proceses are handled this is a helper that should help you with resources where the information about “Are we done” is inside the response. It expects the URI as an input where it can poll and a block that should return either false -> ‘meaning we are done’ or true -> meaning sleep and repeat. It returns the value of last poll. In majority of cases these are the data that you need

Parameters:

  • link (String)

    Link for polling

  • options (Hash) (defaults to: {})

    Options

Returns:

  • (Hash)

    Result of polling



135
136
137
138
139
# File 'lib/gooddata/core/rest.rb', line 135

def poll_on_response(link, options = {}, &bl)
  client = options[:client]
  fail ArgumentError, 'No :client specified' if client.nil?
  client.poll_on_response(link, options, &bl)
end

.post(path, data = {}, options = {}) ⇒ Object

Performs a HTTP POST request.

Retuns the JSON response formatted as a Hash object.

Examples

client.post '/gdc/projects', { ... }

Parameters:

  • path

    The HTTP path on the GoodData server (must be prefixed with a forward slash)

  • data (defaults to: {})

    The payload data in the format of a Hash object



34
35
36
# File 'lib/gooddata/core/rest.rb', line 34

def post(path, data = {}, options = {})
  connection.post path, data, options
end

.project_webdav_path(options = {}) ⇒ String

Get WebDav directory for project data

Returns:

  • (String)


78
79
80
81
82
# File 'lib/gooddata/core/rest.rb', line 78

def project_webdav_path(options = {})
  options = merge_options(options)
  project = options[:project]
  project.project_webdav_path
end

.put(path, data, options = {}) ⇒ Object

Performs a HTTP PUT request.

Retuns the JSON response formatted as a Hash object.

Parameters

Examples

client.put '/gdc/projects', { ... }

Parameters:

  • path

    The HTTP path on the GoodData server (must be prefixed with a forward slash)

  • data

    The payload data in the format of a Hash object



51
52
53
# File 'lib/gooddata/core/rest.rb', line 51

def put(path, data, options = {})
  connection.put path, data, options
end

.release_infoObject

Deprecated.

The release info endpoint has been deprecated without a replacement.

Returns information about the GoodData API as a Hash (e.g. version, release time etc.)



59
60
61
# File 'lib/gooddata/client.rb', line 59

def release_info
  fail 'The release info endpoint has been deprecated without a replacement.'
end

.splunk_logging_offObject



74
75
76
# File 'lib/gooddata/core/logging.rb', line 74

def splunk_logging_off
  gd_logger.logging_off :splunk
end

.splunk_logging_on(logger) ⇒ Object



70
71
72
# File 'lib/gooddata/core/logging.rb', line 70

def splunk_logging_on(logger)
  gd_logger.logging_on :splunk, logger
end

.splunk_logging_on?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/gooddata/core/logging.rb', line 78

def splunk_logging_on?
  gd_logger.logging_on? :splunk
end

.sso_url(login, provider, url, opts = DEFAULT_SSO_OPTIONS) ⇒ String

Generates SSO URL

This SSO implementation is custom implementation provided by GoodData that allows your application to sign in an existing GoodData user. The authentication is done not by username and password but by generating a session specific token using pair of PGP keys.

Parameters:

  • login (String)

    Email address used for logging into gooddata

  • provider (String)

    Name of SSO provider

  • opts (Hash) (defaults to: DEFAULT_SSO_OPTIONS)

    Additional options

Options Hash (opts):

  • :validity (Fixnum)

    Validity in seconds from ‘now’

Returns:

  • (String)

    URL which can be used for SSO logging in

See Also:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/gooddata/connection.rb', line 66

def sso_url(, provider, url, opts = DEFAULT_SSO_OPTIONS)
  opts = DEFAULT_SSO_OPTIONS.merge(opts)

  ts = DateTime.now.strftime('%s').to_i + opts[:valid]
  obj = {
    'email' => ,
    'validity' => ts
  }

  json_data = JSON.pretty_generate(obj) + "\n"

  file_json = Tempfile.new('gooddata-sso-json')
  file_json.write(json_data)

  file_json.rewind
  file_signed = Tempfile.new('gooddata-sso-signed')

  cmd = "gpg --yes --no-tty --armor -u #{} --output #{file_signed.path} --sign #{file_json.path}"
  res = system(cmd)
  fail 'Unable to sign json' unless res

  file_signed.rewind
  file_final = Tempfile.new('gooddata-sso-final')

  recipient = url == GoodData::Rest::Connection::DEFAULT_URL ? '[email protected]' : '[email protected]'
  cmd = "gpg --yes --no-tty --trust-model always --armor --output #{file_final.path} --encrypt --recipient #{recipient} #{file_signed.path}"
  res = system(cmd)
  fail 'Unable to encrypt json' unless res

  file_final.rewind
  final = file_final.read

  params = {
    targetUrl: opts[:url],
    ssoProvider: provider,
    encryptedClaims: final
  }
  [url + '/gdc/account/customerlogin', params]
end

.upload_to_project_webdav(file, options = {}) ⇒ Object

Upload to project directory



85
86
87
88
89
# File 'lib/gooddata/core/rest.rb', line 85

def upload_to_project_webdav(file, options = {})
  options = merge_options(options)
  url = project_webdav_path(options)
  connection.upload(file, options.merge(:staging_url => url))
end

.upload_to_user_webdav(file, options = {}) ⇒ String

Upload to user directory

Returns:

  • (String)


71
72
73
74
# File 'lib/gooddata/core/rest.rb', line 71

def upload_to_user_webdav(file, options = {})
  url = user_webdav_path({ :client => GoodData.client }.merge(options))
  connection.upload(file, options.merge(staging_url: url))
end

.userGoodData::Profile Also known as: profile

Gets currently logged user

Returns:



14
15
16
# File 'lib/gooddata/core/user.rb', line 14

def user
  GoodData::Profile.current
end

.user_webdav_path(options = {}) ⇒ String

Get WebDav directory for user data

Returns:

  • (String)


100
101
102
103
# File 'lib/gooddata/core/rest.rb', line 100

def user_webdav_path(options = {})
  client = GoodData::Rest::Object.client({ :client => GoodData.client }.merge(options))
  client.user_webdav_path
end

.versionObject Also known as: sdk_version

SDK version

Returns:

  • SDK version



15
16
17
# File 'lib/gooddata/version.rb', line 15

def version
  VERSION
end

.with_connection(options = nil, second_options = nil, third_options = {}, &block) ⇒ Object



45
46
47
48
49
50
# File 'lib/gooddata/connection.rb', line 45

def with_connection(options = nil, second_options = nil, third_options = {}, &block)
  client = connect(options, second_options, third_options)
  block.call(client)
ensure
  disconnect
end

.with_project(project, opts = { :client => GoodData.connection }, &bl) ⇒ Object

Perform block in context of another project than currently set

Parameters:

  • project

    Project to use

  • bl

    Block to be performed



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/gooddata/core/project.rb', line 56

def with_project(project, opts = { :client => GoodData.connection }, &bl)
  fail 'You have to specify a project when using with_project' if project.nil? || (project.is_a?(String) && project.empty?)
  fail 'You have to specify block' unless bl
  old_project = GoodData.project

  begin
    GoodData.use(project, opts)
    res = bl.call(GoodData.project)
  rescue RestClient::ResourceNotFound
    GoodData.project = old_project
    raise(GoodData::ProjectNotFound, 'Project was not found')
  end

  GoodData.project = old_project

  res
end