lib/gooddata/models/metadata/metric.rb in gooddata-0.6.10 vs lib/gooddata/models/metadata/metric.rb in gooddata-0.6.11

- old
+ new

@@ -8,10 +8,12 @@ module GoodData # Metric representation class Metric < MdObject attr_reader :json + include GoodData::Mixin::Lockable + alias_method :to_hash, :json include GoodData::Mixin::RestResource root_key :metric @@ -26,11 +28,11 @@ def all(options = { :client => GoodData.connection, :project => GoodData.project }) query('metrics', Metric, options) end def xcreate(metric, options = { :client => GoodData.connection, :project => GoodData.project }) - create(metric, options.merge(:extended_notation => true)) + create(metric, { extended_notation: true }.merge(options)) end def create(metric, options = { :client => GoodData.connection, :project => GoodData.project }) client = options[:client] fail ArgumentError, 'No :client specified' if client.nil? @@ -45,9 +47,10 @@ expression = metric || options[:expression] extended_notation = options[:extended_notation] || false title = options[:title] summary = options[:summary] else + metric ||= options title = metric[:title] || options[:title] summary = metric[:summary] || options[:summary] expression = metric[:expression] || options[:expression] || fail('Metric has to have its expression defined') extended_notation = metric[:extended_notation] || options[:extended_notation] || false end