Class: BigcommerceAPI::ShippingAddress

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

#base_costObject

Returns the value of attribute base_cost.



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

def base_cost
  @base_cost
end

#base_handling_costObject

Returns the value of attribute base_handling_cost.



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

def base_handling_cost
  @base_handling_cost
end

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#cost_ex_taxObject

Returns the value of attribute cost_ex_tax.



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

def cost_ex_tax
  @cost_ex_tax
end

#cost_inc_taxObject

Returns the value of attribute cost_inc_tax.



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

def cost_inc_tax
  @cost_inc_tax
end

#cost_taxObject

Returns the value of attribute cost_tax.



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

def cost_tax
  @cost_tax
end

#cost_tax_class_idObject

Returns the value of attribute cost_tax_class_id.



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

def cost_tax_class_id
  @cost_tax_class_id
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

#country_iso2Object

Returns the value of attribute country_iso2.



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

def country_iso2
  @country_iso2
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#handling_cost_ex_taxObject

Returns the value of attribute handling_cost_ex_tax.



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

def handling_cost_ex_tax
  @handling_cost_ex_tax
end

#handling_cost_inc_taxObject

Returns the value of attribute handling_cost_inc_tax.



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

def handling_cost_inc_tax
  @handling_cost_inc_tax
end

#handling_cost_taxObject

Returns the value of attribute handling_cost_tax.



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

def handling_cost_tax
  @handling_cost_tax
end

#handling_cost_tax_class_idObject

Returns the value of attribute handling_cost_tax_class_id.



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

def handling_cost_tax_class_id
  @handling_cost_tax_class_id
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#items_shippedObject

Returns the value of attribute items_shipped.



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

def items_shipped
  @items_shipped
end

#items_totalObject

Returns the value of attribute items_total.



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

def items_total
  @items_total
end

#last_nameObject

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#order_idObject

Returns the value of attribute order_id.



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

def order_id
  @order_id
end

#phoneObject

Returns the value of attribute phone.



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

def phone
  @phone
end

#shipping_methodObject

Returns the value of attribute shipping_method.



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

def shipping_method
  @shipping_method
end

#shipping_zone_idObject

Returns the value of attribute shipping_zone_id.



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

def shipping_zone_id
  @shipping_zone_id
end

#shipping_zone_nameObject

Returns the value of attribute shipping_zone_name.



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

def shipping_zone_name
  @shipping_zone_name
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#street_1Object

Returns the value of attribute street_1.



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

def street_1
  @street_1
end

#street_2Object

Returns the value of attribute street_2.



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

def street_2
  @street_2
end

#zipObject

Returns the value of attribute zip.



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

def zip
  @zip
end

Class Method Details

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



62
63
64
65
66
# File 'lib/bigcommerce_api/shipping_address.rb', line 62

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

.find(order_id, id) ⇒ Object



68
69
70
71
72
# File 'lib/bigcommerce_api/shipping_address.rb', line 68

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

Instance Method Details

#create(params = {}) ⇒ Object



51
52
53
54
# File 'lib/bigcommerce_api/shipping_address.rb', line 51

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

#find_for_reloadObject



56
57
58
59
# File 'lib/bigcommerce_api/shipping_address.rb', line 56

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

#parentObject



41
42
43
# File 'lib/bigcommerce_api/shipping_address.rb', line 41

def parent
  'order'
end

#resource_urlObject

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



37
38
39
# File 'lib/bigcommerce_api/shipping_address.rb', line 37

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

#saveObject

TODO: these can probably go in a ReadOnly class



46
47
48
49
# File 'lib/bigcommerce_api/shipping_address.rb', line 46

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