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.
19186 19187 19188 19189 19190 19191 19192 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19186 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.
19184 19185 19186 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19184 def max @max end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
19184 19185 19186 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19184 def trigger @trigger end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
19198 19199 19200 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19198 def copy(incoming={}) FreeShipping.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
19202 19203 19204 19205 19206 19207 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19202 def subtype_to_hash { :trigger => trigger.to_hash, :max => max.nil? ? nil : max.to_hash } end |
#to_json ⇒ Object
19194 19195 19196 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19194 def to_json JSON.dump(to_hash) end |