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

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

Methods inherited from Base

#attributes, clean!, date_adjust, #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.



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

def billing_address
  @billing_address
end

#commentsObject

Returns the value of attribute comments.



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

def comments
  @comments
end

#customer_idObject

Returns the value of attribute customer_id.



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

def customer_id
  @customer_id
end

#date_createdObject

Returns the value of attribute date_created.



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

def date_created
  @date_created
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#itemsObject

Returns the value of attribute items.



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

def items
  @items
end

#order_address_idObject

Returns the value of attribute order_address_id.



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

def order_address_id
  @order_address_id
end

#order_idObject

Returns the value of attribute order_id.



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

def order_id
  @order_id
end

#shipping_addressObject

Returns the value of attribute shipping_address.



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

def shipping_address
  @shipping_address
end

#shipping_methodObject

Returns the value of attribute shipping_method.



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

def shipping_method
  @shipping_method
end

#tracking_numberObject

Returns the value of attribute tracking_number.



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

def tracking_number
  @tracking_number
end

Class Method Details

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



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

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



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

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



17
18
19
# File 'lib/bigcommerce_api/shipment.rb', line 17

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

#parentObject



13
14
15
# File 'lib/bigcommerce_api/shipment.rb', line 13

def parent
  'order'
end

#resource_urlObject

these are all overrides, since Shipments work a little differently



9
10
11
# File 'lib/bigcommerce_api/shipment.rb', line 9

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