Class: BigcommerceAPI::OptionSetOption

Inherits:
Resource show all
Defined in:
lib/bigcommerce_api/option_set_option.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, #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

#display_nameObject

Returns the value of attribute display_name.



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

def display_name
  @display_name
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#is_requiredObject

Returns the value of attribute is_required.



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

def is_required
  @is_required
end

#option_idObject

Returns the value of attribute option_id.



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

def option_id
  @option_id
end

#option_resourceObject

Returns the value of attribute option_resource.



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

def option_resource
  @option_resource
end

#option_set_idObject

Returns the value of attribute option_set_id.



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

def option_set_id
  @option_set_id
end

#sort_orderObject

Returns the value of attribute sort_order.



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

def sort_order
  @sort_order
end

Class Method Details

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



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

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

.find(option_set_id, id) ⇒ Object



32
33
34
35
# File 'lib/bigcommerce_api/option_set_option.rb', line 32

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

Instance Method Details

#find_for_reloadObject



22
23
24
# File 'lib/bigcommerce_api/option_set_option.rb', line 22

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

#parentObject



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

def parent
  'option_set'
end

#resource_urlObject



14
15
16
# File 'lib/bigcommerce_api/option_set_option.rb', line 14

def resource_url
  "option_sets/#{self.option_set_id}/options"
end