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 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
@@ -1,3 +1,3 @@
1
1
  module Kosher
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
data/lib/kosher.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'sucker'
2
- require 'kosher/struct'
3
2
  require 'kosher/algorithm'
4
3
  require 'kosher/condition'
5
4
  require 'kosher/description'
@@ -2,10 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  module Kosher
4
4
  describe Item do
5
- it "should descend from Kosher::Struct" do
6
- Item.ancestors.should include Kosher::Struct
7
- end
8
-
9
5
  describe ".build" do
10
6
  use_vcr_cassette '0143105825'
11
7
 
@@ -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.9
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
@@ -1,15 +0,0 @@
1
- require 'json'
2
-
3
- module Kosher
4
- class Struct < ::Struct
5
- def to_map
6
- map = Hash.new
7
- self.members.each { |m| map[m] = self[m] }
8
- map
9
- end
10
-
11
- def to_json(*a)
12
- to_map.to_json(*a)
13
- end
14
- end
15
- end
@@ -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