Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby client for the Gilt public API (dev.gilt.com)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile bump Rspec version September 18, 2012
Octocat-spinner-32 Gemfile.lock Bumping version to 0.2.0 September 18, 2012
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 gilt.gemspec
README.md
  .oooooo.     ooooo   ooooo     ooooooooooooo
 d8P'  `Y8b    `888'   `888'     8'   888   `8
888             888     888           888
888             888     888           888
888     ooooo   888     888           888
`88.    .88'    888     888     o     888
 `Y8bood8P'    o888o   o888ooood8    o888o

gilt is a Ruby library for v1 of the Gilt Public API.

It's written with the Weary framework, so it gets the features of that library out of the box, like:

  • Full Rack integration. The Client to the library is a Rack application.
  • Fully asynchronous. gilt makes liberal use of futures and Weary::Deferred.

Build Status Code Climate

Examples

active_sales = Gilt::Sale.active :apikey => "your-api-key"
womens_sales = sales.select {|sale| sale.store == Gilt::Stores::WOMEN }
sales.first.products.map(&:name)

Above, the call to sales.products returns a list of Weary::Deferred objects wrapping Gilt::Product objects. This means that fetching the product is asynchronous, and only blocks when accessed.

Get a list of active Sales:

Gilt::Sale.active :apikey => "your-api-key", :affid => "your-affiliate-id"

Get a list of active Sales in a particular store:

Gilt::Sale.active_in_store :apikey => "your-api-key", :affid => "your-affiliate-id", :store => Gilt::Stores::WOMEN

Or upcoming sales:

Gilt::Sale.upcoming :apikey => "your-api-key", :affid => "your-affiliate-id"

Get a particular sale:

Gilt::Sale.detail :apikey => "your-key", :store => Gilt::Stores::WOMEN, :sale_key => "m-missoni-5228"

Here's a fun one, for all active sales in the Women store, create a hash of Sale Name => [Product Name,...]:

require "pp"

active_sales = Gilt::Sale.active_in_store :apikey => "my-api-key", :store => Gilt::Stores::WOMEN
pp Hash[active_sales.map {|sale| [sale.name, sale.products.map(&:name)] }] # This could take a while

With Rack

Since Gilt is built on Weary (which in turn is built on Rack), you can quickly create a proxy to the Gilt API and insert whatever middleware your heart desires.

# config.ru
client = Gilt::Client::Product
client.use Rack::Runtime

run client

After rackup:

curl "http://localhost:9292/sales/active.json?apikey=my-api-key"

Installation

gem install gilt

Copyright

Copyright (c) 2012 Mark Wunsch. Licensed under the MIT License.

Something went wrong with that request. Please try again.