gilt 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -2
- data/Gemfile.lock +20 -24
- data/LICENSE +20 -0
- data/README.md +47 -1
- data/Rakefile +1 -1
- data/gilt.gemspec +1 -1
- data/lib/gilt/client/products.rb +2 -0
- data/lib/gilt/product.rb +8 -0
- data/lib/gilt/sale.rb +2 -2
- data/lib/gilt/version.rb +1 -1
- data/spec/fixtures/categories.json +12 -0
- data/spec/fixtures/product.json +7 -7
- data/spec/gilt/client/products_spec.rb +7 -0
- data/spec/gilt/product_spec.rb +26 -10
- metadata +23 -10
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,54 +1,50 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gilt (0.
|
4
|
+
gilt (0.2.0)
|
5
5
|
money (~> 4.0.2)
|
6
|
-
weary (~> 1.
|
6
|
+
weary (~> 1.1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.2
|
12
|
-
bouncy-castle-java (1.5.0146.1)
|
11
|
+
addressable (2.3.2)
|
13
12
|
crack (0.3.1)
|
14
13
|
diff-lcs (1.1.3)
|
15
|
-
i18n (0.6.
|
16
|
-
|
17
|
-
bouncy-castle-java (>= 1.5.0146.1)
|
18
|
-
json (1.6.6)
|
14
|
+
i18n (0.6.1)
|
15
|
+
json (1.7.5)
|
19
16
|
money (4.0.2)
|
20
17
|
i18n (~> 0.4)
|
21
18
|
json
|
22
|
-
multi_json (1.
|
19
|
+
multi_json (1.3.6)
|
23
20
|
promise (0.3.0)
|
24
21
|
rack (1.4.1)
|
25
22
|
rake (0.9.2.2)
|
26
|
-
rspec (2.
|
27
|
-
rspec-core (~> 2.
|
28
|
-
rspec-expectations (~> 2.
|
29
|
-
rspec-mocks (~> 2.
|
30
|
-
rspec-core (2.
|
31
|
-
rspec-expectations (2.
|
23
|
+
rspec (2.11.0)
|
24
|
+
rspec-core (~> 2.11.0)
|
25
|
+
rspec-expectations (~> 2.11.0)
|
26
|
+
rspec-mocks (~> 2.11.0)
|
27
|
+
rspec-core (2.11.1)
|
28
|
+
rspec-expectations (2.11.3)
|
32
29
|
diff-lcs (~> 1.1.3)
|
33
|
-
rspec-mocks (2.
|
34
|
-
simple_oauth (0.1.
|
35
|
-
weary (1.
|
36
|
-
addressable (~> 2.2
|
37
|
-
multi_json (~> 1.
|
30
|
+
rspec-mocks (2.11.2)
|
31
|
+
simple_oauth (0.1.9)
|
32
|
+
weary (1.1.0)
|
33
|
+
addressable (~> 2.3.2)
|
34
|
+
multi_json (~> 1.3.0)
|
38
35
|
promise (~> 0.3.0)
|
39
36
|
rack (~> 1.4.0)
|
40
37
|
simple_oauth (~> 0.1.5)
|
41
|
-
webmock (1.8.
|
38
|
+
webmock (1.8.10)
|
42
39
|
addressable (>= 2.2.7)
|
43
40
|
crack (>= 0.1.7)
|
44
41
|
|
45
42
|
PLATFORMS
|
46
|
-
java
|
47
43
|
ruby
|
48
44
|
|
49
45
|
DEPENDENCIES
|
50
46
|
gilt!
|
51
47
|
jruby-openssl (~> 0.7.6)
|
52
48
|
rake (~> 0.9.2)
|
53
|
-
rspec (~> 2.
|
54
|
-
webmock (~> 1.8.
|
49
|
+
rspec (~> 2.11.0)
|
50
|
+
webmock (~> 1.8.10)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Mark Wunsch
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -14,18 +14,60 @@ It's written with the [Weary](https://github.com/mwunsch/weary) framework, so it
|
|
14
14
|
* Full Rack integration. The Client to the library is a Rack application.
|
15
15
|
* Fully asynchronous. `gilt` makes liberal use of futures and Weary::Deferred.
|
16
16
|
|
17
|
+
[](http://travis-ci.org/mwunsch/gilt) [](https://codeclimate.com/github/mwunsch/gilt)
|
18
|
+
|
19
|
+
* [Gilt on RubyGems.org](https://rubygems.org/gems/gilt)
|
20
|
+
* [Gilt on RubyDoc.info](http://rubydoc.info/github/mwunsch/gilt/)
|
21
|
+
* [Gilt on Travis CI](http://travis-ci.org/#!/mwunsch/gilt)
|
22
|
+
* [Gilt on Code Climate](https://codeclimate.com/github/mwunsch/gilt)
|
23
|
+
|
17
24
|
## Examples
|
18
25
|
|
19
26
|
```ruby
|
20
27
|
active_sales = Gilt::Sale.active :apikey => "your-api-key"
|
21
28
|
womens_sales = sales.select {|sale| sale.store == Gilt::Stores::WOMEN }
|
22
|
-
sales.products.map(&:name)
|
29
|
+
sales.first.products.map(&:name)
|
23
30
|
```
|
24
31
|
|
25
32
|
Above, the call to `sales.products` returns a list of [Weary::Deferred](https://github.com/mwunsch/weary/blob/master/lib/weary/deferred.rb) objects wrapping Gilt::Product objects. This means that fetching the product is asynchronous, and only blocks when accessed.
|
26
33
|
|
34
|
+
Get a list of active Sales:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Gilt::Sale.active :apikey => "your-api-key", :affid => "your-affiliate-id"
|
38
|
+
```
|
39
|
+
|
40
|
+
Get a list of active Sales in a particular store:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Gilt::Sale.active_in_store :apikey => "your-api-key", :affid => "your-affiliate-id", :store => Gilt::Stores::WOMEN
|
44
|
+
```
|
45
|
+
|
46
|
+
Or upcoming sales:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
Gilt::Sale.upcoming :apikey => "your-api-key", :affid => "your-affiliate-id"
|
50
|
+
```
|
51
|
+
|
52
|
+
Get a particular sale:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
Gilt::Sale.detail :apikey => "your-key", :store => Gilt::Stores::WOMEN, :sale_key => "m-missoni-5228"
|
56
|
+
```
|
57
|
+
|
58
|
+
Here's a fun one, for all active sales in the Women store, create a hash of `Sale Name => [Product Name,...]`:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
require "pp"
|
62
|
+
|
63
|
+
active_sales = Gilt::Sale.active_in_store :apikey => "my-api-key", :store => Gilt::Stores::WOMEN
|
64
|
+
pp Hash[active_sales.map {|sale| [sale.name, sale.products.map(&:name)] }] # This could take a while
|
65
|
+
```
|
66
|
+
|
27
67
|
### With Rack
|
28
68
|
|
69
|
+
Since Gilt is built on Weary (which in turn is built on [Rack](http://rack.github.com/)), you can quickly create a proxy to the Gilt API and insert whatever middleware your heart desires.
|
70
|
+
|
29
71
|
```ruby
|
30
72
|
# config.ru
|
31
73
|
client = Gilt::Client::Product
|
@@ -41,3 +83,7 @@ After `rackup`:
|
|
41
83
|
## Installation
|
42
84
|
|
43
85
|
gem install gilt
|
86
|
+
|
87
|
+
## Copyright
|
88
|
+
|
89
|
+
Copyright (c) 2012 Mark Wunsch. Licensed under the [MIT License](http://opensource.org/licenses/mit-license.php).
|
data/Rakefile
CHANGED
data/gilt.gemspec
CHANGED
data/lib/gilt/client/products.rb
CHANGED
data/lib/gilt/product.rb
CHANGED
@@ -21,6 +21,11 @@ module Gilt
|
|
21
21
|
self.new response.parse
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.categories(apikey, affid=nil)
|
25
|
+
response = client(apikey, affid).categories.perform
|
26
|
+
response.parse["categories"] || []
|
27
|
+
end
|
28
|
+
|
24
29
|
def initialize(product_body)
|
25
30
|
@product = product_body
|
26
31
|
end
|
@@ -45,6 +50,9 @@ module Gilt
|
|
45
50
|
URI(@product["url"])
|
46
51
|
end
|
47
52
|
|
53
|
+
def categories
|
54
|
+
@product["categories"] || []
|
55
|
+
end
|
48
56
|
def description
|
49
57
|
fetch_content :description
|
50
58
|
end
|
data/lib/gilt/sale.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'time'
|
2
2
|
|
3
3
|
module Gilt
|
4
|
+
# A Gilt Sale object, representing an active or upcoming "flash" sale.
|
4
5
|
class Sale
|
5
6
|
class << self
|
6
7
|
Gilt::Client::Sales.resources.keys.each do |key|
|
@@ -88,7 +89,6 @@ module Gilt
|
|
88
89
|
resource = Gilt::Client::Products.resources[:detail]
|
89
90
|
@products = (@sale["products"] || []).map do |product|
|
90
91
|
id = resource.url.extract(product)["product_id"]
|
91
|
-
@client.detail(:product_id => id).perform
|
92
92
|
Product.defer @client.detail(:product_id => id).perform
|
93
93
|
end
|
94
94
|
end
|
@@ -98,4 +98,4 @@ module Gilt
|
|
98
98
|
end
|
99
99
|
|
100
100
|
end
|
101
|
-
end
|
101
|
+
end
|
data/lib/gilt/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: Jetty(7.6.0.v20120127)
|
3
|
+
Cache-Control: no-transform, max-age=600
|
4
|
+
Content-Type: application/json; charset=UTF-8
|
5
|
+
response-time: 91.0
|
6
|
+
X-Gg-Rule-cdn: cdn_req_check_ssl_api
|
7
|
+
Last-Modified: Tue, 18 Sep 2012 15:33:49 GMT
|
8
|
+
X-Version: svc-syndication-0.3.5 (commons-1.2.1)
|
9
|
+
Age: 214
|
10
|
+
Content-Length: 2068
|
11
|
+
|
12
|
+
{"categories":["Pants","Shirts","Tabletop","Other Lighting","Jewelry & Watches","Puffers & Parkas","Clothing","Other Apparel","Floor Lamps","Coffee, Tea & Espresso","Sofas","Peacoats","Necklaces & Rings","Sweaters & Hoodies","Other Home","Sportcoats","Drinkware","Chairs & Ottomans","Area","Earrings","Rugs","Furniture & Decor","Dress Shirts","Women","Girls' Shoes & Socks","Kitchenware","Equipment","Sheets & Pillowcases","Card Holders","Sandals","Denim","Ties & Furnishings","Sleepwear","Men","Glasses & Barware","Crewnecks","Other Decor & Accessories","Slim Leg","Socks, Underwear & Sleepwear","Apparel Sets","Other Outerwear","Other Bags & Luggage","Other Tops","Other Accessories","Polos, Henleys & Tees","Bracelets & Bangles","Boys' Shoes & Socks","Crewneck","Health & Beauty","Jewelry & Cufflinks","Home Decor","Outerwear","Outdoor Living","Accent","Sneakers","One Pieces","Accessories","Other Pants","Gadgets & Equipment","Bedcovers","Dress Pants","Sweaters","Decor & Accessories","Lifestyle & Gear","Home","Table & Desk Lamps","Underwear & Loungewear","Outdoor Furniture","Bedding","Bags & Luggage","V-Necks","Boots","Furniture","Appliances","Office Accessories","Shoes","Art","Polos, Tees & Sport Shirts","Maternity","Bedding & Bath","Jackets","Gadgets","Suits & Sportcoats","Cook & Bakeware","Necklaces & Pendants","Gear & Equipment","Chandeliers & Pendants","Dresses & Skirts","Pants & Shorts","Apparel","Makeup","Cords","Trays & Bowls","Suits","Home Office & Books","Boys' Apparel & Accessories","Dining & Servingware","Ties","Henleys","Rings","Other Denim","Trench & Raincoats","Towels & Bath Rugs","Watches & Jewelry","Skirts","Cardigans","Toys, Games & Books","Ties, Pocket Squares & More","Lighting","Socks","Girls' Apparel & Accessories","Dresses","Other Shirts","Long Sleeve Sport Shirts","Wallets & Small Leather Goods","Accent Tables","Mirrors & Frames","Children","Shirts & Sweaters","Cookware & Bakeware","Bath","Leather Jackets","Wallets","Pillows","Bar Accessories","Footwear","Hoodies","Other Furniture","Kitchen & Dining","Jackets & Vests"]}
|
data/spec/fixtures/product.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
HTTP/1.1 200 OK
|
2
|
-
Server: Jetty(6.
|
2
|
+
Server: Jetty(7.6.0.v20120127)
|
3
3
|
Cache-Control: no-transform, max-age=600
|
4
4
|
Content-Type: application/json; charset=UTF-8
|
5
|
-
response-time:
|
5
|
+
response-time: 29.0
|
6
6
|
X-Gg-Rule-cdn: cdn_req_check_ssl_api
|
7
|
-
Last-Modified:
|
8
|
-
X-Version: svc-syndication-0.
|
9
|
-
Age:
|
10
|
-
Content-Length:
|
7
|
+
Last-Modified: Tue, 18 Sep 2012 15:13:48 GMT
|
8
|
+
X-Version: svc-syndication-0.3.5 (commons-1.2.1)
|
9
|
+
Age: 286
|
10
|
+
Content-Length: 5279
|
11
11
|
|
12
|
-
{"name":"
|
12
|
+
{"name":"514 Slim Jeans","product":"https://api.gilt.com/v1/products/73794592/detail.json","id":73794592,"brand":"Levi's Red Tab","content":{"description":"Five pocket cotton slim leg jeans Zip fly Button closure Belt loops Waist and back pockets Back waist leather logo tag Unlined Rise: 8\", leg opening: 17\", inseam: 32\". Measurements were taken from a size 32x32","fit_notes":"Straight Leg, Sits Below Waist","material":"100% Cotton","origin":"Mexico"},"url":"http://www.gilt.com/sale/men/denim-style-guide/product/73794592-levis-red-tab-514-slim-jeans?utm_medium=api&utm_campaign=Gilt+Ruby+Bindings&utm_source=salesapi","image_urls":{"91x121":[{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0001/6376/163760679/91x121.jpg","width":91,"height":121},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572623/91x121.jpg","width":91,"height":121},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572631/91x121.jpg","width":91,"height":121}],"300x400":[{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0001/6376/163760679/300x400.jpg","width":300,"height":400},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572623/300x400.jpg","width":300,"height":400},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572631/300x400.jpg","width":300,"height":400}],"420x560":[{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0001/6376/163760679/420x560.jpg","width":420,"height":560},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572623/420x560.jpg","width":420,"height":560},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572631/420x560.jpg","width":420,"height":560}],"1080x1440":[{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0001/6376/163760679/1080x1440.jpg","width":1080,"height":1440},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572623/1080x1440.jpg","width":1080,"height":1440},{"url":"http://cdn1.gilt.com/images/share/uploads/0000/0000/7557/75572631/1080x1440.jpg","width":1080,"height":1440}]},"skus":[{"id":1116040,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"28x30"},{"name":"color","value":"rumpled rigid"}]},{"id":998353,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"28x32"},{"name":"color","value":"rumpled rigid"}]},{"id":1116041,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"29x30"},{"name":"color","value":"rumpled rigid"}]},{"id":998355,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"29x32"},{"name":"color","value":"rumpled rigid"}]},{"id":998357,"inventory_status":"sold out","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"29x34"},{"name":"color","value":"rumpled rigid"}]},{"id":1116039,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"30x30"},{"name":"color","value":"rumpled rigid"}]},{"id":998360,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"30x32"},{"name":"color","value":"rumpled rigid"}]},{"id":998351,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"31x32"},{"name":"color","value":"rumpled rigid"}]},{"id":975257,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"32x32"},{"name":"color","value":"rumpled rigid"}]},{"id":998358,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"32x34"},{"name":"color","value":"rumpled rigid"}]},{"id":998361,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"33x32"},{"name":"color","value":"rumpled rigid"}]},{"id":1312539,"inventory_status":"sold out","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"33x34"},{"name":"color","value":"rumpled rigid"}]},{"id":998352,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"34x32"},{"name":"color","value":"rumpled rigid"}]},{"id":998354,"inventory_status":"for sale","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"34x34"},{"name":"color","value":"rumpled rigid"}]},{"id":998356,"inventory_status":"sold out","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"36x32"},{"name":"color","value":"rumpled rigid"}]},{"id":998359,"inventory_status":"sold out","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"36x34"},{"name":"color","value":"rumpled rigid"}]},{"id":998362,"inventory_status":"sold out","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"38x32"},{"name":"color","value":"rumpled rigid"}]},{"id":998350,"inventory_status":"sold out","msrp_price":"68.00","sale_price":"68.00","attributes":[{"name":"size","value":"38x34"},{"name":"color","value":"rumpled rigid"}]}],"categories":["Men","Apparel","Denim","Slim Leg","Clothing","Denim"]}
|
@@ -30,4 +30,11 @@ describe Gilt::Client::Products do
|
|
30
30
|
expect { @client.detail }.to raise_error Weary::Resource::UnmetRequirementsError
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
describe "#categories" do
|
35
|
+
it "generates a request to get the categories of active products" do
|
36
|
+
categories = @client.categories
|
37
|
+
categories.uri.to_s.should match "/categories.json"
|
38
|
+
end
|
39
|
+
end
|
33
40
|
end
|
data/spec/gilt/product_spec.rb
CHANGED
@@ -4,7 +4,8 @@ describe Gilt::Product do
|
|
4
4
|
before do
|
5
5
|
@apikey = "my-api-key"
|
6
6
|
@affid = "my-affiliate-id"
|
7
|
-
stub_request(:any, /api\.gilt\.com
|
7
|
+
stub_request(:any, /api\.gilt\.com\/.*detail.*/).to_return fixture('product.json')
|
8
|
+
stub_request(:any, /api\.gilt\.com\/.*categories.*/).to_return fixture('categories.json')
|
8
9
|
end
|
9
10
|
|
10
11
|
describe "::defer" do
|
@@ -33,24 +34,31 @@ describe Gilt::Product do
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
37
|
+
describe "::categories" do
|
38
|
+
it "gets a list of active product categories" do
|
39
|
+
categories = described_class.categories(@apikey, @affid)
|
40
|
+
categories.length.should eql 130
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
36
44
|
describe "#name" do
|
37
45
|
it "returns the product's name" do
|
38
46
|
product = described_class.create("a-product-id", @apikey)
|
39
|
-
product.name.should eql "
|
47
|
+
product.name.should eql "514 Slim Jeans"
|
40
48
|
end
|
41
49
|
end
|
42
50
|
|
43
51
|
describe "#product" do
|
44
52
|
it "returns a URI representation of the product's endpoint" do
|
45
53
|
product = described_class.create("a-product-id", @apikey)
|
46
|
-
product.product.to_s.should eql "https://api.gilt.com/v1/products/
|
54
|
+
product.product.to_s.should eql "https://api.gilt.com/v1/products/73794592/detail.json"
|
47
55
|
end
|
48
56
|
end
|
49
57
|
|
50
58
|
describe "#id" do
|
51
59
|
it "returns the id of the product" do
|
52
60
|
product = described_class.create("a-product-id", @apikey)
|
53
|
-
product.id.should eql
|
61
|
+
product.id.should eql 73794592
|
54
62
|
end
|
55
63
|
end
|
56
64
|
|
@@ -64,14 +72,22 @@ describe Gilt::Product do
|
|
64
72
|
describe "#url" do
|
65
73
|
it "returns a URI representation of the product's detail page" do
|
66
74
|
product = described_class.create("a-product-id", @apikey)
|
67
|
-
product.url.to_s.should match "www.gilt.com/
|
75
|
+
product.url.to_s.should match "www.gilt.com/sale/men/"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#categories" do
|
80
|
+
it "returns an array of strings of categories in which this product belongs" do
|
81
|
+
product = described_class.create("a-product-id", @apikey)
|
82
|
+
product.categories.should include "Denim"
|
83
|
+
|
68
84
|
end
|
69
85
|
end
|
70
86
|
|
71
87
|
describe "#description" do
|
72
88
|
it "returns the product description" do
|
73
89
|
product = described_class.create("a-product-id", @apikey)
|
74
|
-
product.description.should match /^five pocket
|
90
|
+
product.description.should match /^five pocket cotton slim leg/i
|
75
91
|
end
|
76
92
|
end
|
77
93
|
|
@@ -127,14 +143,14 @@ describe Gilt::Product do
|
|
127
143
|
describe "#min_price" do
|
128
144
|
it "returns the min price of the skus" do
|
129
145
|
product = described_class.create("a-product-id", @apikey)
|
130
|
-
product.min_price.to_s.should eql "
|
146
|
+
product.min_price.to_s.should eql "68.00"
|
131
147
|
end
|
132
148
|
end
|
133
149
|
|
134
150
|
describe "#max_price" do
|
135
151
|
it "returns the max price of the skus" do
|
136
152
|
product = described_class.create("a-product-id", @apikey)
|
137
|
-
product.min_price.to_s.should eql "
|
153
|
+
product.min_price.to_s.should eql "68.00"
|
138
154
|
end
|
139
155
|
end
|
140
156
|
|
@@ -148,14 +164,14 @@ describe Gilt::Product do
|
|
148
164
|
describe "#format_price" do
|
149
165
|
it "prints the price range of the product, or if both min and max are equal, the price" do
|
150
166
|
product = described_class.create("a-product-id", @apikey)
|
151
|
-
product.format_price.should eql "$
|
167
|
+
product.format_price.should eql "$68.00"
|
152
168
|
end
|
153
169
|
end
|
154
170
|
|
155
171
|
describe "#colors" do
|
156
172
|
it "returns a set of all the possible colors for the product" do
|
157
173
|
product = described_class.create("a-product-id", @apikey)
|
158
|
-
product.colors.first.should match /
|
174
|
+
product.colors.first.should match /rumpled/
|
159
175
|
end
|
160
176
|
end
|
161
177
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gilt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: money
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,18 +21,28 @@ dependencies:
|
|
21
21
|
version: 4.0.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 4.0.2
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: weary
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
37
|
+
version: 1.1.0
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.0
|
36
46
|
description: Ruby client for the Gilt public API (http://dev.gilt.com). Written with
|
37
47
|
the Weary framework.
|
38
48
|
email:
|
@@ -45,6 +55,7 @@ files:
|
|
45
55
|
- .travis.yml
|
46
56
|
- Gemfile
|
47
57
|
- Gemfile.lock
|
58
|
+
- LICENSE
|
48
59
|
- README.md
|
49
60
|
- Rakefile
|
50
61
|
- gilt.gemspec
|
@@ -57,6 +68,7 @@ files:
|
|
57
68
|
- lib/gilt/sku.rb
|
58
69
|
- lib/gilt/version.rb
|
59
70
|
- spec/fixtures/active.json
|
71
|
+
- spec/fixtures/categories.json
|
60
72
|
- spec/fixtures/product.json
|
61
73
|
- spec/fixtures/sale_detail.json
|
62
74
|
- spec/gilt/client/products_spec.rb
|
@@ -80,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
92
|
version: '0'
|
81
93
|
segments:
|
82
94
|
- 0
|
83
|
-
hash:
|
95
|
+
hash: -3809446155767066634
|
84
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
97
|
none: false
|
86
98
|
requirements:
|
@@ -89,15 +101,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
101
|
version: '0'
|
90
102
|
segments:
|
91
103
|
- 0
|
92
|
-
hash:
|
104
|
+
hash: -3809446155767066634
|
93
105
|
requirements: []
|
94
106
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.8.
|
107
|
+
rubygems_version: 1.8.24
|
96
108
|
signing_key:
|
97
109
|
specification_version: 3
|
98
110
|
summary: Ruby client for the Gilt public API.
|
99
111
|
test_files:
|
100
112
|
- spec/fixtures/active.json
|
113
|
+
- spec/fixtures/categories.json
|
101
114
|
- spec/fixtures/product.json
|
102
115
|
- spec/fixtures/sale_detail.json
|
103
116
|
- spec/gilt/client/products_spec.rb
|