Class: BigcommerceAPI::ShippingAddress
- Defined in:
- lib/bigcommerce_api/shipping_address.rb
Instance Attribute Summary collapse
-
#base_cost ⇒ Object
Returns the value of attribute base_cost.
-
#base_handling_cost ⇒ Object
Returns the value of attribute base_handling_cost.
-
#city ⇒ Object
Returns the value of attribute city.
-
#company ⇒ Object
Returns the value of attribute company.
-
#cost_ex_tax ⇒ Object
Returns the value of attribute cost_ex_tax.
-
#cost_inc_tax ⇒ Object
Returns the value of attribute cost_inc_tax.
-
#cost_tax ⇒ Object
Returns the value of attribute cost_tax.
-
#cost_tax_class_id ⇒ Object
Returns the value of attribute cost_tax_class_id.
-
#country ⇒ Object
Returns the value of attribute country.
-
#country_iso2 ⇒ Object
Returns the value of attribute country_iso2.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#handling_cost_ex_tax ⇒ Object
Returns the value of attribute handling_cost_ex_tax.
-
#handling_cost_inc_tax ⇒ Object
Returns the value of attribute handling_cost_inc_tax.
-
#handling_cost_tax ⇒ Object
Returns the value of attribute handling_cost_tax.
-
#handling_cost_tax_class_id ⇒ Object
Returns the value of attribute handling_cost_tax_class_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#items_shipped ⇒ Object
Returns the value of attribute items_shipped.
-
#items_total ⇒ Object
Returns the value of attribute items_total.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#shipping_method ⇒ Object
Returns the value of attribute shipping_method.
-
#shipping_zone_id ⇒ Object
Returns the value of attribute shipping_zone_id.
-
#shipping_zone_name ⇒ Object
Returns the value of attribute shipping_zone_name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street_1 ⇒ Object
Returns the value of attribute street_1.
-
#street_2 ⇒ Object
Returns the value of attribute street_2.
-
#zip ⇒ Object
Returns the value of attribute zip.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
- #create(params = {}) ⇒ Object
- #find_for_reload ⇒ Object
- #parent ⇒ Object
-
#resource_url ⇒ Object
this overrides the default method, since this has to come in with an order id.
-
#save ⇒ Object
TODO: these can probably go in a ReadOnly class.
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_cost ⇒ Object
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_cost ⇒ Object
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 |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 3 def city @city end |
#company ⇒ Object
Returns the value of attribute company.
3 4 5 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 3 def company @company end |
#cost_ex_tax ⇒ Object
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_tax ⇒ Object
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_tax ⇒ Object
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_id ⇒ Object
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 |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 3 def country @country end |
#country_iso2 ⇒ Object
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 |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 3 def email @email end |
#first_name ⇒ Object
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_tax ⇒ Object
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_tax ⇒ Object
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_tax ⇒ Object
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_id ⇒ Object
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 |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 3 def id @id end |
#items_shipped ⇒ Object
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_total ⇒ Object
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_name ⇒ Object
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_id ⇒ Object
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 |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 3 def phone @phone end |
#shipping_method ⇒ Object
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_id ⇒ Object
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_name ⇒ Object
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 |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 3 def state @state end |
#street_1 ⇒ Object
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_2 ⇒ Object
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 |
#zip ⇒ Object
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_reload ⇒ Object
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 |
#parent ⇒ Object
41 42 43 |
# File 'lib/bigcommerce_api/shipping_address.rb', line 41 def parent 'order' end |
#resource_url ⇒ Object
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 |
#save ⇒ Object
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 |