class Etsy::Shop
Shop
¶ ↑
Represents a single Etsy
shop. Users may or may not have an associated shop.
A shop has the following attributes:
- name
-
The shop's name
- title
-
A brief heading for the shop's main page
- announcement
-
An announcement to buyers (displays on the shop's home page)
- message
-
The message sent to users who buy from this shop
- image_url
-
The full URL to the shops's banner image
- active_listings_count
-
The number of active listings present in this shop
- url
-
The full URL to the shop on
Etsy
- favorers_count
-
Number of favorers
Public Class Methods
Retrieve a list of all shops. By default it fetches 25 at a time, but that can be configured by passing the :limit and :offset parameters:
Etsy::Shop.all(:limit => 100, :offset => 100)
# File lib/etsy/shop.rb, line 52 def self.all(options = {}) self.get_all("/shops", options) end
Retrieve one or more shops by name or ID:
Etsy::Shop.find('reagent')
You can find multiple shops by passing an array of identifiers:
Etsy::Shop.find(['reagent', 'littletjane'])
# File lib/etsy/shop.rb, line 43 def self.find(*identifiers_and_options) self.find_one_or_more('shops', identifiers_and_options) end
Public Instance Methods
# File lib/etsy/shop.rb, line 79 def about About.find_by_shop(self) end
Time that this shop was created
# File lib/etsy/shop.rb, line 58 def created_at Time.at(created) end
The collection of listings associated with this shop
# File lib/etsy/shop.rb, line 70 def listings(state = nil, options = {}) state = state ? {:state => state} : {} Listing.find_all_by_shop_id(id, state.merge(options).merge(oauth)) end
# File lib/etsy/shop.rb, line 75 def sections Section.find_by_shop(self) end
Time that this shop was last updated
# File lib/etsy/shop.rb, line 64 def updated_at Time.at(updated) end
Private Instance Methods
# File lib/etsy/shop.rb, line 84 def oauth oauth = (token && secret) ? {:access_token => token, :access_secret => secret} : {} end