reagent / etsy

A friendly Ruby interface to the Etsy API

This URL has Read+Write access

reagent (author)
Fri May 22 19:16:31 -0700 2009
commit  f618ef5244806bb155ea60c4da926cf476917488
tree    9803fc1eb6f91679522b82c83a154cfe25c98f30
parent  cbc593191d2d70aa3f0dc455aa5951e1ac60725e
etsy /
name age message
file .gitignore Wed Apr 15 20:36:57 -0700 2009 Initial implementation to retrieve a user by us... [reagent]
file README.rdoc Mon May 04 19:31:07 -0700 2009 Flesh out documentation for release [reagent]
file Rakefile Wed Apr 15 20:36:57 -0700 2009 Initial implementation to retrieve a user by us... [reagent]
file etsy.gemspec Loading commit data...
directory lib/
directory test/
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.