Class: BigcommerceAPI::Image

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

#date_createdObject

Returns the value of attribute date_created.



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

def date_created
  @date_created
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#image_fileObject

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_thumbnailObject

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_idObject

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_orderObject

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_urlObject

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_urlObject

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_urlObject

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_urlObject

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_reloadObject



25
26
27
# File 'lib/bigcommerce_api/image.rb', line 25

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

#parentObject



21
22
23
# File 'lib/bigcommerce_api/image.rb', line 21

def parent
  'product'
end

#resource_urlObject



17
18
19
# File 'lib/bigcommerce_api/image.rb', line 17

def resource_url
  "products/#{self.product_id}/images"
end