Class: Io::Flow::V0::Models::Promotions
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Promotions
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#applied ⇒ Object
readonly
Returns the value of attribute applied.
-
#available ⇒ Object
readonly
Returns the value of attribute available.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Promotions
constructor
A new instance of Promotions.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Promotions
Returns a new instance of Promotions.
18552 18553 18554 18555 18556 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18552 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @applied = (x = opts.delete(:applied); x.nil? ? nil : HttpClient::Preconditions.assert_class('applied', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AppliedPromotion) ? x : ::Io::Flow::V0::Models::AppliedPromotion.new(x)) }) @available = (x = opts.delete(:available); x.nil? ? nil : HttpClient::Preconditions.assert_class('available', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AvailablePromotion) ? x : ::Io::Flow::V0::Models::AvailablePromotion.from_json(x)) }) end |
Instance Attribute Details
#applied ⇒ Object (readonly)
Returns the value of attribute applied.
18550 18551 18552 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18550 def applied @applied end |
#available ⇒ Object (readonly)
Returns the value of attribute available.
18550 18551 18552 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18550 def available @available end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
18562 18563 18564 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18562 def copy(incoming={}) Promotions.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
18566 18567 18568 18569 18570 18571 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18566 def to_hash { :applied => applied.nil? ? nil : applied.map { |o| o.to_hash }, :available => available.nil? ? nil : available.map { |o| o.to_hash } } end |
#to_json ⇒ Object
18558 18559 18560 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18558 def to_json JSON.dump(to_hash) end |