Class: Io::Flow::V0::Models::EmailNotificationAbandonedOrder

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

Overview

Data about an abandoned order. Today at Flow, this can be triggered by a consumer initating checkout (without completing)

Instance Attribute Summary collapse

Attributes inherited from EmailNotificationData

#discriminator

Instance Method Summary collapse

Methods inherited from EmailNotificationData

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ EmailNotificationAbandonedOrder

Returns a new instance of EmailNotificationAbandonedOrder.



29281
29282
29283
29284
29285
29286
29287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29281

def initialize(incoming={})
  super(:discriminator => EmailNotificationData::Types::EMAIL_NOTIFICATION_ABANDONED_ORDER)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order, :urls], 'EmailNotificationAbandonedOrder')
  @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::OrderSummary) ? x : ::Io::Flow::V0::Models::OrderSummary.new(x))
  @urls = (x = opts.delete(:urls); x.is_a?(::Io::Flow::V0::Models::EmailAbandonedOrderUrls) ? x : ::Io::Flow::V0::Models::EmailAbandonedOrderUrls.new(x))
end

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



29279
29280
29281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29279

def order
  @order
end

#urlsObject (readonly)

Returns the value of attribute urls.



29279
29280
29281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29279

def urls
  @urls
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29293
29294
29295
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29293

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

#subtype_to_hashObject



29297
29298
29299
29300
29301
29302
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29297

def subtype_to_hash
  {
    :order => order.to_hash,
    :urls => urls.to_hash
  }
end

#to_jsonObject



29289
29290
29291
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29289

def to_json
  JSON.dump(to_hash)
end