gooddata 0.6.51 → 0.6.52
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/.rubocop.yml +1 -1
- data/CHANGELOG.md +13 -1
- data/CONTRIBUTING.md +25 -0
- data/PULL_REQUEST_TEMPLATE.md +5 -0
- data/README.md +7 -4
- data/gooddata.gemspec +2 -3
- data/lib/gooddata.rb +1 -0
- data/lib/gooddata/bricks/base_downloader.rb +6 -6
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +15 -5
- data/lib/gooddata/bricks/middleware/dwh_middleware.rb +15 -3
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +13 -4
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +3 -0
- data/lib/gooddata/exceptions/no_project_error.rb +5 -1
- data/lib/gooddata/goodzilla/goodzilla.rb +7 -6
- data/lib/gooddata/helpers/data_helper.rb +4 -4
- data/lib/gooddata/helpers/global_helpers_params.rb +61 -39
- data/lib/gooddata/lcm/actions/apply_custom_maql.rb +9 -0
- data/lib/gooddata/lcm/actions/associate_clients.rb +23 -4
- data/lib/gooddata/lcm/actions/collect_attrs.rb +56 -0
- data/lib/gooddata/lcm/actions/collect_ca_metrics.rb +53 -0
- data/lib/gooddata/lcm/actions/collect_clients.rb +25 -3
- data/lib/gooddata/lcm/actions/collect_meta.rb +83 -0
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +12 -4
- data/lib/gooddata/lcm/actions/collect_segments.rb +4 -4
- data/lib/gooddata/lcm/actions/collect_tagged_objects.rb +74 -0
- data/lib/gooddata/lcm/actions/create_segment_masters.rb +16 -30
- data/lib/gooddata/lcm/actions/ensure_release_table.rb +0 -3
- data/lib/gooddata/lcm/actions/ensure_segments.rb +1 -4
- data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +5 -5
- data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +8 -5
- data/lib/gooddata/lcm/actions/hello_world.rb +0 -3
- data/lib/gooddata/lcm/actions/import_object_collections.rb +60 -0
- data/lib/gooddata/lcm/actions/print_actions.rb +0 -3
- data/lib/gooddata/lcm/actions/print_modes.rb +0 -3
- data/lib/gooddata/lcm/actions/print_types.rb +1 -4
- data/lib/gooddata/lcm/actions/provision_clients.rb +5 -5
- data/lib/gooddata/lcm/actions/purge_clients.rb +4 -10
- data/lib/gooddata/lcm/actions/segments_filter.rb +0 -6
- data/lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb +8 -4
- data/lib/gooddata/lcm/actions/synchronize_cas.rb +61 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +9 -3
- data/lib/gooddata/lcm/actions/synchronize_color_palette.rb +13 -5
- data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +71 -17
- data/lib/gooddata/lcm/actions/synchronize_label_types.rb +8 -5
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +17 -8
- data/lib/gooddata/lcm/actions/synchronize_meta.rb +0 -3
- data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +9 -4
- data/lib/gooddata/lcm/actions/synchronize_processes.rb +9 -5
- data/lib/gooddata/lcm/actions/synchronize_schedules.rb +15 -5
- data/lib/gooddata/lcm/actions/synchronize_tag_objects.rb +61 -0
- data/lib/gooddata/lcm/actions/update_release_table.rb +0 -3
- data/lib/gooddata/lcm/helpers/tags_helper.rb +35 -0
- data/lib/gooddata/lcm/lcm.rb +22 -4
- data/lib/gooddata/lcm/lcm2.rb +66 -13
- data/lib/gooddata/lcm/types/complex/update_preference.rb +1 -1
- data/lib/gooddata/mixins/md_finders.rb +4 -2
- data/lib/gooddata/mixins/md_object_indexer.rb +13 -3
- data/lib/gooddata/mixins/md_object_query.rb +8 -2
- data/lib/gooddata/models/blueprint/date_dimension.rb +6 -0
- data/lib/gooddata/models/blueprint/project_blueprint.rb +41 -11
- data/lib/gooddata/models/blueprint/project_builder.rb +20 -0
- data/lib/gooddata/models/blueprint/to_wire.rb +7 -0
- data/lib/gooddata/models/client.rb +6 -0
- data/lib/gooddata/models/domain.rb +6 -6
- data/lib/gooddata/models/from_wire.rb +5 -1
- data/lib/gooddata/models/metadata.rb +55 -9
- data/lib/gooddata/models/metadata/attribute.rb +19 -4
- data/lib/gooddata/models/metadata/dashboard.rb +15 -3
- data/lib/gooddata/models/metadata/dataset.rb +5 -2
- data/lib/gooddata/models/metadata/dimension.rb +4 -1
- data/lib/gooddata/models/metadata/fact.rb +9 -2
- data/lib/gooddata/models/metadata/folder.rb +4 -1
- data/lib/gooddata/models/metadata/metric.rb +11 -3
- data/lib/gooddata/models/metadata/report.rb +7 -2
- data/lib/gooddata/models/metadata/report_definition.rb +11 -4
- data/lib/gooddata/models/metadata/scheduled_mail.rb +4 -1
- data/lib/gooddata/models/metadata/variable.rb +7 -2
- data/lib/gooddata/models/model.rb +14 -3
- data/lib/gooddata/models/process.rb +10 -9
- data/lib/gooddata/models/project.rb +134 -36
- data/lib/gooddata/models/project_creator.rb +43 -20
- data/lib/gooddata/models/report_data_result.rb +6 -2
- data/lib/gooddata/models/schedule.rb +6 -3
- data/lib/gooddata/models/subscription.rb +8 -1
- data/lib/gooddata/models/user_filters/user_filter.rb +1 -0
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +18 -4
- data/lib/gooddata/models/user_filters/variable_user_filter.rb +3 -1
- data/lib/gooddata/rest/client.rb +4 -6
- data/lib/gooddata/rest/connection.rb +10 -2
- data/lib/gooddata/version.rb +1 -1
- data/spec/data/blueprints/test_blueprint.json +1 -0
- data/spec/data/wire_models/test_blueprint.json +3 -0
- data/spec/data/workspace_table.csv +3 -0
- data/spec/environment/development.rb +4 -1
- data/spec/environment/environment.rb +1 -1
- data/spec/environment/staging.rb +5 -1
- data/spec/environment/testing.rb +5 -2
- data/spec/integration/blueprint_with_ca_spec.rb +56 -0
- data/spec/integration/clients_spec.rb +21 -0
- data/spec/integration/command_datawarehouse_spec.rb +7 -1
- data/spec/integration/create_from_template_spec.rb +9 -3
- data/spec/integration/project_spec.rb +7 -0
- data/spec/integration/segments_spec.rb +0 -53
- data/spec/integration/subscription_spec.rb +29 -4
- data/spec/integration/urn_date_dim_spec.rb +53 -0
- data/spec/integration/user_filters_spec.rb +6 -0
- data/spec/integration/variables_spec.rb +1 -2
- data/spec/spec_helper.rb +5 -30
- data/spec/unit/actions/collect_clients_spec.rb +38 -0
- data/spec/unit/actions/collect_meta_spec.rb +87 -0
- data/spec/unit/actions/collect_segment_clients_spec.rb +40 -0
- data/spec/unit/actions/collect_tagged_objects_spec.rb +110 -0
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +51 -0
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +55 -1
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +15 -0
- data/spec/unit/helpers/data_helper_spec.rb +3 -5
- data/spec/unit/helpers/global_helpers_spec.rb +29 -0
- data/spec/unit/helpers_spec.rb +18 -1
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +1 -23
- data/spec/unit/models/domain_spec.rb +19 -0
- data/spec/unit/models/metadata_spec.rb +34 -0
- data/spec/unit/models/schedule_spec.rb +31 -0
- data/spec/unit/models/to_manifest_spec.rb +10 -2
- data/spec/unit/models/unit_project_spec.rb +6 -1
- data/spec/unit/rest/polling_spec.rb +13 -1
- metadata +49 -31
|
@@ -61,6 +61,26 @@ module GoodData
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
def add_computed_attribute(id, options = {})
|
|
65
|
+
metric = options[:metric].is_a?(GoodData::Metric) ? options[:metric].identifier : options[:metric]
|
|
66
|
+
attribute = options[:attribute].is_a?(GoodData::Attribute) ? options[:attribute].identifier : options[:attribute]
|
|
67
|
+
buckets = options[:buckets].sort_by do |bucket|
|
|
68
|
+
bucket.key?(:highest_value) ? bucket[:highest_value] : Float::INFINITY
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
last_bucket = buckets.pop
|
|
72
|
+
relations = buckets.map do |bucket|
|
|
73
|
+
"when {#{metric}} <= #{bucket[:highest_value]} then {#{id}?\"#{bucket[:label]}\"}"
|
|
74
|
+
end
|
|
75
|
+
relations += ["when {#{metric}} > #{buckets.last[:highest_value]} then {#{id}?\"#{last_bucket[:label]}\"} else {#{id}?\"\"} end"]
|
|
76
|
+
relations = ["to {#{attribute}} as case #{relations.join(', ')}"]
|
|
77
|
+
|
|
78
|
+
add_dataset(id.sub('attr.', 'dataset.'), options) do |d|
|
|
79
|
+
d.add_anchor(id, options.merge(relations: relations))
|
|
80
|
+
d.add_label(id.sub('attr.', 'label.'), reference: id, default_label: true)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
64
84
|
def to_json(options = {})
|
|
65
85
|
eliminate_empty = options[:eliminate_empty] || false
|
|
66
86
|
|
|
@@ -75,6 +75,11 @@ module GoodData
|
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
|
+
|
|
79
|
+
if attribute[:relations]
|
|
80
|
+
a[:attribute][:relations] = attribute[:relations]
|
|
81
|
+
end
|
|
82
|
+
|
|
78
83
|
default = ls.find { |l| l[:default_label] }
|
|
79
84
|
a[:attribute][:defaultLabel] = (default && default[:id]) || ls.first[:id] unless ls.empty?
|
|
80
85
|
end
|
|
@@ -128,6 +133,7 @@ module GoodData
|
|
|
128
133
|
}
|
|
129
134
|
payload.tap do |p|
|
|
130
135
|
p[:fact][:description] = GoodData::Model.description(fact) if GoodData::Model.description(fact)
|
|
136
|
+
p[:fact][:restricted] = fact[:restricted] if fact[:restricted]
|
|
131
137
|
end
|
|
132
138
|
end
|
|
133
139
|
|
|
@@ -153,6 +159,7 @@ module GoodData
|
|
|
153
159
|
diffRequest: {
|
|
154
160
|
targetModel: {
|
|
155
161
|
projectModel: {
|
|
162
|
+
modelMetadata: { containCA: what[:include_ca] },
|
|
156
163
|
datasets: (what[:datasets] || []).map { |d| dataset_to_wire(what, d) },
|
|
157
164
|
dateDimensions: (what[:date_dimensions] || []).map { |d| date_dimension_to_wire(what, d) }
|
|
158
165
|
}
|
|
@@ -82,6 +82,7 @@ module GoodData
|
|
|
82
82
|
s.segment = segment.uri
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
|
+
alias_method :associate, :create
|
|
85
86
|
|
|
86
87
|
def update_setting(name, value, opts = {})
|
|
87
88
|
return nil unless value
|
|
@@ -199,6 +200,11 @@ module GoodData
|
|
|
199
200
|
# @return [GoodData::Client] Segment instance
|
|
200
201
|
def delete
|
|
201
202
|
project.delete if project && !project.deleted?
|
|
203
|
+
dissociate
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Deletes a client but maintain their project
|
|
207
|
+
def dissociate
|
|
202
208
|
client.delete(uri) if uri
|
|
203
209
|
end
|
|
204
210
|
|
|
@@ -300,15 +300,15 @@ to new properties (email=#{user_data[:email]}, sso_provider=#{user_data[:sso_pro
|
|
|
300
300
|
# @return [Object] Raw response
|
|
301
301
|
#
|
|
302
302
|
def clients(id = :all)
|
|
303
|
-
clients_uri = "/gdc/domains/#{name}/clients"
|
|
304
|
-
res = client.get(clients_uri)
|
|
305
|
-
res_clients = (res['clients'] && res['clients']['items']) || []
|
|
306
303
|
if id == :all
|
|
304
|
+
res = client.get("/gdc/domains/#{name}/clients")
|
|
305
|
+
res_clients = (res['clients'] && res['clients']['items']) || []
|
|
307
306
|
res_clients.map { |res_client| client.create(GoodData::Client, res_client) }
|
|
308
307
|
else
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
res = client.get("/gdc/domains/#{name}/clients/#{id}")
|
|
309
|
+
error = GoodData::Helpers.interpolate_error_message(res)
|
|
310
|
+
raise error if error
|
|
311
|
+
client.create(GoodData::Client, res)
|
|
312
312
|
end
|
|
313
313
|
end
|
|
314
314
|
|
|
@@ -27,12 +27,13 @@ module GoodData
|
|
|
27
27
|
#
|
|
28
28
|
# @param wire_model [Hash] Whatever comes from wire
|
|
29
29
|
# @return [GoodData::Model::ProjectBlueprint] Manifest for a particular reference
|
|
30
|
-
def self.from_wire(wire_model)
|
|
30
|
+
def self.from_wire(wire_model, options = {})
|
|
31
31
|
model = wire_model['projectModelView']['model']['projectModel']
|
|
32
32
|
datasets = model['datasets'] || []
|
|
33
33
|
dims = model['dateDimensions'] || []
|
|
34
34
|
|
|
35
35
|
ProjectBlueprint.new(
|
|
36
|
+
include_ca: options[:include_ca],
|
|
36
37
|
datasets: datasets.map { |ds| dataset_from_wire(ds) },
|
|
37
38
|
date_dimensions: dims.map { |dd| parse_date_dimensions(dd) }
|
|
38
39
|
)
|
|
@@ -91,6 +92,8 @@ module GoodData
|
|
|
91
92
|
end
|
|
92
93
|
end
|
|
93
94
|
end
|
|
95
|
+
|
|
96
|
+
attribute['relations'] && a[:relations] = attribute['relations']
|
|
94
97
|
end
|
|
95
98
|
[attribute] + pl + rl
|
|
96
99
|
end
|
|
@@ -104,6 +107,7 @@ module GoodData
|
|
|
104
107
|
d[:type] = :date_dimension
|
|
105
108
|
d[:id] = date_dim['dateDimension']['name']
|
|
106
109
|
d[:title] = date_dim['dateDimension']['title']
|
|
110
|
+
d[:urn] = date_dim['dateDimension']['urn']
|
|
107
111
|
end
|
|
108
112
|
end
|
|
109
113
|
|
|
@@ -29,8 +29,12 @@ module GoodData
|
|
|
29
29
|
include Mixin::MdGrantees
|
|
30
30
|
|
|
31
31
|
class << self
|
|
32
|
-
# Method used for replacing objects like Attribute, Fact or Metric.
|
|
33
|
-
#
|
|
32
|
+
# Method used for replacing objects like Attribute, Fact or Metric.
|
|
33
|
+
# It takes the object. Scans its JSON representation and returns
|
|
34
|
+
# a new one with object references changed according to mapping.
|
|
35
|
+
# The references an be found either in the object structure or in
|
|
36
|
+
# the MAQL in bracketed form. This implementation takes care only
|
|
37
|
+
# of those in bracketed form.
|
|
34
38
|
#
|
|
35
39
|
# @param obj [GoodData::MdObject] what Object that should be replaced
|
|
36
40
|
# @param mapping [Array[Array]] Array of mapping pairs.
|
|
@@ -39,8 +43,12 @@ module GoodData
|
|
|
39
43
|
replace(obj, mapping) { |e, a, b| e.gsub("[#{a}]", "[#{b}]") }
|
|
40
44
|
end
|
|
41
45
|
|
|
42
|
-
# Method used for replacing objects like Attribute, Fact or Metric.
|
|
43
|
-
#
|
|
46
|
+
# Method used for replacing objects like Attribute, Fact or Metric.
|
|
47
|
+
# It takes the object. Scans its JSON representation and returns
|
|
48
|
+
# a new one with object references changed according to mapping.
|
|
49
|
+
# The references an be found either in the object structure or in the MAQL
|
|
50
|
+
# in bracketed form. This implementation takes care only of those
|
|
51
|
+
# in object structure where they are as a string in JSON.
|
|
44
52
|
#
|
|
45
53
|
# @param obj [GoodData::MdObject] Object that should be replaced
|
|
46
54
|
# @param mapping [Array[Array]] Array of mapping pairs.
|
|
@@ -139,11 +147,7 @@ module GoodData
|
|
|
139
147
|
end
|
|
140
148
|
|
|
141
149
|
def deprecated
|
|
142
|
-
|
|
143
|
-
true
|
|
144
|
-
else
|
|
145
|
-
false
|
|
146
|
-
end
|
|
150
|
+
meta['deprecated'] == '1' || get_flag?('deprecated')
|
|
147
151
|
end
|
|
148
152
|
alias_method :deprecated?, :deprecated
|
|
149
153
|
|
|
@@ -155,6 +159,32 @@ module GoodData
|
|
|
155
159
|
else
|
|
156
160
|
fail 'You have to provide flag as either 1 or "1" or 0 or "0" or true/false'
|
|
157
161
|
end
|
|
162
|
+
|
|
163
|
+
set_flag('deprecated', flag)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def production
|
|
167
|
+
meta['isProduction'] == '1' || get_flag?('production')
|
|
168
|
+
end
|
|
169
|
+
alias_method :production?, :production
|
|
170
|
+
|
|
171
|
+
def production=(flag)
|
|
172
|
+
if flag
|
|
173
|
+
meta['isProduction'] = '1'
|
|
174
|
+
else
|
|
175
|
+
meta['isProduction'] == '0'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
set_flag('production', flag)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def restricted
|
|
182
|
+
get_flag?('restricted')
|
|
183
|
+
end
|
|
184
|
+
alias_method :restricted?, :restricted
|
|
185
|
+
|
|
186
|
+
def restricted=(flag)
|
|
187
|
+
set_flag('restricted', flag)
|
|
158
188
|
end
|
|
159
189
|
|
|
160
190
|
def project
|
|
@@ -274,5 +304,21 @@ module GoodData
|
|
|
274
304
|
def validate
|
|
275
305
|
true
|
|
276
306
|
end
|
|
307
|
+
|
|
308
|
+
def get_flag?(flag)
|
|
309
|
+
meta['flags'] && meta['flags'].include?(flag)
|
|
310
|
+
end
|
|
311
|
+
alias_method :has_flag?, :get_flag?
|
|
312
|
+
|
|
313
|
+
def set_flag(flag, value)
|
|
314
|
+
meta['flags'] = [] unless meta['flags']
|
|
315
|
+
|
|
316
|
+
if (value == '1' || value == 1 || value == true) && !has_flag?(flag)
|
|
317
|
+
meta['flags'].push(flag)
|
|
318
|
+
meta['flags'].sort!
|
|
319
|
+
elsif !value && has_flag?(flag)
|
|
320
|
+
meta['flags'].delete(flag)
|
|
321
|
+
end
|
|
322
|
+
end
|
|
277
323
|
end
|
|
278
324
|
end
|
|
@@ -20,7 +20,10 @@ module GoodData
|
|
|
20
20
|
# Method intended to get all objects of that type in a specified project
|
|
21
21
|
#
|
|
22
22
|
# @param options [Hash] the options hash
|
|
23
|
-
# @option options [Boolean] :full if passed true the subclass can decide
|
|
23
|
+
# @option options [Boolean] :full if passed true the subclass can decide
|
|
24
|
+
# to pull in full objects. This is desirable from the usability POV
|
|
25
|
+
# but unfortunately has negative impact on performance so it is
|
|
26
|
+
# not the default.
|
|
24
27
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
25
28
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
26
29
|
query('attribute', Attribute, options)
|
|
@@ -92,15 +95,23 @@ module GoodData
|
|
|
92
95
|
end
|
|
93
96
|
alias_method :primary_label, :primary_display_form
|
|
94
97
|
|
|
95
|
-
# Creates the basic count metric with the attribute used. If you need to
|
|
98
|
+
# Creates the basic count metric with the attribute used. If you need to
|
|
99
|
+
# compute the attribute on a different dataset you can specify that in
|
|
100
|
+
# params. The metric created is not saved.
|
|
96
101
|
# @param [Hash] options the options to pass to the value list
|
|
97
102
|
# @option options [Symbol] :type type of aggregation function.
|
|
98
|
-
# @option options [Symbol] :attribute Use this attribute if you need to
|
|
103
|
+
# @option options [Symbol] :attribute Use this attribute if you need to
|
|
104
|
+
# express different dataset for performing the computation on. It basically
|
|
105
|
+
# serves for creating metrics like SELECT COUNT(User, Opportunity).
|
|
99
106
|
# @return [GoodData::Metric]
|
|
100
107
|
def create_metric(options = {})
|
|
101
108
|
an_attribute = options[:attribute]
|
|
102
109
|
a_type = options[:type] || :count
|
|
103
|
-
|
|
110
|
+
unless ATTRIBUTE_BASE_AGGREGATIONS.include?(a_type)
|
|
111
|
+
fail 'Suggested aggreagtion function (#{a_type}) does not exist for ' \
|
|
112
|
+
'base metric created out of attribute. You can use only one of' \
|
|
113
|
+
"#{ATTRIBUTE_BASE_AGGREGATIONS.map { |x| ':' + x.to_s }.join(',')}"
|
|
114
|
+
end
|
|
104
115
|
a_title = options[:title] || "#{a_type} of #{title}"
|
|
105
116
|
if an_attribute
|
|
106
117
|
project.create_metric("SELECT #{a_type.to_s.upcase}([#{uri}], [#{an_attribute.uri}])", title: a_title, extended_notation: false)
|
|
@@ -136,5 +147,9 @@ module GoodData
|
|
|
136
147
|
def label_by_name(name)
|
|
137
148
|
labels.find { |label| label.title =~ /#{name}/ || label.identifier =~ /#{name}/ }
|
|
138
149
|
end
|
|
150
|
+
|
|
151
|
+
def computed_attribute?
|
|
152
|
+
content['rel'] && !content['rel'].empty?
|
|
153
|
+
end
|
|
139
154
|
end
|
|
140
155
|
end
|
|
@@ -46,7 +46,10 @@ module GoodData
|
|
|
46
46
|
# Method intended to get all objects of that type in a specified project
|
|
47
47
|
#
|
|
48
48
|
# @param options [Hash] the options hash
|
|
49
|
-
# @option options [Boolean] :full if passed true the subclass can
|
|
49
|
+
# @option options [Boolean] :full if passed true the subclass can
|
|
50
|
+
# decide to pull in full objects. This is desirable from the
|
|
51
|
+
# usability POV but unfortunately has negative impact on performance
|
|
52
|
+
# so it is not the default.
|
|
50
53
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
51
54
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
52
55
|
query('projectDashboard', Dashboard, options)
|
|
@@ -81,11 +84,20 @@ module GoodData
|
|
|
81
84
|
tab = options[:tab] || ''
|
|
82
85
|
|
|
83
86
|
req_uri = "/gdc/projects/#{project.pid}/clientexport"
|
|
84
|
-
x = client.post(
|
|
87
|
+
x = client.post(
|
|
88
|
+
req_uri,
|
|
89
|
+
'clientExport' => {
|
|
90
|
+
'url' => "#{client.connection.server_url}/dashboard.html#project=" \
|
|
91
|
+
"#{project.uri}&dashboard=#{uri}&tab=#{tab}&export=1",
|
|
92
|
+
'name' => title
|
|
93
|
+
}
|
|
94
|
+
)
|
|
85
95
|
client.poll_on_code(x['asyncTask']['link']['poll'], options.merge(process: false))
|
|
86
96
|
end
|
|
87
97
|
|
|
88
|
-
# Method used for replacing values in their state according to mapping.
|
|
98
|
+
# Method used for replacing values in their state according to mapping.
|
|
99
|
+
# Can be used to replace any values but it is typically used to replace
|
|
100
|
+
# the URIs. Returns a new object of the same type.
|
|
89
101
|
#
|
|
90
102
|
# @param [Array<Array>]Mapping specifying what should be exchanged for what. As mapping should be used output of GoodData::Helpers.prepare_mapping.
|
|
91
103
|
# @return [GoodData::Dashboard]
|
|
@@ -12,7 +12,10 @@ module GoodData
|
|
|
12
12
|
# Method intended to get all objects of that type in a specified project
|
|
13
13
|
#
|
|
14
14
|
# @param options [Hash] the options hash
|
|
15
|
-
# @option options [Boolean] :full if passed true the subclass can decide
|
|
15
|
+
# @option options [Boolean] :full if passed true the subclass can decide
|
|
16
|
+
# to pull in full objects. This is desirable from the usability POV
|
|
17
|
+
# but unfortunately has negative impact on performance so it is
|
|
18
|
+
# not the default.
|
|
16
19
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
17
20
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
18
21
|
query('dataSet', Dataset, options)
|
|
@@ -52,7 +55,7 @@ module GoodData
|
|
|
52
55
|
#
|
|
53
56
|
# @return [Boolean]
|
|
54
57
|
def date_dimension?
|
|
55
|
-
|
|
58
|
+
content['urn'] && !content['urn'].empty? && fact_uris.empty?
|
|
56
59
|
end
|
|
57
60
|
|
|
58
61
|
# Delete the data in a dataset
|
|
@@ -16,7 +16,10 @@ module GoodData
|
|
|
16
16
|
# Method intended to get all objects of that type in a specified project
|
|
17
17
|
#
|
|
18
18
|
# @param options [Hash] the options hash
|
|
19
|
-
# @option options [Boolean] :full if passed true the subclass can
|
|
19
|
+
# @option options [Boolean] :full if passed true the subclass can
|
|
20
|
+
# decide to pull in full objects. This is desirable from the usability
|
|
21
|
+
# POV but unfortunately has negative impact on performance so it is
|
|
22
|
+
# not the default.
|
|
20
23
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
21
24
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
22
25
|
query('dimension', Dimension, options)
|
|
@@ -21,7 +21,10 @@ module GoodData
|
|
|
21
21
|
# Method intended to get all objects of that type in a specified project
|
|
22
22
|
#
|
|
23
23
|
# @param options [Hash] the options hash
|
|
24
|
-
# @option options [Boolean] :full if passed true the subclass can decide
|
|
24
|
+
# @option options [Boolean] :full if passed true the subclass can decide
|
|
25
|
+
# to pull in full objects. This is desirable from the usability POV
|
|
26
|
+
# but unfortunately has negative impact on performance so it is
|
|
27
|
+
# not the default.
|
|
25
28
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
26
29
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
27
30
|
query('fact', Fact, options)
|
|
@@ -34,7 +37,11 @@ module GoodData
|
|
|
34
37
|
# @return [GoodData::Metric]
|
|
35
38
|
def create_metric(options = { :type => :sum })
|
|
36
39
|
a_type = options[:type] || :sum
|
|
37
|
-
|
|
40
|
+
unless FACT_BASE_AGGREGATIONS.include?(a_type)
|
|
41
|
+
fail "Suggested aggreagtion function (#{a_type}) does not exist for " /
|
|
42
|
+
'base metric created out of fact. You can use only one of ' /
|
|
43
|
+
"#{FACT_BASE_AGGREGATIONS.map { |x| ':' + x.to_s }.join(',')}"
|
|
44
|
+
end
|
|
38
45
|
a_title = options[:title] || "#{a_type} of #{title}"
|
|
39
46
|
project.create_metric("SELECT #{a_type.to_s.upcase}([#{uri}])", title: a_title, extended_notation: false)
|
|
40
47
|
end
|
|
@@ -18,7 +18,10 @@ module GoodData
|
|
|
18
18
|
# Method intended to get all objects of that type in a specified project
|
|
19
19
|
#
|
|
20
20
|
# @param options [Hash] the options hash
|
|
21
|
-
# @option options [Boolean] :full if passed true the subclass can decide
|
|
21
|
+
# @option options [Boolean] :full if passed true the subclass can decide
|
|
22
|
+
# to pull in full objects. This is desirable from the usability POV
|
|
23
|
+
# but unfortunately has negative impact on performance so it is not
|
|
24
|
+
# the default.
|
|
22
25
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
23
26
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
24
27
|
query('folder', Folder, options)
|
|
@@ -18,7 +18,10 @@ module GoodData
|
|
|
18
18
|
# Method intended to get all objects of that type in a specified project
|
|
19
19
|
#
|
|
20
20
|
# @param options [Hash] the options hash
|
|
21
|
-
# @option options [Boolean] :full if passed true the subclass can decide
|
|
21
|
+
# @option options [Boolean] :full if passed true the subclass can decide
|
|
22
|
+
# to pull in full objects. This is desirable from the usability POV
|
|
23
|
+
# but unfortunately has negative impact on performance so it is not
|
|
24
|
+
# the default.
|
|
22
25
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
23
26
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
24
27
|
query('metric', Metric, options)
|
|
@@ -139,7 +142,10 @@ module GoodData
|
|
|
139
142
|
true
|
|
140
143
|
end
|
|
141
144
|
|
|
142
|
-
# Checks that the expression contains certain metadata object.
|
|
145
|
+
# Checks that the expression contains certain metadata object.
|
|
146
|
+
# The difference between this and used_by using is in the fact that this
|
|
147
|
+
# is not a transitive closure. it searches only inside the expression
|
|
148
|
+
#
|
|
143
149
|
# @param [GoodData::MdObject] item Object that is going to be looked up
|
|
144
150
|
# @return [Boolean]
|
|
145
151
|
def contain?(item)
|
|
@@ -156,7 +162,9 @@ module GoodData
|
|
|
156
162
|
contain?(uri)
|
|
157
163
|
end
|
|
158
164
|
|
|
159
|
-
# Method used for replacing values in their state according to mapping.
|
|
165
|
+
# Method used for replacing values in their state according to mapping.
|
|
166
|
+
# Can be used to replace any values but it is typically used to replace
|
|
167
|
+
# the URIs. Returns a new object of the same type.
|
|
160
168
|
#
|
|
161
169
|
# @param [Array<Array>]Mapping specifying what should be exchanged for what. As mapping should be used output of GoodData::Helpers.prepare_mapping.
|
|
162
170
|
# @return [GoodData::Metric]
|
|
@@ -15,7 +15,10 @@ module GoodData
|
|
|
15
15
|
# Method intended to get all objects of that type in a specified project
|
|
16
16
|
#
|
|
17
17
|
# @param options [Hash] the options hash
|
|
18
|
-
# @option options [Boolean] :full if passed true the subclass can decide
|
|
18
|
+
# @option options [Boolean] :full if passed true the subclass can decide
|
|
19
|
+
# to pull in full objects. This is desirable from the usability POV
|
|
20
|
+
# but unfortunately has negative impact on performance so it is not
|
|
21
|
+
# the default.
|
|
19
22
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
20
23
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
21
24
|
query('report', Report, options)
|
|
@@ -203,7 +206,9 @@ module GoodData
|
|
|
203
206
|
self
|
|
204
207
|
end
|
|
205
208
|
|
|
206
|
-
# Method used for replacing values in their state according to mapping.
|
|
209
|
+
# Method used for replacing values in their state according to mapping.
|
|
210
|
+
# Can be used to replace any values but it is typically used to replace
|
|
211
|
+
# the URIs. Returns a new object of the same type.
|
|
207
212
|
#
|
|
208
213
|
# @param [Array<Array>]Mapping specifying what should be exchanged for what. As mapping should be used output of GoodData::Helpers.prepare_mapping.
|
|
209
214
|
# @return [GoodData::Report]
|
|
@@ -16,7 +16,10 @@ module GoodData
|
|
|
16
16
|
# Method intended to get all objects of that type in a specified project
|
|
17
17
|
#
|
|
18
18
|
# @param options [Hash] the options hash
|
|
19
|
-
# @option options [Boolean] :full if passed true the subclass can decide
|
|
19
|
+
# @option options [Boolean] :full if passed true the subclass can decide
|
|
20
|
+
# to pull in full objects. This is desirable from the usability POV
|
|
21
|
+
# but unfortunately has negative impact on performance so it is not
|
|
22
|
+
# the default.
|
|
20
23
|
# @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
|
|
21
24
|
def all(options = { :client => GoodData.connection, :project => GoodData.project })
|
|
22
25
|
query('reportDefinition', ReportDefinition, options)
|
|
@@ -50,7 +53,9 @@ module GoodData
|
|
|
50
53
|
}
|
|
51
54
|
end
|
|
52
55
|
|
|
53
|
-
# Method creates the list of filter representaion suitable for posting on
|
|
56
|
+
# Method creates the list of filter representaion suitable for posting on
|
|
57
|
+
# the api. It can currently recognize 2 types of filters. Variable filters
|
|
58
|
+
# and attribute filters. Method for internal usage.
|
|
54
59
|
#
|
|
55
60
|
# @param filters [GoodData::Variable|Array<Array>]
|
|
56
61
|
# @param options [Hash] the options hash
|
|
@@ -243,7 +248,9 @@ module GoodData
|
|
|
243
248
|
content['filters'].map { |f| f['expression'] }
|
|
244
249
|
end
|
|
245
250
|
|
|
246
|
-
# Method used for replacing values in their state according to mapping.
|
|
251
|
+
# Method used for replacing values in their state according to mapping.
|
|
252
|
+
# Can be used to replace any values but it is typically used to replace
|
|
253
|
+
# the URIs. Returns a new object of the same type.
|
|
247
254
|
#
|
|
248
255
|
# @param [Array<Array>]Mapping specifying what should be exchanged for what. As mapping should be used output of GoodData::Helpers.prepare_mapping.
|
|
249
256
|
# @return [GoodData::ReportDefinition]
|
|
@@ -251,7 +258,7 @@ module GoodData
|
|
|
251
258
|
x = GoodData::MdObject.replace_quoted(self, mapping)
|
|
252
259
|
x = GoodData::MdObject.replace_bracketed(x, mapping)
|
|
253
260
|
vals = GoodData::MdObject.find_replaceable_values(self, mapping)
|
|
254
|
-
GoodData::MdObject.replace_quoted(x, vals)
|
|
261
|
+
x = GoodData::MdObject.replace_quoted(x, vals)
|
|
255
262
|
GoodData::MdObject.replace_bracketed(x, vals)
|
|
256
263
|
end
|
|
257
264
|
|