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.



37501
37502
37503
37504
37505
37506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37501

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.



37499
37500
37501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37499

def attributes
  @attributes
end

#discount_formObject (readonly)

Returns the value of attribute discount_form.



37499
37500
37501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37499

def discount_form
  @discount_form
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37512
37513
37514
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37512

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

#to_hashObject



37516
37517
37518
37519
37520
37521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37516

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

#to_jsonObject



37508
37509
37510
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37508

def to_json
  JSON.dump(to_hash)
end