Class: BigcommerceAPI::OptionValue
- Defined in:
- lib/bigcommerce_api/option_value.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#label ⇒ Object
Returns the value of attribute label.
-
#option_id ⇒ Object
Returns the value of attribute option_id.
-
#sort_order ⇒ Object
Returns the value of attribute sort_order.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
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
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/bigcommerce_api/option_value.rb', line 3 def id @id end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/bigcommerce_api/option_value.rb', line 3 def label @label end |
#option_id ⇒ Object
Returns the value of attribute option_id.
3 4 5 |
# File 'lib/bigcommerce_api/option_value.rb', line 3 def option_id @option_id end |
#sort_order ⇒ Object
Returns the value of attribute sort_order.
3 4 5 |
# File 'lib/bigcommerce_api/option_value.rb', line 3 def sort_order @sort_order end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/bigcommerce_api/option_value.rb', line 3 def value @value end |
Class Method Details
.all(option_id, params = {}) ⇒ Object
24 25 26 27 |
# File 'lib/bigcommerce_api/option_value.rb', line 24 def all(option_id, params={}) resources = BigcommerceAPI::Base.get("/options/#{option_id}/values", query: date_adjust(params)) (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : [] end |
.find(option_id, id) ⇒ Object
29 30 31 32 |
# File 'lib/bigcommerce_api/option_value.rb', line 29 def find(option_id, id) r = BigcommerceAPI::Base.get("/options/#{option_id}/values/#{id}") (r.success? and !r.nil?) ? self.new(r) : nil end |
Instance Method Details
#find_for_reload ⇒ Object
19 20 21 |
# File 'lib/bigcommerce_api/option_value.rb', line 19 def find_for_reload self.class.find(self.option_id, self.id) end |
#parent ⇒ Object
15 16 17 |
# File 'lib/bigcommerce_api/option_value.rb', line 15 def parent 'option' end |
#resource_url ⇒ Object
11 12 13 |
# File 'lib/bigcommerce_api/option_value.rb', line 11 def resource_url "options/#{self.option_id}/values" end |