Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A friendly Ruby interface to the Etsy API
Ruby
Tag: 0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
README.rdoc
Rakefile
etsy.gemspec

README.rdoc

Etsy

Description

The Etsy gem provides a friendly Ruby interface to the Etsy API

Installation

Installing the latest stable version is simple:

sudo gem install etsy

If you want to be on the bleeding edge, install from GitHub:

sudo gem install reagent-etsy --source=http://gems.github.com

Usage

The Etsy API is read-only - all you need to gain access is an API Key (available from developer.etsy.com). Once you have your API key, set it in your script:

require 'rubygems'
require 'etsy'
Etsy.api_key = 'foobar'

From there, you can make any calls to the API that you need.

Users

If you're starting with a user, the easiest way is to use the Etsy.user method:

>> user = Etsy.user('littletjane')
=> #<Etsy::User:0x107f82c @result=[{"city"=>"Washington, DC", ... > 
>> user.username
=> "littletjane"
>> user.id
=> 5327518
>> user.url
=> "http://www.etsy.com/shop.php?user_id=5327518"

For more information about what is available for a user, check out the documentation for Etsy::User.

Shops

Each user may optionally have a shop. If a user is a seller, he / she also has an associated shop object:

>> user.seller?
=> true
>> shop = user.shop
=> #<Etsy::Shop:0x102578c @result={"is_vacation"=>"", "announcement"=> ... >
>> shop.name
=> "littletjane"
>> shop.title
=> "a cute and crafty mix of handmade goods."

More information about shops can be found in the documentation for Etsy::Shop.

Listings

Shops contain multiple listings:

>> shop.listings
=> [#<Etsy::Listing:0x119acac @result={} ...>, ... ]
>> listing = shop.listings.first
=> #<Etsy::Listing:0x19a981c @result={} ... >
>> listing.title
=> "hanging with the bad boys matchbox"
>> listing.description
=> "standard size matchbox, approx. 1.5 x 2 inches ..."
>> listing.url
=> "http://www.etsy.com/view_listing.php?listing_id=24165902"
>> listing.view_count
=> 19
>> listing.created_at
=> Sat Apr 25 11:31:34 -0400 2009

See the documentation for Etsy::Listing for more information.

Images

Each listing has one or more images available:

>> listing.images
=> [#<Etsy::Image:0x18f85e4 @result={} ... >,
    #<Etsy::Image:0x18f85d0 @result={} ... >]
>> listing.images.first.small_square
=> "http://ny-image2.etsy.com/il_25x25.67765346.jpg"
>> listing.images.first.large
=> "http://ny-image2.etsy.com/il_430xN.67765346.jpg"

Listings also have a primary image:

>> listing.image
=> #<Etsy::Image:0x18c3060 @result={} ... >
>> listing.image.large
=> "http://ny-image2.etsy.com/il_430xN.67765346.jpg"

More information is available in the documentation for Etsy::Image.

License

Copyright © 2009 Patrick Reagan (reaganpr@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.