Class: Io::Flow::V0::Models::FreeShipping
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#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.
14691 14692 14693 14694 14695 14696 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14691 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)) end |
Instance Attribute Details
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
14689 14690 14691 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14689 def trigger @trigger end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14702 14703 14704 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14702 def copy(incoming={}) FreeShipping.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
14706 14707 14708 14709 14710 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14706 def subtype_to_hash { :trigger => trigger.to_hash } end |
#to_json ⇒ Object
14698 14699 14700 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14698 def to_json JSON.dump(to_hash) end |