Class: Io::Flow::V0::Models::Local
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Local
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#experience ⇒ Object
readonly
Returns the value of attribute experience.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
-
#rates ⇒ Object
readonly
Returns the value of attribute rates.
-
#spot_rates ⇒ Object
readonly
Returns the value of attribute spot_rates.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Local
constructor
A new instance of Local.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Local
Returns a new instance of Local.
13535 13536 13537 13538 13539 13540 13541 13542 13543 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13535 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:experience, :prices, :rates, :spot_rates], 'Local') @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceSummary) ? x : ::Io::Flow::V0::Models::ExperienceSummary.new(x)) @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.from_json(x)) } @rates = HttpClient::Preconditions.assert_class('rates', opts.delete(:rates), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Rate) ? x : ::Io::Flow::V0::Models::Rate.new(x)) } @spot_rates = HttpClient::Preconditions.assert_class('spot_rates', opts.delete(:spot_rates), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::SpotRate) ? x : ::Io::Flow::V0::Models::SpotRate.new(x)) } @status = (x = (x = opts.delete(:status); x.nil? ? "included" : x); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)) end |
Instance Attribute Details
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
13533 13534 13535 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13533 def experience @experience end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
13533 13534 13535 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13533 def prices @prices end |
#rates ⇒ Object (readonly)
Returns the value of attribute rates.
13533 13534 13535 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13533 def rates @rates end |
#spot_rates ⇒ Object (readonly)
Returns the value of attribute spot_rates.
13533 13534 13535 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13533 def spot_rates @spot_rates end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13533 13534 13535 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13533 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13549 13550 13551 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13549 def copy(incoming={}) Local.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
13553 13554 13555 13556 13557 13558 13559 13560 13561 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13553 def to_hash { :experience => experience.to_hash, :prices => prices.map { |o| o.to_hash }, :rates => rates.map { |o| o.to_hash }, :spot_rates => spot_rates.map { |o| o.to_hash }, :status => status.value } end |
#to_json ⇒ Object
13545 13546 13547 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13545 def to_json JSON.dump(to_hash) end |