Class: Io::Flow::V0::Models::FreeShipping

Inherits:
Promotion
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from Promotion

#discriminator

Instance Method Summary collapse

Methods inherited from Promotion

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ FreeShipping

Returns a new instance of FreeShipping.



16126
16127
16128
16129
16130
16131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16126

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

#triggerObject (readonly)

Returns the value of attribute trigger.



16124
16125
16126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16124

def trigger
  @trigger
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16137
16138
16139
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16137

def copy(incoming={})
  FreeShipping.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



16141
16142
16143
16144
16145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16141

def subtype_to_hash
  {
    :trigger => trigger.to_hash
  }
end

#to_jsonObject



16133
16134
16135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16133

def to_json
  JSON.dump(to_hash)
end