Class: Io::Flow::V0::Models::FreeShipping
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Attributes inherited from Promotion
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ FreeShipping
constructor
A new instance of FreeShipping.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Promotion
Constructor Details
#initialize(incoming = {}) ⇒ FreeShipping
Returns a new instance of FreeShipping.
23491 23492 23493 23494 23495 23496 23497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23491 def initialize(incoming={}) super(:discriminator => Promotion::Types::FREE_SHIPPING) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:trigger], 'FreeShipping') @trigger = (x = opts.delete(:trigger); x.is_a?(::Io::Flow::V0::Models::PromotionTrigger) ? x : ::Io::Flow::V0::Models::PromotionTrigger.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))) end |
Instance Attribute Details
#max ⇒ Object (readonly)
Returns the value of attribute max.
23489 23490 23491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23489 def max @max end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
23489 23490 23491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23489 def trigger @trigger end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23503 23504 23505 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23503 def copy(incoming={}) FreeShipping.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
23507 23508 23509 23510 23511 23512 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23507 def subtype_to_hash { :trigger => trigger.to_hash, :max => max.nil? ? nil : max.to_hash } end |
#to_json ⇒ Object
23499 23500 23501 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23499 def to_json JSON.dump(to_hash) end |