Class: BigcommerceAPI::Shipment

Inherits:
Resource show all
Defined in:
lib/bigcommerce_api/shipment.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#errors

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#assign_attributes, belongs_to, #changed, #create, #delete, has_many, has_one, http_request, #initialize, #mark_dirty!, #reload, #resource, resource, #save, #update_attributes

Methods inherited from Base

#attributes, clean!, date_adjust, default_options, #initialize, #store, #time, to_rfc2822

Constructor Details

This class inherits a constructor from BigcommerceAPI::Resource

Instance Attribute Details

#billing_addressObject

Returns the value of attribute billing_address.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def billing_address
  @billing_address
end

#commentsObject

Returns the value of attribute comments.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def comments
  @comments
end

#customer_idObject

Returns the value of attribute customer_id.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def customer_id
  @customer_id
end

#date_createdObject

Returns the value of attribute date_created.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def date_created
  @date_created
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def id
  @id
end

#itemsObject

Returns the value of attribute items.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def items
  @items
end

#order_address_idObject

Returns the value of attribute order_address_id.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def order_address_id
  @order_address_id
end

#order_idObject

Returns the value of attribute order_id.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def order_id
  @order_id
end

#shipping_addressObject

Returns the value of attribute shipping_address.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def shipping_address
  @shipping_address
end

#shipping_methodObject

Returns the value of attribute shipping_method.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def shipping_method
  @shipping_method
end

#tracking_numberObject

Returns the value of attribute tracking_number.



3
4
5
# File 'lib/bigcommerce_api/shipment.rb', line 3

def tracking_number
  @tracking_number
end

Class Method Details

.all(order_id, params = {}) ⇒ Object



33
34
35
36
# File 'lib/bigcommerce_api/shipment.rb', line 33

def all(order_id, params={})
  resources = BigcommerceAPI::Base.get("/orders/#{order_id}/shipments", query: date_adjust(params))
  (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : []
end

.find(order_id, id) ⇒ Object



38
39
40
41
# File 'lib/bigcommerce_api/shipment.rb', line 38

def find(order_id, id)
  r = BigcommerceAPI::Base.get("/orders/#{order_id}/shipments/#{id}")
  (r.success? and !r.nil?) ? self.new(r) : nil
end

Instance Method Details

#find_for_reloadObject



28
29
30
# File 'lib/bigcommerce_api/shipment.rb', line 28

def find_for_reload
  self.class.find(self.order_id, self.id)
end

#parentObject



24
25
26
# File 'lib/bigcommerce_api/shipment.rb', line 24

def parent
  'order'
end

#resource_urlObject

these are all overrides, since Shipments work a little differently



20
21
22
# File 'lib/bigcommerce_api/shipment.rb', line 20

def resource_url
  "orders/#{self.order_id}/shipments"
end