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
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#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.
18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18770 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| HttpClient::Preconditions.assert_class('spot_rates', HttpClient::Helper.to_object(v), Hash) } @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)) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', HttpClient::Helper.to_object(x), Hash)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
18768 18769 18770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18768 def attributes @attributes end |
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
18768 18769 18770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18768 def experience @experience end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
18768 18769 18770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18768 def prices @prices end |
#rates ⇒ Object (readonly)
Returns the value of attribute rates.
18768 18769 18770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18768 def rates @rates end |
#spot_rates ⇒ Object (readonly)
Returns the value of attribute spot_rates.
18768 18769 18770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18768 def spot_rates @spot_rates end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
18768 18769 18770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18768 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
18785 18786 18787 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18785 def copy(incoming={}) Local.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18789 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, :status => status.value, :attributes => attributes } end |
#to_json ⇒ Object
18781 18782 18783 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18781 def to_json JSON.dump(to_hash) end |