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.
45811 45812 45813 45814 45815 45816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45811 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:applied, :available], 'Promotions') @applied = HttpClient::Preconditions.assert_class('applied', opts.delete(:applied), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Promotion) ? x : ::Io::Flow::V0::Models::Promotion.from_json(x)) } @available = HttpClient::Preconditions.assert_class('available', opts.delete(:available), 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
#applied ⇒ Object (readonly)
Returns the value of attribute applied.
45809 45810 45811 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45809 def applied @applied end |
#available ⇒ Object (readonly)
Returns the value of attribute available.
45809 45810 45811 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45809 def available @available end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
45822 45823 45824 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45822 def copy(incoming={}) Promotions.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
45826 45827 45828 45829 45830 45831 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45826 def to_hash { :applied => applied.map { |o| o.to_hash }, :available => available.map { |o| o.to_hash } } end |
#to_json ⇒ Object
45818 45819 45820 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45818 def to_json JSON.dump(to_hash) end |