Class: Io::Flow::V0::Models::EmailAbandonedOrderPromotion

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ EmailAbandonedOrderPromotion

Returns a new instance of EmailAbandonedOrderPromotion.



40720
40721
40722
40723
40724
40725
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40720

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:discount_form, :attributes], 'EmailAbandonedOrderPromotion')
  @discount_form = (x = opts.delete(:discount_form); x.is_a?(::Io::Flow::V0::Models::DiscountForm) ? x : ::Io::Flow::V0::Models::DiscountForm.new(x))
  @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



40718
40719
40720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40718

def attributes
  @attributes
end

#discount_formObject (readonly)

Returns the value of attribute discount_form.



40718
40719
40720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40718

def discount_form
  @discount_form
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40731
40732
40733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40731

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

#to_hashObject



40735
40736
40737
40738
40739
40740
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40735

def to_hash
  {
    :discount_form => discount_form.to_hash,
    :attributes => attributes
  }
end

#to_jsonObject



40727
40728
40729
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40727

def to_json
  JSON.dump(to_hash)
end