gooddata 0.6.20 → 0.6.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -1
- data/DEPENDENCIES.md +816 -0
- data/LICENSE +1 -1
- data/LICENSE.rb +5 -0
- data/Rakefile +74 -22
- data/dependency_decisions.yml +102 -0
- data/gooddata.gemspec +39 -38
- data/lib/gooddata.rb +4 -0
- data/lib/gooddata/app/app.rb +4 -0
- data/lib/gooddata/bricks/base_downloader.rb +5 -1
- data/lib/gooddata/bricks/brick.rb +4 -0
- data/lib/gooddata/bricks/bricks.rb +5 -0
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/base_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/bench_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/decode_params_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/fs_download_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +4 -0
- data/lib/gooddata/bricks/middleware/stdout_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/undot_params_middleware.rb +4 -0
- data/lib/gooddata/bricks/pipeline.rb +4 -0
- data/lib/gooddata/bricks/utils.rb +4 -0
- data/lib/gooddata/cli/cli.rb +4 -0
- data/lib/gooddata/cli/commands/api_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/auth_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/console_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/domain_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/process_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/project_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/projects_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/user_cmd.rb +4 -0
- data/lib/gooddata/cli/hooks.rb +4 -0
- data/lib/gooddata/cli/shared.rb +4 -0
- data/lib/gooddata/cli/terminal.rb +4 -0
- data/lib/gooddata/client.rb +4 -0
- data/lib/gooddata/commands/api.rb +4 -0
- data/lib/gooddata/commands/auth.rb +4 -0
- data/lib/gooddata/commands/base.rb +4 -0
- data/lib/gooddata/commands/commands.rb +5 -0
- data/lib/gooddata/commands/datasets.rb +5 -1
- data/lib/gooddata/commands/datawarehouse.rb +4 -0
- data/lib/gooddata/commands/domain.rb +4 -0
- data/lib/gooddata/commands/process.rb +4 -0
- data/lib/gooddata/commands/project.rb +7 -9
- data/lib/gooddata/commands/projects.rb +4 -0
- data/lib/gooddata/commands/role.rb +4 -0
- data/lib/gooddata/commands/runners.rb +4 -0
- data/lib/gooddata/commands/scaffold.rb +4 -0
- data/lib/gooddata/commands/user.rb +4 -0
- data/lib/gooddata/connection.rb +83 -0
- data/lib/gooddata/core/core.rb +4 -0
- data/lib/gooddata/core/logging.rb +4 -0
- data/lib/gooddata/core/nil_logger.rb +4 -0
- data/lib/gooddata/core/project.rb +4 -0
- data/lib/gooddata/core/rest.rb +14 -16
- data/lib/gooddata/core/user.rb +4 -0
- data/lib/gooddata/data/data.rb +4 -0
- data/lib/gooddata/data/guesser.rb +4 -0
- data/lib/gooddata/exceptions/attr_element_not_found.rb +4 -0
- data/lib/gooddata/exceptions/command_failed.rb +4 -0
- data/lib/gooddata/exceptions/exceptions.rb +4 -0
- data/lib/gooddata/exceptions/execution_limit_exceeded.rb +4 -0
- data/lib/gooddata/exceptions/filter_maqlization.rb +16 -0
- data/lib/gooddata/exceptions/malformed_user.rb +15 -0
- data/lib/gooddata/exceptions/no_project_error.rb +4 -0
- data/lib/gooddata/exceptions/object_migration.rb +28 -0
- data/lib/gooddata/exceptions/project_not_found.rb +5 -0
- data/lib/gooddata/exceptions/uncomputable_report.rb +5 -0
- data/lib/gooddata/exceptions/user_in_different_domain.rb +4 -0
- data/lib/gooddata/exceptions/validation_error.rb +4 -0
- data/lib/gooddata/extensions/big_decimal.rb +4 -0
- data/lib/gooddata/extensions/enumerable.rb +4 -0
- data/lib/gooddata/extensions/extensions.rb +4 -0
- data/lib/gooddata/extensions/false.rb +4 -0
- data/lib/gooddata/extensions/hash.rb +4 -0
- data/lib/gooddata/extensions/nil.rb +4 -0
- data/lib/gooddata/extensions/numeric.rb +4 -0
- data/lib/gooddata/extensions/object.rb +4 -0
- data/lib/gooddata/extensions/symbol.rb +4 -0
- data/lib/gooddata/extensions/true.rb +4 -0
- data/lib/gooddata/extract.rb +4 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +87 -77
- data/lib/gooddata/helpers/auth_helpers.rb +6 -2
- data/lib/gooddata/helpers/csv_helper.rb +4 -0
- data/lib/gooddata/helpers/data_helper.rb +4 -0
- data/lib/gooddata/helpers/global_helpers.rb +35 -6
- data/lib/gooddata/helpers/global_helpers_params.rb +34 -7
- data/lib/gooddata/helpers/helpers.rb +4 -0
- data/lib/gooddata/mixins/author.rb +4 -0
- data/lib/gooddata/mixins/content_getter.rb +4 -0
- data/lib/gooddata/mixins/content_property_reader.rb +4 -0
- data/lib/gooddata/mixins/content_property_writer.rb +4 -0
- data/lib/gooddata/mixins/contributor.rb +4 -0
- data/lib/gooddata/mixins/data_getter.rb +4 -0
- data/lib/gooddata/mixins/data_property_reader.rb +4 -0
- data/lib/gooddata/mixins/data_property_writer.rb +4 -0
- data/lib/gooddata/mixins/inspector.rb +4 -0
- data/lib/gooddata/mixins/is_attribute.rb +4 -0
- data/lib/gooddata/mixins/is_dimension.rb +4 -0
- data/lib/gooddata/mixins/is_fact.rb +4 -0
- data/lib/gooddata/mixins/is_label.rb +4 -0
- data/lib/gooddata/mixins/links.rb +4 -0
- data/lib/gooddata/mixins/md_finders.rb +4 -0
- data/lib/gooddata/mixins/md_id_to_uri.rb +4 -0
- data/lib/gooddata/mixins/md_json.rb +4 -0
- data/lib/gooddata/mixins/md_lock.rb +4 -0
- data/lib/gooddata/mixins/md_object_id.rb +5 -1
- data/lib/gooddata/mixins/md_object_indexer.rb +4 -0
- data/lib/gooddata/mixins/md_object_query.rb +4 -0
- data/lib/gooddata/mixins/md_relations.rb +4 -0
- data/lib/gooddata/mixins/meta_getter.rb +4 -0
- data/lib/gooddata/mixins/meta_property_reader.rb +4 -0
- data/lib/gooddata/mixins/meta_property_writer.rb +4 -0
- data/lib/gooddata/mixins/mixins.rb +4 -0
- data/lib/gooddata/mixins/not_attribute.rb +4 -0
- data/lib/gooddata/mixins/not_exportable.rb +4 -0
- data/lib/gooddata/mixins/not_fact.rb +4 -0
- data/lib/gooddata/mixins/not_label.rb +4 -0
- data/lib/gooddata/mixins/not_metric.rb +6 -0
- data/lib/gooddata/mixins/obj_id.rb +4 -0
- data/lib/gooddata/mixins/rest_getters.rb +4 -0
- data/lib/gooddata/mixins/rest_resource.rb +4 -0
- data/lib/gooddata/mixins/root_key_getter.rb +4 -0
- data/lib/gooddata/mixins/root_key_setter.rb +4 -0
- data/lib/gooddata/mixins/timestamps.rb +4 -0
- data/lib/gooddata/models/blueprint/anchor_field.rb +4 -0
- data/lib/gooddata/models/blueprint/attribute_field.rb +4 -0
- data/lib/gooddata/models/blueprint/blueprint.rb +4 -0
- data/lib/gooddata/models/blueprint/blueprint_field.rb +4 -0
- data/lib/gooddata/models/blueprint/dashboard_builder.rb +4 -0
- data/lib/gooddata/models/blueprint/dataset_blueprint.rb +6 -0
- data/lib/gooddata/models/blueprint/date_dimension.rb +4 -0
- data/lib/gooddata/models/blueprint/fact_field.rb +4 -0
- data/lib/gooddata/models/blueprint/label_field.rb +4 -0
- data/lib/gooddata/models/blueprint/project_blueprint.rb +6 -0
- data/lib/gooddata/models/blueprint/project_builder.rb +4 -0
- data/lib/gooddata/models/blueprint/reference_field.rb +4 -0
- data/lib/gooddata/models/blueprint/schema_blueprint.rb +4 -0
- data/lib/gooddata/models/blueprint/schema_builder.rb +4 -0
- data/lib/gooddata/models/blueprint/to_manifest.rb +17 -1
- data/lib/gooddata/models/blueprint/to_wire.rb +4 -0
- data/lib/gooddata/models/datawarehouse.rb +5 -0
- data/lib/gooddata/models/domain.rb +25 -7
- data/lib/gooddata/models/execution.rb +4 -0
- data/lib/gooddata/models/execution_detail.rb +4 -0
- data/lib/gooddata/models/from_wire.rb +4 -0
- data/lib/gooddata/models/invitation.rb +4 -0
- data/lib/gooddata/models/links.rb +4 -0
- data/lib/gooddata/models/membership.rb +4 -0
- data/lib/gooddata/models/metadata.rb +37 -10
- data/lib/gooddata/models/metadata/attribute.rb +6 -0
- data/lib/gooddata/models/metadata/dashboard.rb +54 -16
- data/lib/gooddata/models/metadata/dashboard/dashboard_item.rb +60 -0
- data/lib/gooddata/models/metadata/dashboard/filter_item.rb +15 -0
- data/lib/gooddata/models/metadata/dashboard/report_item.rb +51 -0
- data/lib/gooddata/models/metadata/dashboard_tab.rb +88 -0
- data/lib/gooddata/models/metadata/dataset.rb +4 -0
- data/lib/gooddata/models/metadata/dimension.rb +4 -0
- data/lib/gooddata/models/metadata/fact.rb +6 -0
- data/lib/gooddata/models/metadata/label.rb +15 -0
- data/lib/gooddata/models/metadata/metadata.rb +4 -0
- data/lib/gooddata/models/metadata/metric.rb +5 -4
- data/lib/gooddata/models/metadata/report.rb +62 -16
- data/lib/gooddata/models/metadata/report_definition.rb +44 -47
- data/lib/gooddata/models/metadata/variable.rb +4 -0
- data/lib/gooddata/models/model.rb +85 -36
- data/lib/gooddata/models/models.rb +4 -0
- data/lib/gooddata/models/module_constants.rb +4 -0
- data/lib/gooddata/models/process.rb +4 -0
- data/lib/gooddata/models/profile.rb +13 -0
- data/lib/gooddata/models/project.rb +173 -92
- data/lib/gooddata/models/project_creator.rb +18 -10
- data/lib/gooddata/models/project_metadata.rb +4 -0
- data/lib/gooddata/models/project_role.rb +4 -0
- data/lib/gooddata/models/report_data_result.rb +217 -125
- data/lib/gooddata/models/schedule.rb +140 -65
- data/lib/gooddata/models/tab_builder.rb +4 -0
- data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +4 -0
- data/lib/gooddata/models/user_filters/user_filter.rb +4 -0
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +98 -56
- data/lib/gooddata/models/user_filters/user_filters.rb +4 -0
- data/lib/gooddata/models/user_filters/variable_user_filter.rb +4 -0
- data/lib/gooddata/rest/client.rb +41 -38
- data/lib/gooddata/rest/connection.rb +91 -20
- data/lib/gooddata/rest/connections/rest_client_connection.rb +5 -1
- data/lib/gooddata/rest/object.rb +9 -1
- data/lib/gooddata/rest/object_factory.rb +5 -1
- data/lib/gooddata/rest/resource.rb +5 -1
- data/lib/gooddata/rest/rest.rb +4 -0
- data/lib/gooddata/version.rb +5 -1
- data/spec/bricks/bricks_spec.rb +4 -0
- data/spec/data/blueprints/test_project_model_spec.json +2 -2
- data/spec/data/gooddata_version_process/gooddata_version.rb +6 -0
- data/spec/data/hello_world_process/hello_world.rb +6 -0
- data/spec/data/manifests/test_project.json +5 -5
- data/spec/data/reports/left_attr_report.json +108 -0
- data/spec/data/reports/metric_only_one_line.json +83 -0
- data/spec/data/reports/report_1.json +197 -0
- data/spec/data/reports/top_attr_report.json +108 -0
- data/spec/data/ruby_params_process/ruby_params.rb +6 -0
- data/spec/data/ruby_process/process.rb +6 -0
- data/spec/environment/default.rb +5 -0
- data/spec/environment/develop.rb +10 -5
- data/spec/environment/environment.rb +4 -0
- data/spec/environment/hotfix.rb +5 -1
- data/spec/environment/production.rb +4 -0
- data/spec/environment/release.rb +4 -0
- data/spec/environment/staging.rb +30 -0
- data/spec/environment/staging_3.rb +37 -0
- data/spec/helpers/blueprint_helper.rb +4 -0
- data/spec/helpers/cli_helper.rb +4 -0
- data/spec/helpers/connection_helper.rb +24 -17
- data/spec/helpers/crypto_helper.rb +6 -0
- data/spec/helpers/csv_helper.rb +4 -0
- data/spec/helpers/process_helper.rb +5 -1
- data/spec/helpers/project_helper.rb +34 -29
- data/spec/helpers/schedule_helper.rb +4 -0
- data/spec/helpers/spec_helper.rb +4 -0
- data/spec/integration/blueprint_updates_spec.rb +28 -20
- data/spec/integration/command_datawarehouse_spec.rb +6 -0
- data/spec/integration/command_projects_spec.rb +6 -4
- data/spec/integration/create_from_template_spec.rb +6 -0
- data/spec/integration/create_project_spec.rb +6 -0
- data/spec/integration/deprecated_load_spec.rb +58 -0
- data/spec/integration/full_process_schedule_spec.rb +9 -0
- data/spec/integration/full_project_spec.rb +63 -9
- data/spec/integration/over_to_user_filters_spec.rb +7 -2
- data/spec/integration/partial_md_export_import_spec.rb +6 -0
- data/spec/integration/project_spec.rb +12 -6
- data/spec/integration/rest_spec.rb +6 -2
- data/spec/integration/schedule_spec.rb +627 -0
- data/spec/integration/user_filters_spec.rb +122 -21
- data/spec/integration/variables_spec.rb +8 -15
- data/spec/logging_in_logging_out_spec.rb +58 -0
- data/spec/spec_helper.rb +10 -5
- data/spec/unit/bricks/bricks_spec.rb +4 -0
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +4 -0
- data/spec/unit/cli/cli_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_api_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_auth_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_domain_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_process_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_project_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_role_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_scaffold_spec.rb +6 -0
- data/spec/unit/cli/commands/cmd_user_spec.rb +6 -0
- data/spec/unit/commands/command_api_spec.rb +6 -0
- data/spec/unit/commands/command_auth_spec.rb +6 -0
- data/spec/unit/commands/command_dataset_spec.rb +10 -4
- data/spec/unit/commands/command_process_spec.rb +6 -0
- data/spec/unit/commands/command_projects_spec.rb +6 -0
- data/spec/unit/commands/command_scaffold_spec.rb +6 -0
- data/spec/unit/commands/command_user_spec.rb +6 -0
- data/spec/unit/core/connection_spec.rb +6 -0
- data/spec/unit/core/logging_spec.rb +4 -0
- data/spec/unit/core/nil_logger_spec.rb +4 -0
- data/spec/unit/core/project_spec.rb +4 -0
- data/spec/unit/data/guesser_spec.rb +6 -2
- data/spec/unit/extensions/hash_spec.rb +4 -0
- data/spec/unit/godzilla/goodzilla_spec.rb +4 -0
- data/spec/unit/helpers/csv_helper_spec.rb +4 -0
- data/spec/unit/helpers/data_helper_spec.rb +4 -0
- data/spec/unit/helpers/global_helpers_spec.rb +54 -0
- data/spec/unit/helpers_spec.rb +6 -1
- data/spec/unit/models/blueprint/attributes_spec.rb +5 -0
- data/spec/unit/models/blueprint/dataset_spec.rb +5 -0
- data/spec/unit/models/blueprint/labels_spec.rb +5 -0
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +5 -0
- data/spec/unit/models/blueprint/reference_spec.rb +5 -0
- data/spec/unit/models/blueprint/schema_builder_spec.rb +4 -0
- data/spec/unit/models/blueprint/to_wire_spec.rb +5 -0
- data/spec/unit/models/domain_spec.rb +9 -7
- data/spec/unit/models/execution_spec.rb +6 -0
- data/spec/unit/models/from_wire_spec.rb +4 -0
- data/spec/unit/models/invitation_spec.rb +4 -0
- data/spec/unit/models/membership_spec.rb +4 -0
- data/spec/unit/models/metadata_spec.rb +46 -0
- data/spec/unit/models/metric_spec.rb +4 -0
- data/spec/unit/models/model_spec.rb +4 -0
- data/spec/unit/models/params_spec.rb +4 -0
- data/spec/unit/models/profile_spec.rb +4 -0
- data/spec/unit/models/project_creator_spec.rb +127 -0
- data/spec/unit/models/project_role_spec.rb +4 -0
- data/spec/unit/models/project_spec.rb +4 -0
- data/spec/unit/models/report_result_data_spec.rb +193 -0
- data/spec/unit/models/schedule_spec.rb +241 -386
- data/spec/unit/models/to_manifest_spec.rb +21 -0
- data/spec/unit/models/{unit_project.rb → unit_project_spec.rb} +21 -18
- data/spec/unit/models/user_filters_spec.rb +7 -1
- data/spec/unit/models/variable_spec.rb +6 -0
- data/spec/unit/rest/polling_spec.rb +8 -5
- data/spec/unit/rest/resource_spec.rb +4 -0
- metadata +190 -129
- data/.autotest +0 -2
- data/.travis.yml +0 -22
- data/examples.rb +0 -69
- data/lib/gooddata/models/data_result.rb +0 -38
- data/lib/gooddata/models/empty_result.rb +0 -57
- data/spec/unit/models/project_creator.rb +0 -73
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
module GoodData
|
|
4
|
+
# Project Not Found
|
|
5
|
+
class ObjectsMigrationError < RuntimeError
|
|
6
|
+
DEFAULT_MSG = 'Object migration failed.'
|
|
7
|
+
|
|
8
|
+
def initialize(msg = DEFAULT_MSG)
|
|
9
|
+
super(msg)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class ObjectsExportError < ObjectsMigrationError
|
|
14
|
+
DEFAULT_MSG = 'Exporting objects failed.'
|
|
15
|
+
|
|
16
|
+
def initialize(msg = DEFAULT_MSG)
|
|
17
|
+
super(msg)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class ObjectsImportError < ObjectsMigrationError
|
|
22
|
+
DEFAULT_MSG = 'Importing objects failed.'
|
|
23
|
+
|
|
24
|
+
def initialize(msg = DEFAULT_MSG)
|
|
25
|
+
super(msg)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
2
7
|
require 'restclient/exceptions'
|
|
3
8
|
|
|
4
9
|
module GoodData
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
2
7
|
require 'restclient/exceptions'
|
|
3
8
|
|
|
4
9
|
module GoodData
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
module GoodData
|
|
4
8
|
class UserInDifferentDomainError < RuntimeError
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
module GoodData
|
|
4
8
|
# Project Not Found
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
module Enumerable
|
|
4
8
|
def mapcat(initial = [], &block)
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
base = Pathname(__FILE__).dirname.expand_path
|
|
4
8
|
Dir.glob(base + '*.rb').each do |file|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
class FalseClass
|
|
4
8
|
# +false+ is not duplicable:
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
class Hash
|
|
4
8
|
# Return a hash that includes everything but the given keys. This is useful for
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
class NilClass
|
|
4
8
|
# +nil+ is not duplicable:
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
class Numeric
|
|
4
8
|
# Numbers are not duplicable:
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
class Symbol
|
|
4
8
|
# Symbols are not duplicable:
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
class TrueClass
|
|
4
8
|
# +true+ is not duplicable:
|
data/lib/gooddata/extract.rb
CHANGED
|
@@ -1,102 +1,112 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
module GoodData
|
|
4
8
|
module SmallGoodZilla
|
|
5
9
|
PARSE_MAQL_OBJECT_REGEXP = /\[([^\]]+)\]/
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
a_maql_string
|
|
12
|
-
|
|
11
|
+
class << self
|
|
12
|
+
# Get IDs from MAQL string
|
|
13
|
+
# @param a_maql_string Input MAQL string
|
|
14
|
+
# @return [Array<String>] List of IDS
|
|
15
|
+
def get_ids(a_maql_string)
|
|
16
|
+
a_maql_string.scan(/!\[([^\"\]]+)\]/).flatten.uniq
|
|
17
|
+
end
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
# Get Facts from MAQL string
|
|
20
|
+
# @param a_maql_string Input MAQL string
|
|
21
|
+
# @return [Array<String>] List of Facts
|
|
22
|
+
def get_facts(a_maql_string)
|
|
23
|
+
a_maql_string.scan(/#\"([^\"]+)\"/).flatten
|
|
24
|
+
end
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
# Get Attributes from MAQL string
|
|
27
|
+
# @param a_maql_string Input MAQL string
|
|
28
|
+
# @return [Array<String>] List of Attributes
|
|
29
|
+
def get_attributes(a_maql_string)
|
|
30
|
+
a_maql_string.scan(/@\"([^\"]+)\"/).flatten
|
|
31
|
+
end
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
# Get Metrics from MAQL string
|
|
34
|
+
# @param a_maql_string Input MAQL string
|
|
35
|
+
# @return [Array<String>] List of Metrics
|
|
36
|
+
def get_metrics(a_maql_string)
|
|
37
|
+
a_maql_string.scan(/\?"([^\"]+)\"/).flatten
|
|
38
|
+
end
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
alias_method :get_measures, :get_metrics
|
|
41
|
+
|
|
42
|
+
# Pretty prints the MAQL expression. This basically means it finds out names of objects and elements and print their values instead of URIs
|
|
43
|
+
# @param expression [String] Expression to be beautified
|
|
44
|
+
# @return [String] Pretty printed MAQL expression
|
|
45
|
+
def pretty_print(expression, opts = { client: GoodData.connection, project: GoodData.project })
|
|
46
|
+
temp = expression.dup
|
|
47
|
+
pairs = expression.scan(PARSE_MAQL_OBJECT_REGEXP).pmap do |uri|
|
|
48
|
+
uri = uri.first
|
|
49
|
+
if uri =~ /elements/
|
|
50
|
+
begin
|
|
51
|
+
[uri, Attribute.find_element_value(uri, opts)]
|
|
52
|
+
rescue AttributeElementNotFound
|
|
53
|
+
[uri, '(empty value)']
|
|
54
|
+
end
|
|
55
|
+
else
|
|
56
|
+
[uri, GoodData::MdObject[uri, opts].title]
|
|
47
57
|
end
|
|
48
|
-
else
|
|
49
|
-
[uri, GoodData::MdObject[uri, opts].title]
|
|
50
58
|
end
|
|
59
|
+
|
|
60
|
+
pairs.each do |el|
|
|
61
|
+
uri = el[0]
|
|
62
|
+
obj = el[1]
|
|
63
|
+
temp.sub!(uri, obj)
|
|
64
|
+
end
|
|
65
|
+
temp
|
|
51
66
|
end
|
|
52
67
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
def interpolate(values, dictionaries)
|
|
69
|
+
{
|
|
70
|
+
:facts => interpolate_values(values[:facts], dictionaries[:facts]),
|
|
71
|
+
:attributes => interpolate_values(values[:attributes], dictionaries[:attributes]),
|
|
72
|
+
:metrics => interpolate_values(values[:metrics], dictionaries[:metrics])
|
|
73
|
+
}
|
|
57
74
|
end
|
|
58
|
-
temp
|
|
59
|
-
end
|
|
60
75
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
def interpolate_ids(options, *ids)
|
|
77
|
+
ids = ids.flatten
|
|
78
|
+
if ids.empty?
|
|
79
|
+
[]
|
|
80
|
+
else
|
|
81
|
+
res = GoodData::MdObject.identifier_to_uri(options, *ids)
|
|
82
|
+
fail 'Not all of the identifiers were resolved' if Array(res).size != ids.size
|
|
83
|
+
res
|
|
84
|
+
end
|
|
85
|
+
end
|
|
68
86
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
[]
|
|
73
|
-
else
|
|
74
|
-
res = GoodData::MdObject.identifier_to_uri(options, *ids)
|
|
75
|
-
fail 'Not all of the identifiers were resolved' if Array(res).size != ids.size
|
|
76
|
-
res
|
|
87
|
+
def interpolate_values(keys, values)
|
|
88
|
+
x = values.values_at(*keys)
|
|
89
|
+
keys.zip(x)
|
|
77
90
|
end
|
|
78
|
-
end
|
|
79
91
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
def interpolate_metric(metric, dictionary, options = { :client => GoodData.connection, :project => GoodData.project })
|
|
93
|
+
interpolated = interpolate({
|
|
94
|
+
:facts => GoodData::SmallGoodZilla.get_facts(metric),
|
|
95
|
+
:attributes => GoodData::SmallGoodZilla.get_attributes(metric),
|
|
96
|
+
:metrics => GoodData::SmallGoodZilla.get_metrics(metric)
|
|
97
|
+
}, dictionary)
|
|
84
98
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
:facts => GoodData::SmallGoodZilla.get_facts(metric),
|
|
88
|
-
:attributes => GoodData::SmallGoodZilla.get_attributes(metric),
|
|
89
|
-
:metrics => GoodData::SmallGoodZilla.get_metrics(metric)
|
|
90
|
-
}, dictionary)
|
|
99
|
+
ids = GoodData::SmallGoodZilla.get_ids(metric)
|
|
100
|
+
interpolated_ids = ids.zip(Array(interpolate_ids(options, ids)))
|
|
91
101
|
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
metric = interpolated[:facts].reduce(metric) { |a, e| a.sub("#\"#{e[0]}\"", "[#{e[1]}]") }
|
|
103
|
+
metric = interpolated[:attributes].reduce(metric) { |a, e| a.sub("@\"#{e[0]}\"", "[#{e[1]}]") }
|
|
104
|
+
metric = interpolated[:metrics].reduce(metric) { |a, e| a.sub("?\"#{e[0]}\"", "[#{e[1]}]") }
|
|
105
|
+
metric = interpolated_ids.reduce(metric) { |a, e| a.gsub("![#{e[0]}]", "[#{e[1]}]") }
|
|
106
|
+
metric
|
|
107
|
+
end
|
|
94
108
|
|
|
95
|
-
|
|
96
|
-
metric = interpolated[:attributes].reduce(metric) { |a, e| a.sub("@\"#{e[0]}\"", "[#{e[1]}]") }
|
|
97
|
-
metric = interpolated[:metrics].reduce(metric) { |a, e| a.sub("?\"#{e[0]}\"", "[#{e[1]}]") }
|
|
98
|
-
metric = interpolated_ids.reduce(metric) { |a, e| a.gsub("![#{e[0]}]", "[#{e[1]}]") }
|
|
99
|
-
metric
|
|
109
|
+
alias_method :interpolate_measure, :interpolate_metric
|
|
100
110
|
end
|
|
101
111
|
end
|
|
102
112
|
end
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
# encoding:
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
require 'fileutils'
|
|
4
8
|
require 'json'
|
|
@@ -51,7 +55,7 @@ module GoodData
|
|
|
51
55
|
# @return [String] auth token from environment variable, .gooddata or nil
|
|
52
56
|
def read_token(credentials_file_path = credentials_file)
|
|
53
57
|
goodfile = read_credentials(credentials_file_path)
|
|
54
|
-
[ENV['GD_PROJECT_TOKEN'], goodfile[:auth_token],
|
|
58
|
+
[ENV['GD_PROJECT_TOKEN'], goodfile[:auth_token], goodfile[:token]].find { |x| !x.nil? && !x.empty? }
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
# Writes credentials
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
|
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
2
6
|
|
|
3
7
|
require 'pathname'
|
|
4
8
|
require 'hashie'
|
|
@@ -37,6 +41,10 @@ module GoodData
|
|
|
37
41
|
end
|
|
38
42
|
end
|
|
39
43
|
|
|
44
|
+
def last_uri_part(uri)
|
|
45
|
+
uri.split('/').last
|
|
46
|
+
end
|
|
47
|
+
|
|
40
48
|
def home_directory
|
|
41
49
|
running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
|
|
42
50
|
end
|
|
@@ -56,21 +64,22 @@ module GoodData
|
|
|
56
64
|
end
|
|
57
65
|
|
|
58
66
|
def titleize(str)
|
|
59
|
-
titleized = str.gsub(/[\.|_](.)
|
|
60
|
-
titleized = titleized.
|
|
67
|
+
titleized = str.gsub(/[\.|_](.)/, &:upcase)
|
|
68
|
+
titleized = titleized.tr('_', ' ')
|
|
61
69
|
titleized[0] = titleized[0].upcase
|
|
62
70
|
titleized
|
|
63
71
|
end
|
|
64
72
|
|
|
65
73
|
def join(master, slave, on, on2, options = {})
|
|
66
74
|
full_outer = options[:full_outer]
|
|
75
|
+
inner = options[:inner]
|
|
67
76
|
|
|
68
77
|
lookup = create_lookup(slave, on2)
|
|
69
78
|
marked_lookup = {}
|
|
70
79
|
results = master.reduce([]) do |a, line|
|
|
71
80
|
matching_values = lookup[line.values_at(*on)] || []
|
|
72
81
|
marked_lookup[line.values_at(*on)] = 1
|
|
73
|
-
if matching_values.empty?
|
|
82
|
+
if matching_values.empty? && !inner
|
|
74
83
|
a << line.to_hash
|
|
75
84
|
else
|
|
76
85
|
matching_values.each do |matching_value|
|
|
@@ -101,10 +110,20 @@ module GoodData
|
|
|
101
110
|
'=' * x.size
|
|
102
111
|
end
|
|
103
112
|
|
|
113
|
+
def interpolate_error_messages(errors)
|
|
114
|
+
errors.map { |e| interpolate_error_message(e) }
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def interpolate_error_message(error)
|
|
118
|
+
message = error['error']['message']
|
|
119
|
+
params = error['error']['parameters']
|
|
120
|
+
sprintf(message, *params)
|
|
121
|
+
end
|
|
122
|
+
|
|
104
123
|
def transform_keys!(an_object)
|
|
105
124
|
return enum_for(:transform_keys!) unless block_given?
|
|
106
125
|
an_object.keys.each do |key|
|
|
107
|
-
an_object[yield(key)] = delete(key)
|
|
126
|
+
an_object[yield(key)] = an_object.delete(key)
|
|
108
127
|
end
|
|
109
128
|
an_object
|
|
110
129
|
end
|
|
@@ -149,11 +168,11 @@ module GoodData
|
|
|
149
168
|
end
|
|
150
169
|
|
|
151
170
|
def stringify_keys(an_object)
|
|
152
|
-
transform_keys(an_object
|
|
171
|
+
transform_keys(an_object, &:to_s)
|
|
153
172
|
end
|
|
154
173
|
|
|
155
174
|
def deep_stringify_keys(an_object)
|
|
156
|
-
deep_transform_keys(an_object
|
|
175
|
+
deep_transform_keys(an_object, &:to_s)
|
|
157
176
|
end
|
|
158
177
|
|
|
159
178
|
def deep_transform_keys(an_object, &block)
|
|
@@ -195,6 +214,16 @@ module GoodData
|
|
|
195
214
|
end
|
|
196
215
|
end
|
|
197
216
|
end
|
|
217
|
+
|
|
218
|
+
# Creates a matrix with zeroes in all places. It is implemented as an Array of Arrays. First rows then columns.
|
|
219
|
+
#
|
|
220
|
+
# @param [Integer] m Number of rows
|
|
221
|
+
# @param [Integer] n Number of cols
|
|
222
|
+
# @param [Integer] val Alternatively can fill in positions with different values than zeroes. Defualt is zero.
|
|
223
|
+
# @return [Array<Array>] Returns a matrix of zeroes
|
|
224
|
+
def zeroes(m, n, val = 0)
|
|
225
|
+
m.times.map { n.times.map { val } }
|
|
226
|
+
end
|
|
198
227
|
end
|
|
199
228
|
end
|
|
200
229
|
end
|