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.



43518
43519
43520
43521
43522
43523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43518

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.



43516
43517
43518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43516

def max
  @max
end

#valueObject (readonly)

Returns the value of attribute value.



43516
43517
43518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43516

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



43529
43530
43531
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43529

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

#to_hashObject



43533
43534
43535
43536
43537
43538
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43533

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

#to_jsonObject



43525
43526
43527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43525

def to_json
  JSON.dump(to_hash)
end