Class: Etsy::Image
Overview
Image
Represents an image resource of an Etsy listing and contains multiple sizes. Sizes available are:
- square
-
The square image thumbnail (75x75 pixels)
- small
-
The small image thumbnail (170x135 pixels)
- thumbnail
-
The thumbnail for the image, no more than 570px wide
- full
-
The full image for this listing, no more than 1500px wide
Class Method Summary collapse
- .create(listing, image_path, options = {}) ⇒ Object
-
.destroy(listing, image, options = {}) ⇒ Object
Delete image.
-
.find_all_by_listing_id(listing_id, options = {}) ⇒ Object
Fetch all images for a given listing.
Methods included from Model
included, #initialize, #result, #secret, #token
Class Method Details
.create(listing, image_path, options = {}) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/etsy/image.rb', line 28 def self.create(listing, image_path, = {}) .merge!(:require_secure => true) [:image] = File.new(image_path) [:multipart] = true post("/listings/#{listing.id}/images", ) end |
.destroy(listing, image, options = {}) ⇒ Object
Delete image
37 38 39 40 |
# File 'lib/etsy/image.rb', line 37 def self.destroy(listing, image, = {}) .merge!(:require_secure => true) delete("/listings/#{listing.id}/images/#{image.id}", ) end |
.find_all_by_listing_id(listing_id, options = {}) ⇒ Object
Fetch all images for a given listing.
24 25 26 |
# File 'lib/etsy/image.rb', line 24 def self.find_all_by_listing_id(listing_id, = {}) get_all("/listings/#{listing_id}/images", ) end |