Class: Io::Flow::V0::Models::Local

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Local

Returns a new instance of Local.



10806
10807
10808
10809
10810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10806

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:prices], 'Local')
  @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LocalizedPrice) ? x : ::Io::Flow::V0::Models::LocalizedPrice.new(x)) }
end

Instance Attribute Details

#pricesObject (readonly)

Returns the value of attribute prices.



10804
10805
10806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10804

def prices
  @prices
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



10816
10817
10818
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10816

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

#to_hashObject



10820
10821
10822
10823
10824
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10820

def to_hash
  {
    :prices => prices.map { |o| o.to_hash }
  }
end

#to_jsonObject



10812
10813
10814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10812

def to_json
  JSON.dump(to_hash)
end