Class: Io::Flow::V0::Models::AvailablePromotion
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AvailablePromotion
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#promotions ⇒ Object
readonly
Returns the value of attribute promotions.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#shipping_configuration ⇒ Object
readonly
Returns the value of attribute shipping_configuration.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AvailablePromotion
constructor
A new instance of AvailablePromotion.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AvailablePromotion
Returns a new instance of AvailablePromotion.
27673 27674 27675 27676 27677 27678 27679 27680 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27673 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :shipping_configuration, :region, :promotions], 'AvailablePromotion') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @shipping_configuration = (x = opts.delete(:shipping_configuration); x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationReference) ? x : ::Io::Flow::V0::Models::ShippingConfigurationReference.new(x)) @region = (x = opts.delete(:region); x.is_a?(::Io::Flow::V0::Models::RegionReference) ? x : ::Io::Flow::V0::Models::RegionReference.new(x)) @promotions = HttpClient::Preconditions.assert_class('promotions', opts.delete(:promotions), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Promotion) ? x : ::Io::Flow::V0::Models::Promotion.from_json(x)) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
27671 27672 27673 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27671 def id @id end |
#promotions ⇒ Object (readonly)
Returns the value of attribute promotions.
27671 27672 27673 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27671 def promotions @promotions end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
27671 27672 27673 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27671 def region @region end |
#shipping_configuration ⇒ Object (readonly)
Returns the value of attribute shipping_configuration.
27671 27672 27673 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27671 def shipping_configuration @shipping_configuration end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
27686 27687 27688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27686 def copy(incoming={}) AvailablePromotion.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
27690 27691 27692 27693 27694 27695 27696 27697 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27690 def to_hash { :id => id, :shipping_configuration => shipping_configuration.to_hash, :region => region.to_hash, :promotions => promotions.map { |o| o.to_hash } } end |
#to_json ⇒ Object
27682 27683 27684 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27682 def to_json JSON.dump(to_hash) end |