Class: BigcommerceAPI::Image
- Defined in:
- lib/bigcommerce_api/image.rb
Instance Attribute Summary collapse
-
#date_created ⇒ Object
Returns the value of attribute date_created.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_file ⇒ Object
Returns the value of attribute image_file.
-
#is_thumbnail ⇒ Object
Returns the value of attribute is_thumbnail.
-
#product_id ⇒ Object
Returns the value of attribute product_id.
-
#sort_order ⇒ Object
Returns the value of attribute sort_order.
-
#standard_url ⇒ Object
Returns the value of attribute standard_url.
-
#thumbnail_url ⇒ Object
Returns the value of attribute thumbnail_url.
-
#tiny_url ⇒ Object
Returns the value of attribute tiny_url.
-
#zoom_url ⇒ Object
Returns the value of attribute zoom_url.
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
#date_created ⇒ Object
Returns the value of attribute date_created.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def date_created @date_created end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def id @id end |
#image_file ⇒ Object
Returns the value of attribute image_file.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def image_file @image_file end |
#is_thumbnail ⇒ Object
Returns the value of attribute is_thumbnail.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def is_thumbnail @is_thumbnail end |
#product_id ⇒ Object
Returns the value of attribute product_id.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def product_id @product_id end |
#sort_order ⇒ Object
Returns the value of attribute sort_order.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def sort_order @sort_order end |
#standard_url ⇒ Object
Returns the value of attribute standard_url.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def standard_url @standard_url end |
#thumbnail_url ⇒ Object
Returns the value of attribute thumbnail_url.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def thumbnail_url @thumbnail_url end |
#tiny_url ⇒ Object
Returns the value of attribute tiny_url.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def tiny_url @tiny_url end |
#zoom_url ⇒ Object
Returns the value of attribute zoom_url.
3 4 5 |
# File 'lib/bigcommerce_api/image.rb', line 3 def zoom_url @zoom_url end |
Class Method Details
.all(product_id, params = {}) ⇒ Object
30 31 32 33 |
# File 'lib/bigcommerce_api/image.rb', line 30 def all(product_id, params={}) resources = BigcommerceAPI::Base.get("/products/#{product_id}/images", query: date_adjust(params)) (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : [] end |
.find(product_id, id) ⇒ Object
35 36 37 38 |
# File 'lib/bigcommerce_api/image.rb', line 35 def find(product_id, id) r = BigcommerceAPI::Base.get("/products/#{product_id}/images/#{id}") (r.success? and !r.nil?) ? self.new(r) : nil end |
Instance Method Details
#find_for_reload ⇒ Object
25 26 27 |
# File 'lib/bigcommerce_api/image.rb', line 25 def find_for_reload self.class.find(self.product_id, self.id) end |
#parent ⇒ Object
21 22 23 |
# File 'lib/bigcommerce_api/image.rb', line 21 def parent 'product' end |
#resource_url ⇒ Object
17 18 19 |
# File 'lib/bigcommerce_api/image.rb', line 17 def resource_url "products/#{self.product_id}/images" end |