Class: Io::Flow::V0::Models::FreeShippingOrderPromotion
- Inherits:
-
OrderPromotion
- Object
- OrderPromotion
- Io::Flow::V0::Models::FreeShippingOrderPromotion
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Attributes inherited from OrderPromotion
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ FreeShippingOrderPromotion
constructor
A new instance of FreeShippingOrderPromotion.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from OrderPromotion
Constructor Details
#initialize(incoming = {}) ⇒ FreeShippingOrderPromotion
Returns a new instance of FreeShippingOrderPromotion.
19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19215 def initialize(incoming={}) super(:discriminator => OrderPromotion::Types::FREE_SHIPPING_ORDER_PROMOTION) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :order, :key, :trigger, :attributes], 'FreeShippingOrderPromotion') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::ExpandableOrder) ? x : ::Io::Flow::V0::Models::ExpandableOrder.from_json(x)) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @trigger = (x = opts.delete(:trigger); x.is_a?(::Io::Flow::V0::Models::OrderPromotionTrigger) ? x : ::Io::Flow::V0::Models::OrderPromotionTrigger.new(x)) @max = (x = opts.delete(:max); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))) @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
19213 19214 19215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19213 def attributes @attributes end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
19213 19214 19215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19213 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
19213 19214 19215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19213 def key @key end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
19213 19214 19215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19213 def max @max end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
19213 19214 19215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19213 def order @order end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
19213 19214 19215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19213 def trigger @trigger end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
19231 19232 19233 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19231 def copy(incoming={}) FreeShippingOrderPromotion.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19235 def subtype_to_hash { :id => id, :order => order.to_hash, :key => key, :trigger => trigger.to_hash, :max => max.nil? ? nil : max.to_hash, :attributes => attributes } end |
#to_json ⇒ Object
19227 19228 19229 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19227 def to_json JSON.dump(to_hash) end |