Class: Io::Flow::V0::Models::OriginalPrices

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Model representing original and max values and currencies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OriginalPrices

Returns a new instance of OriginalPrices.



22970
22971
22972
22973
22974
22975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22970

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:value, :max], 'OriginalPrices')
  @value = (x = opts.delete(:value); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @max = (x = opts.delete(:max); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
end

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



22968
22969
22970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22968

def max
  @max
end

#valueObject (readonly)

Returns the value of attribute value.



22968
22969
22970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22968

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22981
22982
22983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22981

def copy(incoming={})
  OriginalPrices.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



22985
22986
22987
22988
22989
22990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22985

def to_hash
  {
    :value => value.to_hash,
    :max => max.to_hash
  }
end

#to_jsonObject



22977
22978
22979
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22977

def to_json
  JSON.dump(to_hash)
end