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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +13 -1
  4. data/CONTRIBUTING.md +25 -0
  5. data/PULL_REQUEST_TEMPLATE.md +5 -0
  6. data/README.md +7 -4
  7. data/gooddata.gemspec +2 -3
  8. data/lib/gooddata.rb +1 -0
  9. data/lib/gooddata/bricks/base_downloader.rb +6 -6
  10. data/lib/gooddata/bricks/middleware/aws_middleware.rb +15 -5
  11. data/lib/gooddata/bricks/middleware/dwh_middleware.rb +15 -3
  12. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +13 -4
  13. data/lib/gooddata/bricks/middleware/logger_middleware.rb +3 -0
  14. data/lib/gooddata/exceptions/no_project_error.rb +5 -1
  15. data/lib/gooddata/goodzilla/goodzilla.rb +7 -6
  16. data/lib/gooddata/helpers/data_helper.rb +4 -4
  17. data/lib/gooddata/helpers/global_helpers_params.rb +61 -39
  18. data/lib/gooddata/lcm/actions/apply_custom_maql.rb +9 -0
  19. data/lib/gooddata/lcm/actions/associate_clients.rb +23 -4
  20. data/lib/gooddata/lcm/actions/collect_attrs.rb +56 -0
  21. data/lib/gooddata/lcm/actions/collect_ca_metrics.rb +53 -0
  22. data/lib/gooddata/lcm/actions/collect_clients.rb +25 -3
  23. data/lib/gooddata/lcm/actions/collect_meta.rb +83 -0
  24. data/lib/gooddata/lcm/actions/collect_segment_clients.rb +12 -4
  25. data/lib/gooddata/lcm/actions/collect_segments.rb +4 -4
  26. data/lib/gooddata/lcm/actions/collect_tagged_objects.rb +74 -0
  27. data/lib/gooddata/lcm/actions/create_segment_masters.rb +16 -30
  28. data/lib/gooddata/lcm/actions/ensure_release_table.rb +0 -3
  29. data/lib/gooddata/lcm/actions/ensure_segments.rb +1 -4
  30. data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +5 -5
  31. data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +8 -5
  32. data/lib/gooddata/lcm/actions/hello_world.rb +0 -3
  33. data/lib/gooddata/lcm/actions/import_object_collections.rb +60 -0
  34. data/lib/gooddata/lcm/actions/print_actions.rb +0 -3
  35. data/lib/gooddata/lcm/actions/print_modes.rb +0 -3
  36. data/lib/gooddata/lcm/actions/print_types.rb +1 -4
  37. data/lib/gooddata/lcm/actions/provision_clients.rb +5 -5
  38. data/lib/gooddata/lcm/actions/purge_clients.rb +4 -10
  39. data/lib/gooddata/lcm/actions/segments_filter.rb +0 -6
  40. data/lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb +8 -4
  41. data/lib/gooddata/lcm/actions/synchronize_cas.rb +61 -0
  42. data/lib/gooddata/lcm/actions/synchronize_clients.rb +9 -3
  43. data/lib/gooddata/lcm/actions/synchronize_color_palette.rb +13 -5
  44. data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +71 -17
  45. data/lib/gooddata/lcm/actions/synchronize_label_types.rb +8 -5
  46. data/lib/gooddata/lcm/actions/synchronize_ldm.rb +17 -8
  47. data/lib/gooddata/lcm/actions/synchronize_meta.rb +0 -3
  48. data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +9 -4
  49. data/lib/gooddata/lcm/actions/synchronize_processes.rb +9 -5
  50. data/lib/gooddata/lcm/actions/synchronize_schedules.rb +15 -5
  51. data/lib/gooddata/lcm/actions/synchronize_tag_objects.rb +61 -0
  52. data/lib/gooddata/lcm/actions/update_release_table.rb +0 -3
  53. data/lib/gooddata/lcm/helpers/tags_helper.rb +35 -0
  54. data/lib/gooddata/lcm/lcm.rb +22 -4
  55. data/lib/gooddata/lcm/lcm2.rb +66 -13
  56. data/lib/gooddata/lcm/types/complex/update_preference.rb +1 -1
  57. data/lib/gooddata/mixins/md_finders.rb +4 -2
  58. data/lib/gooddata/mixins/md_object_indexer.rb +13 -3
  59. data/lib/gooddata/mixins/md_object_query.rb +8 -2
  60. data/lib/gooddata/models/blueprint/date_dimension.rb +6 -0
  61. data/lib/gooddata/models/blueprint/project_blueprint.rb +41 -11
  62. data/lib/gooddata/models/blueprint/project_builder.rb +20 -0
  63. data/lib/gooddata/models/blueprint/to_wire.rb +7 -0
  64. data/lib/gooddata/models/client.rb +6 -0
  65. data/lib/gooddata/models/domain.rb +6 -6
  66. data/lib/gooddata/models/from_wire.rb +5 -1
  67. data/lib/gooddata/models/metadata.rb +55 -9
  68. data/lib/gooddata/models/metadata/attribute.rb +19 -4
  69. data/lib/gooddata/models/metadata/dashboard.rb +15 -3
  70. data/lib/gooddata/models/metadata/dataset.rb +5 -2
  71. data/lib/gooddata/models/metadata/dimension.rb +4 -1
  72. data/lib/gooddata/models/metadata/fact.rb +9 -2
  73. data/lib/gooddata/models/metadata/folder.rb +4 -1
  74. data/lib/gooddata/models/metadata/metric.rb +11 -3
  75. data/lib/gooddata/models/metadata/report.rb +7 -2
  76. data/lib/gooddata/models/metadata/report_definition.rb +11 -4
  77. data/lib/gooddata/models/metadata/scheduled_mail.rb +4 -1
  78. data/lib/gooddata/models/metadata/variable.rb +7 -2
  79. data/lib/gooddata/models/model.rb +14 -3
  80. data/lib/gooddata/models/process.rb +10 -9
  81. data/lib/gooddata/models/project.rb +134 -36
  82. data/lib/gooddata/models/project_creator.rb +43 -20
  83. data/lib/gooddata/models/report_data_result.rb +6 -2
  84. data/lib/gooddata/models/schedule.rb +6 -3
  85. data/lib/gooddata/models/subscription.rb +8 -1
  86. data/lib/gooddata/models/user_filters/user_filter.rb +1 -0
  87. data/lib/gooddata/models/user_filters/user_filter_builder.rb +18 -4
  88. data/lib/gooddata/models/user_filters/variable_user_filter.rb +3 -1
  89. data/lib/gooddata/rest/client.rb +4 -6
  90. data/lib/gooddata/rest/connection.rb +10 -2
  91. data/lib/gooddata/version.rb +1 -1
  92. data/spec/data/blueprints/test_blueprint.json +1 -0
  93. data/spec/data/wire_models/test_blueprint.json +3 -0
  94. data/spec/data/workspace_table.csv +3 -0
  95. data/spec/environment/development.rb +4 -1
  96. data/spec/environment/environment.rb +1 -1
  97. data/spec/environment/staging.rb +5 -1
  98. data/spec/environment/testing.rb +5 -2
  99. data/spec/integration/blueprint_with_ca_spec.rb +56 -0
  100. data/spec/integration/clients_spec.rb +21 -0
  101. data/spec/integration/command_datawarehouse_spec.rb +7 -1
  102. data/spec/integration/create_from_template_spec.rb +9 -3
  103. data/spec/integration/project_spec.rb +7 -0
  104. data/spec/integration/segments_spec.rb +0 -53
  105. data/spec/integration/subscription_spec.rb +29 -4
  106. data/spec/integration/urn_date_dim_spec.rb +53 -0
  107. data/spec/integration/user_filters_spec.rb +6 -0
  108. data/spec/integration/variables_spec.rb +1 -2
  109. data/spec/spec_helper.rb +5 -30
  110. data/spec/unit/actions/collect_clients_spec.rb +38 -0
  111. data/spec/unit/actions/collect_meta_spec.rb +87 -0
  112. data/spec/unit/actions/collect_segment_clients_spec.rb +40 -0
  113. data/spec/unit/actions/collect_tagged_objects_spec.rb +110 -0
  114. data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +51 -0
  115. data/spec/unit/bricks/middleware/aws_middelware_spec.rb +55 -1
  116. data/spec/unit/bricks/middleware/logger_middleware_spec.rb +15 -0
  117. data/spec/unit/helpers/data_helper_spec.rb +3 -5
  118. data/spec/unit/helpers/global_helpers_spec.rb +29 -0
  119. data/spec/unit/helpers_spec.rb +18 -1
  120. data/spec/unit/models/blueprint/project_blueprint_spec.rb +1 -23
  121. data/spec/unit/models/domain_spec.rb +19 -0
  122. data/spec/unit/models/metadata_spec.rb +34 -0
  123. data/spec/unit/models/schedule_spec.rb +31 -0
  124. data/spec/unit/models/to_manifest_spec.rb +10 -2
  125. data/spec/unit/models/unit_project_spec.rb +6 -1
  126. data/spec/unit/rest/polling_spec.rb +13 -1
  127. 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
- find_result = res_clients.find { |c| c['client']['id'] == id }
310
- fail "Client with id #{id} was not found" unless find_result
311
- client.create(GoodData::Client, find_result)
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. It takes the object. Scans its JSON
33
- # representation and returns a new one with object references changed according to mapping. The references an be found either in the object structure or in the MAQL in bracketed form. This implementation takes care only of those in bracketed form.
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. It takes the object. Scans its JSON
43
- # representation and returns a new one with object references changed according to mapping. The references an be found either in the object structure or in the MAQL in bracketed form. This implementation takes care only of those in object structure where they are as a string in JSON.
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
- if meta['deprecated'] == '1'
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 to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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 compute the attribute on a different dataset you can specify that in params. The metric created is not saved.
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 express different dataset for performing the computation on. It basically serves for creating metrics like SELECT COUNT(User, Opportunity).
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
- fail "Suggested aggreagtion function (#{a_type}) does not exist for base metric created out of attribute. You can use only one of #{ATTRIBUTE_BASE_AGGREGATIONS.map { |x| ':' + x.to_s }.join(',')}" unless ATTRIBUTE_BASE_AGGREGATIONS.include?(a_type)
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 decide to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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(req_uri, 'clientExport' => { 'url' => "#{client.connection.server_url}/dashboard.html#project=#{project.uri}&dashboard=#{uri}&tab=#{tab}&export=1", 'name' => title })
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. Can be used to replace any values but it is typically used to replace the URIs. Returns a new object of the same type.
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 to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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
- attributes.all?(&:date_attribute?) && fact_uris.empty?
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 decide to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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 to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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
- fail "Suggested aggreagtion function (#{a_type}) does not exist for base metric created out of fact. You can use only one of #{FACT_BASE_AGGREGATIONS.map { |x| ':' + x.to_s }.join(',')}" unless FACT_BASE_AGGREGATIONS.include?(a_type)
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 to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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 to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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. The difference between this and used_by using is in the fact that this is not a transitive closure. it searches only inside the expression
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. Can be used to replace any values but it is typically used to replace the URIs. Returns a new object of the same type.
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 to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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. Can be used to replace any values but it is typically used to replace the URIs. Returns a new object of the same type.
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 to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
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 the api. It can currently recognize 2 types of filters. Variable filters and attribute filters. Method for internal usage
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. Can be used to replace any values but it is typically used to replace the URIs. Returns a new object of the same type.
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