kosher 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kosher/offer.rb +2 -0
- data/lib/kosher/version.rb +1 -1
- data/lib/kosher.rb +0 -1
- data/spec/kosher/item_spec.rb +0 -4
- data/spec/kosher/offer_spec.rb +5 -0
- metadata +1 -4
- data/lib/kosher/struct.rb +0 -15
- data/spec/kosher/struct_spec.rb +0 -28
data/lib/kosher/offer.rb
CHANGED
@@ -6,6 +6,7 @@ module Kosher
|
|
6
6
|
:ships_in,
|
7
7
|
:ships_free,
|
8
8
|
:cents,
|
9
|
+
:exchange_id,
|
9
10
|
:listing_id)
|
10
11
|
|
11
12
|
def self.build(doc)
|
@@ -20,6 +21,7 @@ module Kosher
|
|
20
21
|
offer.ships_in = listing['AvailabilityAttributes']['MaximumHours'].to_i
|
21
22
|
offer.ships_free = listing['IsEligibleForSuperSaverShipping'] == '1'
|
22
23
|
offer.cents = listing['Price']['Amount'].to_i
|
24
|
+
offer.exchange_id = listing['ExchangeId']
|
23
25
|
offer.listing_id = listing['OfferListingId']
|
24
26
|
|
25
27
|
offer
|
data/lib/kosher/version.rb
CHANGED
data/lib/kosher.rb
CHANGED
data/spec/kosher/item_spec.rb
CHANGED
data/spec/kosher/offer_spec.rb
CHANGED
@@ -33,6 +33,11 @@ module Kosher
|
|
33
33
|
offer.listing_id.should_not be_nil
|
34
34
|
end
|
35
35
|
|
36
|
+
it "populates the exchange ID" do
|
37
|
+
offer = Offer.build(doc)
|
38
|
+
offer.exchange_id.should_not be_nil
|
39
|
+
end
|
40
|
+
|
36
41
|
it "should handle blank descriptions" do
|
37
42
|
doc['OfferAttributes']['ConditionNote'] = ''
|
38
43
|
offer = Offer.build(doc)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: kosher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.10
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Paper Cavalier
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- lib/kosher/offer.rb
|
115
115
|
- lib/kosher/request.rb
|
116
116
|
- lib/kosher/seller.rb
|
117
|
-
- lib/kosher/struct.rb
|
118
117
|
- lib/kosher/version.rb
|
119
118
|
- spec/fabricators/condition_fabricator.rb
|
120
119
|
- spec/fabricators/offer_fabricator.rb
|
@@ -128,7 +127,6 @@ files:
|
|
128
127
|
- spec/kosher/offer_spec.rb
|
129
128
|
- spec/kosher/request_spec.rb
|
130
129
|
- spec/kosher/seller_spec.rb
|
131
|
-
- spec/kosher/struct_spec.rb
|
132
130
|
- spec/spec_helper.rb
|
133
131
|
- spec/support/credentials.rb
|
134
132
|
- spec/support/faker.rb
|
@@ -175,7 +173,6 @@ test_files:
|
|
175
173
|
- spec/kosher/offer_spec.rb
|
176
174
|
- spec/kosher/request_spec.rb
|
177
175
|
- spec/kosher/seller_spec.rb
|
178
|
-
- spec/kosher/struct_spec.rb
|
179
176
|
- spec/spec_helper.rb
|
180
177
|
- spec/support/credentials.rb
|
181
178
|
- spec/support/faker.rb
|
data/lib/kosher/struct.rb
DELETED
data/spec/kosher/struct_spec.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Kosher
|
4
|
-
describe Struct do
|
5
|
-
before(:all) do
|
6
|
-
class Foo < Struct.new(:bar); end
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "to_json" do
|
10
|
-
it "converts to JSON" do
|
11
|
-
foo = Foo.new
|
12
|
-
foo.bar = 1
|
13
|
-
|
14
|
-
foo.to_json.should eql "{\"bar\":1}"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "handles nested structs" do
|
18
|
-
foo_1 = Foo.new
|
19
|
-
foo_2 = Foo.new
|
20
|
-
|
21
|
-
foo_2.bar = 1
|
22
|
-
foo_1.bar = foo_2
|
23
|
-
|
24
|
-
foo_1.to_json.should eql "{\"bar\":{\"bar\":1}}"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|