Class: Gemgento::Order

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/gemgento/order.rb

Overview

Author:

  • Gemgento LLC

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#push_cart_customerObject

Returns the value of attribute push_cart_customer.



21
22
23
# File 'app/models/gemgento/order.rb', line 21

def push_cart_customer
  @push_cart_customer
end

#subscribeObject

Returns the value of attribute subscribe.



21
22
23
# File 'app/models/gemgento/order.rb', line 21

def subscribe
  @subscribe
end

#taxObject

Returns the value of attribute tax.



21
22
23
# File 'app/models/gemgento/order.rb', line 21

def tax
  @tax
end

#totalObject

Returns the value of attribute total.



21
22
23
# File 'app/models/gemgento/order.rb', line 21

def total
  @total
end

Class Method Details

.find_or_fetch(increment_id) ⇒ Gemgento::Order

Find or fetch an order by increment_id.

Parameters:

  • increment_id (String)

Returns:



47
48
49
# File 'app/models/gemgento/order.rb', line 47

def self.find_or_fetch(increment_id)
  Gemgento::Order.find_by(increment_id: increment_id) || Gemgento::Magento::OrderAdapter.find(increment_id).import
end

Instance Method Details

#mark_quote_convertedVoid

Set associated quote converted_at.

Returns:

  • (Void)


39
40
41
# File 'app/models/gemgento/order.rb', line 39

def mark_quote_converted
  quote.update(converted_at: Time.now)
end

#placed_atObject



51
52
53
# File 'app/models/gemgento/order.rb', line 51

def placed_at
  super || self.created_at
end

#to_paramString

Return the increment_id instead of id. This is for privacy purposes.

Returns:

  • (String)


32
33
34
# File 'app/models/gemgento/order.rb', line 32

def to_param
  self.increment_id
end