Class: BigcommerceAPI::Address
- Defined in:
- lib/bigcommerce_api/address.rb
Instance Attribute Summary collapse
-
#address_type ⇒ Object
Returns the value of attribute address_type.
-
#city ⇒ Object
Returns the value of attribute city.
-
#company ⇒ Object
Returns the value of attribute company.
-
#country ⇒ Object
Returns the value of attribute country.
-
#country_iso2 ⇒ Object
Returns the value of attribute country_iso2.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#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
-
#find_for_reload ⇒ Object
we override this on resources that need paired IDs for find.
- #parent ⇒ Object
- #resource_url ⇒ Object
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
#address_type ⇒ Object
Returns the value of attribute address_type.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def address_type @address_type end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def city @city end |
#company ⇒ Object
Returns the value of attribute company.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def company @company end |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/bigcommerce_api/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/address.rb', line 3 def country_iso2 @country_iso2 end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def customer_id @customer_id end |
#first_name ⇒ Object
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def id @id end |
#last_name ⇒ Object
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def last_name @last_name end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/bigcommerce_api/address.rb', line 3 def phone @phone end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/bigcommerce_api/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/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/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/address.rb', line 3 def zip @zip end |
Class Method Details
.all(customer_id, params = {}) ⇒ Object
34 35 36 37 |
# File 'lib/bigcommerce_api/address.rb', line 34 def all(customer_id, params={}) resources = BigcommerceAPI::Base.get("/customers/#{customer_id}/addresses", query: date_adjust(params)) (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : [] end |
.find(customer_id, id) ⇒ Object
39 40 41 42 |
# File 'lib/bigcommerce_api/address.rb', line 39 def find(customer_id, id) r = BigcommerceAPI::Base.get("/customers/#{customer_id}/addresses/#{id}") (r.success? and !r.nil?) ? self.new(r) : nil end |
Instance Method Details
#find_for_reload ⇒ Object
we override this on resources that need paired IDs for find
29 30 31 |
# File 'lib/bigcommerce_api/address.rb', line 29 def find_for_reload self.class.find(self.customer_id, self.id) end |
#parent ⇒ Object
24 25 26 |
# File 'lib/bigcommerce_api/address.rb', line 24 def parent 'customer' end |
#resource_url ⇒ Object
20 21 22 |
# File 'lib/bigcommerce_api/address.rb', line 20 def resource_url "customers/#{self.customer_id}/addresses" end |