Class: BigcommerceAPI::Shippingaddress

Inherits:
Resource show all
Defined in:
lib/bigcommerce_api/shippingaddress.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, has_many, has_one, http_request, #initialize, #mark_dirty!, #reload, #resource, resource

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

#base_costObject

Returns the value of attribute base_cost.



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

def base_cost
  @base_cost
end

#base_handling_costObject

Returns the value of attribute base_handling_cost.



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

def base_handling_cost
  @base_handling_cost
end

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#cost_ex_taxObject

Returns the value of attribute cost_ex_tax.



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

def cost_ex_tax
  @cost_ex_tax
end

#cost_inc_taxObject

Returns the value of attribute cost_inc_tax.



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

def cost_inc_tax
  @cost_inc_tax
end

#cost_taxObject

Returns the value of attribute cost_tax.



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

def cost_tax
  @cost_tax
end

#cost_tax_class_idObject

Returns the value of attribute cost_tax_class_id.



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

def cost_tax_class_id
  @cost_tax_class_id
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

#country_iso2Object

Returns the value of attribute country_iso2.



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

def country_iso2
  @country_iso2
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#handling_cost_ex_taxObject

Returns the value of attribute handling_cost_ex_tax.



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

def handling_cost_ex_tax
  @handling_cost_ex_tax
end

#handling_cost_inc_taxObject

Returns the value of attribute handling_cost_inc_tax.



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

def handling_cost_inc_tax
  @handling_cost_inc_tax
end

#handling_cost_taxObject

Returns the value of attribute handling_cost_tax.



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

def handling_cost_tax
  @handling_cost_tax
end

#handling_cost_tax_class_idObject

Returns the value of attribute handling_cost_tax_class_id.



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

def handling_cost_tax_class_id
  @handling_cost_tax_class_id
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#items_shippedObject

Returns the value of attribute items_shipped.



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

def items_shipped
  @items_shipped
end

#items_totalObject

Returns the value of attribute items_total.



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

def items_total
  @items_total
end

#last_nameObject

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#order_idObject

Returns the value of attribute order_id.



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

def order_id
  @order_id
end

#phoneObject

Returns the value of attribute phone.



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

def phone
  @phone
end

#shipping_methodObject

Returns the value of attribute shipping_method.



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

def shipping_method
  @shipping_method
end

#shipping_zone_idObject

Returns the value of attribute shipping_zone_id.



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

def shipping_zone_id
  @shipping_zone_id
end

#shipping_zone_nameObject

Returns the value of attribute shipping_zone_name.



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

def shipping_zone_name
  @shipping_zone_name
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#street_1Object

Returns the value of attribute street_1.



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

def street_1
  @street_1
end

#street_2Object

Returns the value of attribute street_2.



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

def street_2
  @street_2
end

#zipObject

Returns the value of attribute zip.



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

def zip
  @zip
end

Class Method Details

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



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

def all(order_id, params={})
  resources = BigcommerceAPI::Base.get("/orders/#{order_id}/shippingaddresses", :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/shippingaddress.rb', line 38

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

Instance Method Details

#create(params = {}) ⇒ Object



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

def create(params={})
	self.errors = ["Shipping Addresses are readonly"]
	return false
end

#find_for_reloadObject



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

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

#parentObject



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

def parent
  'order'
end

#resource_urlObject

this overrides the default method, since this has to come in with an order id



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

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

#saveObject

TODO: these can probably go in a ReadOnly class



18
19
20
21
# File 'lib/bigcommerce_api/shippingaddress.rb', line 18

def save
	self.errors = ["Shipping Addresses are readonly"]
	return false
end