gooddata 0.6.20 → 0.6.22
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -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_relative '../metadata'
|
4
8
|
|
@@ -100,6 +104,8 @@ module GoodData
|
|
100
104
|
end
|
101
105
|
end
|
102
106
|
|
107
|
+
alias_method :create_measure, :create_metric
|
108
|
+
|
103
109
|
# For an element id find values (titles) for all display forms. Element id can be given as both number id or URI as a string beginning with /
|
104
110
|
# @param [Object] element_id Element identifier either Number or a uri as a String
|
105
111
|
# @return [Array] list of values for certain element. Returned in the same order as is the order of labels
|
@@ -1,4 +1,12 @@
|
|
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
|
+
|
7
|
+
require_relative 'dashboard_tab'
|
8
|
+
require_relative 'dashboard/filter_item'
|
9
|
+
require_relative 'dashboard/report_item'
|
2
10
|
|
3
11
|
require_relative '../../core/core'
|
4
12
|
require_relative '../metadata'
|
@@ -23,23 +31,23 @@ module GoodData
|
|
23
31
|
query('projectDashboard', Dashboard, options)
|
24
32
|
end
|
25
33
|
|
26
|
-
def create_report_tab(tab)
|
34
|
+
def create_report_tab(tab, options = { :client => GoodData.client, :project => GoodData.project })
|
27
35
|
title = tab[:title]
|
28
36
|
{
|
29
37
|
:title => title,
|
30
|
-
:items => tab[:items].map { |i| GoodData::Dashboard.create_report_tab_item(i) }
|
38
|
+
:items => tab[:items].map { |i| GoodData::Dashboard.create_report_tab_item(i, options) }
|
31
39
|
}
|
32
40
|
end
|
33
41
|
|
34
|
-
def create_report_tab_item(options = {})
|
35
|
-
title =
|
42
|
+
def create_report_tab_item(item, options = { :client => GoodData.client, :project => GoodData.project })
|
43
|
+
title = item[:title]
|
36
44
|
|
37
|
-
report = GoodData::Report.find_first_by_title(title)
|
45
|
+
report = GoodData::Report.find_first_by_title(title, options)
|
38
46
|
{
|
39
47
|
:reportItem => {
|
40
48
|
:obj => report.uri,
|
41
|
-
:sizeY =>
|
42
|
-
:sizeX =>
|
49
|
+
:sizeY => item[:size_y] || 200,
|
50
|
+
:sizeX => item[:size_x] || 300,
|
43
51
|
:style => {
|
44
52
|
:displayTitle => 1,
|
45
53
|
:background => {
|
@@ -54,31 +62,59 @@ module GoodData
|
|
54
62
|
:labels => {}
|
55
63
|
}
|
56
64
|
},
|
57
|
-
:positionY =>
|
65
|
+
:positionY => item[:position_y] || 0,
|
58
66
|
:filters => [],
|
59
|
-
:positionX =>
|
67
|
+
:positionX => item[:position_x] || 0
|
60
68
|
}
|
61
69
|
}
|
62
70
|
end
|
63
71
|
|
64
|
-
def create(options = {})
|
72
|
+
def create(dashboard = { :tabs => [] }, options = { :client => GoodData.client, :project => GoodData.project })
|
73
|
+
client = options[:client]
|
74
|
+
fail ArgumentError, 'No :client specified' if client.nil?
|
75
|
+
|
76
|
+
p = options[:project]
|
77
|
+
fail ArgumentError, 'No :project specified' if p.nil?
|
78
|
+
|
79
|
+
project = GoodData::Project[p, options]
|
80
|
+
fail ArgumentError, 'Wrong :project specified' if project.nil?
|
81
|
+
|
82
|
+
tabs = dashboard[:tabs] || []
|
83
|
+
|
65
84
|
stuff = {
|
66
85
|
'projectDashboard' => {
|
67
86
|
'content' => {
|
68
|
-
'tabs' =>
|
87
|
+
'tabs' => tabs.map { |t| GoodData::Dashboard.create_report_tab(t, options) },
|
69
88
|
'filters' => []
|
70
89
|
},
|
71
90
|
'meta' => {
|
72
|
-
'tags' =>
|
73
|
-
'summary' =>
|
74
|
-
'title' =>
|
91
|
+
'tags' => dashboard[:tags],
|
92
|
+
'summary' => dashboard[:summary],
|
93
|
+
'title' => dashboard[:title]
|
75
94
|
}
|
76
95
|
}
|
77
96
|
}
|
78
|
-
|
97
|
+
|
98
|
+
client.create(Dashboard, stuff, :project => project)
|
79
99
|
end
|
80
100
|
end
|
81
101
|
|
102
|
+
def add_tab(tab)
|
103
|
+
title = tab[:title] || 'Default Tab Title'
|
104
|
+
items = tab[:items] || []
|
105
|
+
|
106
|
+
new_tab_json = {
|
107
|
+
:title => title,
|
108
|
+
:items => items.map { |i| GoodData::Dashboard.create_report_tab_item(i, options) }
|
109
|
+
}
|
110
|
+
|
111
|
+
new_tab = GoodData::DashboardTab.new(self, GoodData::Helpers.deep_stringify_keys(new_tab_json))
|
112
|
+
content['tabs'] << new_tab.json
|
113
|
+
new_tab
|
114
|
+
end
|
115
|
+
|
116
|
+
alias_method :create_tab, :add_tab
|
117
|
+
|
82
118
|
def exportable?
|
83
119
|
true
|
84
120
|
end
|
@@ -94,7 +130,9 @@ module GoodData
|
|
94
130
|
end
|
95
131
|
|
96
132
|
def tabs
|
97
|
-
content['tabs']
|
133
|
+
content['tabs'].map do |tab|
|
134
|
+
GoodData::DashboardTab.new(self, tab)
|
135
|
+
end
|
98
136
|
end
|
99
137
|
|
100
138
|
def tabs_ids
|
@@ -0,0 +1,60 @@
|
|
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
|
+
|
7
|
+
module GoodData
|
8
|
+
class DashboardItem
|
9
|
+
include GoodData::Mixin::RootKeyGetter
|
10
|
+
include GoodData::Mixin::DataGetter
|
11
|
+
|
12
|
+
attr_reader :tab
|
13
|
+
attr_accessor :json
|
14
|
+
|
15
|
+
def initialize(tab, json)
|
16
|
+
@tab = tab
|
17
|
+
@json = json
|
18
|
+
end
|
19
|
+
|
20
|
+
def position_x
|
21
|
+
data['positionX']
|
22
|
+
end
|
23
|
+
|
24
|
+
alias_method :pos_x, :position_x
|
25
|
+
|
26
|
+
def position_x=(new_position_x)
|
27
|
+
data['positionX'] = new_position_x
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :pos_x=, :position_x=
|
31
|
+
|
32
|
+
def position_y
|
33
|
+
data['positionY']
|
34
|
+
end
|
35
|
+
|
36
|
+
alias_method :pos_y, :position_y
|
37
|
+
|
38
|
+
def position_y=(new_position_y)
|
39
|
+
data['positionY'] = new_position_y
|
40
|
+
end
|
41
|
+
|
42
|
+
alias_method :pos_y=, :position_y=
|
43
|
+
|
44
|
+
def size_x
|
45
|
+
data['sizeX']
|
46
|
+
end
|
47
|
+
|
48
|
+
def size_x=(new_size_x)
|
49
|
+
data['sizeX'] = new_size_x
|
50
|
+
end
|
51
|
+
|
52
|
+
def size_y
|
53
|
+
data['sizeY']
|
54
|
+
end
|
55
|
+
|
56
|
+
def size_y=(new_size_y)
|
57
|
+
data['sizeY'] = new_size_y
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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
|
+
|
7
|
+
require_relative 'dashboard_item'
|
8
|
+
|
9
|
+
module GoodData
|
10
|
+
class FilterItem < DashboardItem
|
11
|
+
def initialize(tab, json)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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
|
+
|
7
|
+
require_relative 'dashboard_item'
|
8
|
+
|
9
|
+
module GoodData
|
10
|
+
class ReportItem < DashboardItem
|
11
|
+
def initialize(tab, json)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def filters
|
16
|
+
data['filters']
|
17
|
+
end
|
18
|
+
|
19
|
+
def filters=(new_filters)
|
20
|
+
data['filters'] = new_filters
|
21
|
+
end
|
22
|
+
|
23
|
+
def obj
|
24
|
+
GoodData::MdObject[data['obj'], :client => tab.dashboard.client, :project => tab.dashboard.project]
|
25
|
+
end
|
26
|
+
|
27
|
+
alias_method :object, :obj
|
28
|
+
|
29
|
+
def obj=(new_obj)
|
30
|
+
data['obj'] = new_obj.is_a?(String) ? new_obj : new_obj.uri
|
31
|
+
end
|
32
|
+
|
33
|
+
alias_method :object=, :obj=
|
34
|
+
|
35
|
+
def style
|
36
|
+
data['style']
|
37
|
+
end
|
38
|
+
|
39
|
+
def style=(new_style)
|
40
|
+
data['style'] = new_style
|
41
|
+
end
|
42
|
+
|
43
|
+
def visualization
|
44
|
+
data['visualization']
|
45
|
+
end
|
46
|
+
|
47
|
+
def visualization=(new_visualization)
|
48
|
+
data['visualization'] = new_visualization
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,88 @@
|
|
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
|
+
|
7
|
+
require_relative '../../core/core'
|
8
|
+
require_relative '../metadata'
|
9
|
+
require_relative 'metadata'
|
10
|
+
require_relative 'report'
|
11
|
+
|
12
|
+
require 'multi_json'
|
13
|
+
|
14
|
+
module GoodData
|
15
|
+
class DashboardTab
|
16
|
+
attr_reader :dashboard
|
17
|
+
attr_accessor :json
|
18
|
+
|
19
|
+
def initialize(dashboard, json)
|
20
|
+
@dashboard = dashboard
|
21
|
+
@json = json
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_report_item(item)
|
25
|
+
report = item[:report]
|
26
|
+
|
27
|
+
new_item_json = {
|
28
|
+
:reportItem => {
|
29
|
+
:obj => report.uri,
|
30
|
+
:sizeY => item[:size_y] || 200,
|
31
|
+
:sizeX => item[:size_x] || 300,
|
32
|
+
:style => {
|
33
|
+
:displayTitle => 1,
|
34
|
+
:background => {
|
35
|
+
:opacity => 0
|
36
|
+
}
|
37
|
+
},
|
38
|
+
:visualization => {
|
39
|
+
:grid => {
|
40
|
+
:columnWidths => []
|
41
|
+
},
|
42
|
+
:oneNumber => {
|
43
|
+
:labels => {}
|
44
|
+
}
|
45
|
+
},
|
46
|
+
:positionY => item[:position_y] || 0,
|
47
|
+
:filters => [],
|
48
|
+
:positionX => item[:position_x] || 0
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
new_item = GoodData::DashboardItem.new(self, GoodData::Helpers.deep_stringify_keys(new_item_json))
|
53
|
+
json['items'] << new_item.json
|
54
|
+
new_item
|
55
|
+
end
|
56
|
+
alias_method :add_report_item, :create_report_item
|
57
|
+
|
58
|
+
def identifier
|
59
|
+
@json['identifier']
|
60
|
+
end
|
61
|
+
|
62
|
+
def identifier=(new_identifier)
|
63
|
+
@json['identifier'] = new_identifier
|
64
|
+
end
|
65
|
+
|
66
|
+
def items
|
67
|
+
@json['items'].map do |item|
|
68
|
+
type = item.keys.first
|
69
|
+
case type
|
70
|
+
when 'reportItem'
|
71
|
+
GoodData::ReportItem.new(self, item)
|
72
|
+
when 'filterItem'
|
73
|
+
GoodData::FilterItem.new(self, item)
|
74
|
+
else
|
75
|
+
GoodData::DashboardItem.new(self, item)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def title
|
81
|
+
@json['title']
|
82
|
+
end
|
83
|
+
|
84
|
+
def title=(new_title)
|
85
|
+
@json['title'] = new_title
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -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_relative '../metadata'
|
4
8
|
require_relative '../../mixins/is_dimension'
|
@@ -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_relative '../metadata'
|
4
8
|
require_relative '../../core/rest'
|
@@ -36,5 +40,7 @@ module GoodData
|
|
36
40
|
a_title = options[:title] || "#{a_type} of #{title}"
|
37
41
|
project.create_metric("SELECT #{a_type.to_s.upcase}([#{uri}])", title: a_title, extended_notation: false)
|
38
42
|
end
|
43
|
+
|
44
|
+
alias_method :create_measure, :create_metric
|
39
45
|
end
|
40
46
|
end
|
@@ -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_relative '../metadata'
|
4
8
|
require_relative '../../mixins/is_label'
|
@@ -60,6 +64,17 @@ module GoodData
|
|
60
64
|
page_limit = options[:limit] || 100
|
61
65
|
loop do
|
62
66
|
results = client.post("#{uri}/validElements?limit=#{page_limit}&offset=#{offset}&order=asc", {})
|
67
|
+
|
68
|
+
# Implementation of polling is based on
|
69
|
+
# https://opengrok.intgdc.com/source/xref/gdc-backend/src/test/java/com/gooddata/service/dao/ValidElementsDaoTest.java
|
70
|
+
status_url = results['uri']
|
71
|
+
if status_url
|
72
|
+
results = client.poll_on_response(status_url) do |body|
|
73
|
+
status = body['taskState']['status']
|
74
|
+
status == 'RUNNING' || status == 'PREPARED'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
63
78
|
elements = results['validElements']
|
64
79
|
elements['items'].map do |el|
|
65
80
|
v = el['element']
|
@@ -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_relative '../../goodzilla/goodzilla'
|
4
8
|
require_relative '../../mixins/mixins'
|
@@ -8,8 +12,6 @@ require_relative 'metadata'
|
|
8
12
|
module GoodData
|
9
13
|
# Metric representation
|
10
14
|
class Metric < MdObject
|
11
|
-
attr_reader :json
|
12
|
-
|
13
15
|
include GoodData::Mixin::Lockable
|
14
16
|
|
15
17
|
alias_method :to_hash, :json
|
@@ -135,9 +137,8 @@ module GoodData
|
|
135
137
|
:client => client,
|
136
138
|
:project => project
|
137
139
|
}
|
138
|
-
|
139
140
|
res = GoodData::ReportDefinition.execute(opts.merge(:left => self))
|
140
|
-
res
|
141
|
+
res.data[0][0] if res && !res.empty?
|
141
142
|
end
|
142
143
|
|
143
144
|
def expression
|