class Io::Flow::V0::Models::FreeShippingOrderPromotionForm

Attributes

attributes[R]
max[R]
trigger[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 43564
def initialize(incoming={})
  super(:discriminator => OrderPromotionForm::Types::FREE_SHIPPING_ORDER_PROMOTION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:trigger], 'FreeShippingOrderPromotionForm')
  @trigger = (x = opts.delete(:trigger); x.is_a?(::Io::Flow::V0::Models::PromotionTriggerForm) ? x : ::Io::Flow::V0::Models::PromotionTriggerForm.new(x))
  @max = (x = opts.delete(:max); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceForm) ? x : ::Io::Flow::V0::Models::PriceForm.new(x)))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 43577
def copy(incoming={})
  FreeShippingOrderPromotionForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 43581
def subtype_to_hash
  {
    :trigger => trigger.to_hash,
    :max => max.nil? ? nil : max.to_hash,
    :attributes => attributes.nil? ? nil : attributes
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 43573
def to_json
  JSON.dump(to_hash)
end