Class: Gemgento::Shipment

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

Overview

Author:

  • Gemgento LLC

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentObject

Returns the value of attribute comment.



11
12
13
# File 'app/models/gemgento/shipment.rb', line 11

def comment
  @comment
end

#emailObject

Returns the value of attribute email.



11
12
13
# File 'app/models/gemgento/shipment.rb', line 11

def email
  @email
end

#include_commentObject

Returns the value of attribute include_comment.



11
12
13
# File 'app/models/gemgento/shipment.rb', line 11

def include_comment
  @include_comment
end

Instance Method Details

#as_json(options = nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'app/models/gemgento/shipment.rb', line 17

def as_json(options = nil)
  result = super
  result['items'] = self.shipment_items
  result['comments'] = self.shipment_comments
  result['tracks'] = self.shipment_tracks

  return result
end

#push_to_magentoObject



26
27
28
29
30
31
32
33
34
35
# File 'app/models/gemgento/shipment.rb', line 26

def push_to_magento
  increment_id = API::SOAP::Sales::OrderShipment.create(self)

  if increment_id == false
    return false
  else
    self.increment_id = increment_id
    self.save
  end
end

#send_emailObject



13
14
15
# File 'app/models/gemgento/shipment.rb', line 13

def send_email
  API::SOAP::Sales::OrderShipment.send_info(self.increment_id)
end