lib/gooddata/models/metadata/report_definition.rb in gooddata-0.6.19 vs lib/gooddata/models/metadata/report_definition.rb in gooddata-0.6.20

- old
+ new

@@ -15,11 +15,11 @@ # # @param options [Hash] the options hash # @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 # @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation def all(options = { :client => GoodData.connection, :project => GoodData.project }) - query('reportdefinition', ReportDefinition, options) + query('reportDefinition', ReportDefinition, options) end def create_metrics_part(left, top) stuff = Array(left) + Array(top) stuff.select { |item| item.respond_to?(:metric?) && item.metric? }.map do |metric| @@ -274,41 +274,41 @@ uri_what = what.respond_to?(:uri) ? what.uri : what uri_for_what = for_what.respond_to?(:uri) ? for_what.uri : for_what content['grid']['metrics'] = metric_parts.map do |item| - item.deep_dup.tap do |i| + GoodData::Helpers.deep_dup(item).tap do |i| i['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end end cols = content['grid']['columns'] || [] content['grid']['columns'] = cols.map do |item| if item.is_a?(Hash) - item.deep_dup.tap do |i| + GoodData::Helpers.deep_dup(item).tap do |i| i['attribute']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end else item end end rows = content['grid']['rows'] || [] content['grid']['rows'] = rows.map do |item| if item.is_a?(Hash) - item.deep_dup.tap do |i| + GoodData::Helpers.deep_dup(item).tap do |i| i['attribute']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end else item end end widths = content['grid']['columnWidths'] || [] content['grid']['columnWidths'] = widths.map do |item| if item.is_a?(Hash) - item.deep_dup.tap do |i| + GoodData::Helpers.deep_dup(item).tap do |i| if i['locator'][0].key?('attributeHeaderLocator') i['locator'][0]['attributeHeaderLocator']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end end else @@ -317,11 +317,11 @@ end sort = content['grid']['sort']['columns'] || [] content['grid']['sort']['columns'] = sort.map do |item| if item.is_a?(Hash) - item.deep_dup.tap do |i| + GoodData::Helpers.deep_dup(item).tap do |i| next unless i.key?('metricSort') next unless i['metricSort'].key?('locators') next unless i['metricSort']['locators'][0].key?('attributeLocator2') i['metricSort']['locators'][0]['attributeLocator2']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") i['metricSort']['locators'][0]['attributeLocator2']['element'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") @@ -334,10 +334,10 @@ if content.key?('chart') content['chart']['buckets'] = content['chart']['buckets'].reduce({}) do |a, e| key = e[0] val = e[1] a[key] = val.map do |item| - item.deep_dup.tap do |i| + GoodData::Helpers.deep_dup(item).tap do |i| i['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end end a end