asin 2.0.0 → 3.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 00b2605291551bb77e09ebf2bf7f60fa0d7ec6c3
4
- data.tar.gz: 63d7a88fffc477049a4e1419e3d761133f35cc5f
2
+ SHA256:
3
+ metadata.gz: a123caf2606ef57b6c970b1cc80762fdec163de3df7cae33ae2b1653cf1576e5
4
+ data.tar.gz: af1d22414d49842b4b37a2d70d4e25cfcbaa470ef9f3665ac2dc3d812a25d368
5
5
  SHA512:
6
- metadata.gz: 0250269c613eca2fc754638bedeb58b5b05719d954e2e57534e76fb16863972bff9bce3e3604808060ad9108b2039b66d7d447d76b4c4ac2d6c18c3f9743084a
7
- data.tar.gz: 4bcb447e52f21214adb88c0e3b19d96399e3305fa02a1b95352f98a0eab394b55fc974d164c5d536d54f1e5a149301ce54a6b2d752f9298e29c1c6481b9db657
6
+ metadata.gz: bff07d1891750eb61b25e43512b06e68ceb7d13c62ab93af2464b96433a5d0748520f7ced832c523a8fac5bc6ab8eaa61cdb9c8d523fa289d0809b38afec7874
7
+ data.tar.gz: 6c8aca5e617263051bd663229300ef248ed0f09d099700af323865ca9f523799cfa1158f17271182ac1b35d785c0175fb129f4f4e785e30ec68b74686f201e6f
data/.travis.yml CHANGED
@@ -1,5 +1,3 @@
1
- script: "bundle exec rake"
1
+ sudo: false
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1.0
5
- - jruby-19mode
3
+ - 2.5.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 3.0.0
2
+
3
+ * drop SCHash and convert keys using activesupport
4
+
5
+ ## 2.1.0
6
+
7
+ * use the http.rb gem instead of HTTPI adapter
8
+
9
+ ## 2.0.2
10
+
11
+ * changes from Hashie::Rash to Hashie::SCHash, because Hashie added its own Rash class that conflicted with the Rash gem.
12
+
13
+ ## 2.0.1
14
+
15
+ * get rid of OpenSSL deprecation (davelacy) https://github.com/phoet/asin/pull/36
16
+
1
17
  ## 2.0.0
2
18
 
3
19
  * configurable items are no longer supported, in favor of Hashie::Rash, see upgrading instructions
data/Gemfile CHANGED
@@ -1,9 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in asin.gemspec
4
3
  gemspec
5
4
 
6
5
  group :development do
7
- gem 'pry-plus', platforms: :ruby
8
- gem 'coveralls'
6
+ gem 'byebug', platforms: :ruby
9
7
  end
data/Gemfile.lock CHANGED
@@ -1,104 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asin (1.2.0)
4
+ asin (3.0.0)
5
+ activesupport (>= 4.0)
5
6
  confiture (>= 0.1)
6
7
  crack (>= 0.3)
7
8
  hashie (>= 1.1)
8
- httpi (>= 0.9)
9
- rash (>= 0.4)
9
+ http (>= 3.0)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- addressable (2.3.2)
15
- binding_of_caller (0.7.2)
16
- debug_inspector (>= 0.0.1)
17
- bond (0.5.1)
18
- coderay (1.1.0)
19
- colorize (0.5.8)
20
- columnize (0.3.6)
14
+ activesupport (7.0.1)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ addressable (2.8.0)
20
+ public_suffix (>= 2.0.2, < 5.0)
21
+ byebug (11.1.3)
22
+ concurrent-ruby (1.1.9)
21
23
  confiture (0.1.4)
22
- coveralls (0.6.7)
23
- colorize
24
- multi_json (~> 1.3)
25
- rest-client
26
- simplecov (>= 0.7)
27
- thor
28
- crack (0.3.1)
29
- debug_inspector (0.0.2)
30
- debugger (1.6.6)
31
- columnize (>= 0.3.1)
32
- debugger-linecache (~> 1.2.0)
33
- debugger-ruby_core_source (~> 1.3.2)
34
- debugger-linecache (1.2.0)
35
- debugger-ruby_core_source (1.3.2)
36
- diff-lcs (1.1.3)
37
- hashie (2.0.5)
38
- httpclient (2.3.0.1)
39
- httpi (2.1.0)
40
- rack
41
- rubyntlm (~> 0.3.2)
42
- interception (0.5)
43
- jist (1.5.1)
44
- json
45
- json (1.8.1)
46
- method_source (0.8.2)
47
- mime-types (1.23)
48
- multi_json (1.7.6)
49
- pry (0.9.12.6)
50
- coderay (~> 1.0)
51
- method_source (~> 0.8)
52
- slop (~> 3.4)
53
- pry-debugger (0.2.2)
54
- debugger (~> 1.3)
55
- pry (~> 0.9.10)
56
- pry-doc (0.6.0)
57
- pry (~> 0.9)
58
- yard (~> 0.8)
59
- pry-docmore (0.1.1)
60
- pry
61
- pry-doc
62
- pry-plus (1.0.0)
63
- bond
64
- jist
65
- pry-debugger
66
- pry-doc
67
- pry-docmore
68
- pry-rescue
69
- pry-stack_explorer
70
- pry-rescue (1.4.0)
71
- interception (>= 0.4)
72
- pry
73
- pry-stack_explorer (0.4.9.1)
74
- binding_of_caller (>= 0.7)
75
- pry (>= 0.9.11)
76
- rack (1.5.2)
77
- rake (0.9.2.2)
78
- rash (0.4.0)
79
- hashie (~> 2.0.0)
80
- rest-client (1.6.7)
81
- mime-types (>= 1.16)
82
- rspec (2.11.0)
83
- rspec-core (~> 2.11.0)
84
- rspec-expectations (~> 2.11.0)
85
- rspec-mocks (~> 2.11.0)
86
- rspec-core (2.11.1)
87
- rspec-expectations (2.11.3)
88
- diff-lcs (~> 1.1.3)
89
- rspec-mocks (2.11.3)
90
- rubyntlm (0.3.4)
91
- simplecov (0.7.1)
92
- multi_json (~> 1.0)
93
- simplecov-html (~> 0.7.1)
94
- simplecov-html (0.7.1)
95
- slop (3.5.0)
96
- thor (0.18.1)
97
- vcr (2.2.5)
98
- webmock (1.8.11)
99
- addressable (>= 2.2.7)
100
- crack (>= 0.1.7)
101
- yard (0.8.7.3)
24
+ crack (0.4.5)
25
+ rexml
26
+ diff-lcs (1.5.0)
27
+ domain_name (0.5.20190701)
28
+ unf (>= 0.0.5, < 1.0.0)
29
+ ffi (1.15.5)
30
+ ffi (1.15.5-java)
31
+ ffi-compiler (1.0.1)
32
+ ffi (>= 1.0.0)
33
+ rake
34
+ hashdiff (1.0.1)
35
+ hashie (5.0.0)
36
+ http (4.4.1)
37
+ addressable (~> 2.3)
38
+ http-cookie (~> 1.0)
39
+ http-form_data (~> 2.2)
40
+ http-parser (~> 1.2.0)
41
+ http-cookie (1.0.4)
42
+ domain_name (~> 0.5)
43
+ http-form_data (2.3.0)
44
+ http-parser (1.2.3)
45
+ ffi-compiler (>= 1.0, < 2.0)
46
+ i18n (1.9.1)
47
+ concurrent-ruby (~> 1.0)
48
+ minitest (5.15.0)
49
+ public_suffix (4.0.6)
50
+ rake (0.9.6)
51
+ rexml (3.2.5)
52
+ rspec (2.99.0)
53
+ rspec-core (~> 2.99.0)
54
+ rspec-expectations (~> 2.99.0)
55
+ rspec-mocks (~> 2.99.0)
56
+ rspec-collection_matchers (1.2.0)
57
+ rspec-expectations (>= 2.99.0.beta1)
58
+ rspec-core (2.99.2)
59
+ rspec-expectations (2.99.2)
60
+ diff-lcs (>= 1.1.3, < 2.0)
61
+ rspec-mocks (2.99.4)
62
+ tzinfo (2.0.4)
63
+ concurrent-ruby (~> 1.0)
64
+ unf (0.1.4)
65
+ unf_ext
66
+ unf (0.1.4-java)
67
+ unf_ext (0.0.8)
68
+ vcr (4.0.0)
69
+ webmock (3.14.0)
70
+ addressable (>= 2.8.0)
71
+ crack (>= 0.3.2)
72
+ hashdiff (>= 0.4.0, < 2.0.0)
102
73
 
103
74
  PLATFORMS
104
75
  java
@@ -106,10 +77,12 @@ PLATFORMS
106
77
 
107
78
  DEPENDENCIES
108
79
  asin!
109
- coveralls
110
- httpclient (>= 2.2.3)
111
- pry-plus
112
- rake (~> 0.9.2.2)
113
- rspec (~> 2.11.0)
114
- vcr (~> 2.2.5)
115
- webmock (~> 1.8.7)
80
+ byebug
81
+ rake (~> 0.9)
82
+ rspec (~> 2.11)
83
+ rspec-collection_matchers (~> 1.1)
84
+ vcr (~> 4.0)
85
+ webmock (~> 3.4)
86
+
87
+ BUNDLED WITH
88
+ 2.1.4
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  ## Infos
2
2
 
3
3
  [![Build Status](https://img.shields.io/travis/phoet/asin/master.svg)](https://travis-ci.org/phoet/asin)
4
- [![Code Climate](https://img.shields.io/codeclimate/github/phoet/asin.svg)](https://codeclimate.com/github/phoet/asin)
5
- [![Coverage Status](https://img.shields.io/coveralls/phoet/asin/master.svg)](https://coveralls.io/r/phoet/asin?branch=master)
4
+
6
5
 
7
6
  ASIN is a simple, extensible wrapper for parts of the REST-API of Amazon Product Advertising API (aka Associates Web Service aka Amazon E-Commerce Service).
8
7
 
@@ -10,126 +9,130 @@ For more information on the REST calls, have a look at the whole [Amazon E-Comme
10
9
 
11
10
  Have a look at the [RDOC](http://rdoc.info/projects/phoet/asin) for this project, if you like browsing some docs.
12
11
 
13
- The gem runs smoothly with Rails 3 and is tested against multiple rubies. See *.travis.yml* for details.
12
+ The gem runs smoothly with Rails and is tested against multiple rubies. See *.travis.yml* for details.
14
13
 
15
14
 
16
15
  ## Upgrading from Version 1.x
17
16
 
18
- Version 2 removes all the SimpleXXX classes in favor of Hashie::Rash.
17
+ Version 2 removes all the SimpleXXX classes in favor of [Hashie::Rash](https://github.com/tcocca/rash).
19
18
 
20
- The old api is available if you require the ASIN::Adapter
19
+ The old API is available if you require `ASIN::Adapter`:
21
20
 
22
- require 'asin'
23
- require 'asin/adapter'
21
+ ```ruby
22
+ require 'asin'
23
+ require 'asin/adapter'
24
+ ```
24
25
 
25
- It's also a good starting point for looking into writing your own API adapter.
26
+ It's also a good starting point for looking into writing your own asin-adapter.
26
27
 
27
28
 
28
29
  ## Installation
29
30
 
30
- gem install asin
31
- gem install httpclient # optional, see HTTPI
31
+ ```bash
32
+ gem install asin
33
+ ```
32
34
 
33
35
  or in your Gemfile:
34
36
 
35
- gem 'asin'
36
- gem 'httpclient' # optional, see HTTPI
37
-
37
+ ```ruby
38
+ gem 'asin'
39
+ ```
38
40
 
39
41
  ## Configuration
40
42
 
41
- Rails style initializer (config/initializers/asin.rb):
43
+ Rails style initializer (`config/initializers/asin.rb`):
42
44
 
43
- ASIN::Configuration.configure do |config|
44
- config.secret = 'your-secret'
45
- config.key = 'your-key'
46
- config.associate_tag = 'your-tag'
47
- end
48
-
49
- Have a look at ASIN::Configuration class for all the details.
45
+ ```ruby
46
+ ASIN::Configuration.configure do |config|
47
+ config.secret = 'your-secret'
48
+ config.key = 'your-key'
49
+ config.associate_tag = 'your-tag'
50
+ end
51
+ ```
50
52
 
53
+ Have a look at `ASIN::Configuration` class for all the details.
51
54
 
52
55
  ## Usage
53
56
 
54
57
  ASIN is designed as a module, so you can include it into any object you like:
55
58
 
56
- # require and include
57
- require 'asin'
58
- include ASIN::Client
59
-
60
- # lookup an ASIN
61
- lookup '1430218150'
59
+ ```ruby
60
+ # require and include
61
+ require 'asin'
62
+ include ASIN::Client
63
+
64
+ # lookup an ASIN
65
+ lookup '1430218150'
62
66
 
63
- # lookup multiple items by ASIN
64
- lookup ['1430218150','1934356549']
67
+ # lookup multiple items by ASIN
68
+ lookup ['1430218150','1934356549']
69
+ ```
65
70
 
66
71
  But you can also use the *instance* method to get a proxy-object:
67
72
 
68
- # just require
69
- require 'asin'
70
-
71
- # create an ASIN client
72
- client = ASIN::Client.instance
73
-
74
- # lookup an item with the amazon standard identification number (asin)
75
- items = client.lookup '1430218150'
76
-
77
- # have a look at the title of the item
78
- items.first.item_attributes.title
79
- => Learn Objective-C on the Mac (Learn Series)
80
-
81
- # search for any kind of stuff on amazon with keywords
82
- items = search_keywords 'Learn', 'Objective-C'
83
- items.first.item_attributes.title
84
- => "Learn Objective-C on the Mac (Learn Series)"
85
-
86
- # search for any kind of stuff on amazon with custom parameters
87
- search :Keywords => 'Learn Objective-C', :SearchIndex => :Books
88
- items.first.item_attributes.title
89
- => "Learn Objective-C on the Mac (Learn Series)"
90
-
91
- # search for similar items like the one you already have
92
- items = client.similar '1430218150'
73
+ ```ruby
74
+ # just require
75
+ require 'asin'
93
76
 
94
- There is an additional set of methods to support AWS cart operations:
77
+ # create an ASIN client
78
+ client = ASIN::Client.instance
95
79
 
96
- client = ASIN::Client.instance
97
-
98
- # create a cart with an item
99
- cart = client.create_cart({:asin => '1430218150', :quantity => 1})
100
- cart.cart_items.cart_item
101
- => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
102
-
103
- # clear everything from the cart
104
- cart = client.clear_cart(cart)
105
- cart.cart_items.cart_item
106
- => []
107
-
108
- # update items in the cart
109
- cart = client.update_items(cart, {:cart_item_id => cart.items.first.CartItemId, :action => :SaveForLater}, {:cart_item_id => cart.items.first.CartItemId, :quantity => 7})
110
- cart.saved_for_later_items.saved_for_later_item
111
- => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
80
+ # lookup an item with the amazon standard identification number (asin)
81
+ items = client.lookup '1430218150'
112
82
 
113
- It's also possible to access browse nodes:
83
+ # have a look at the title of the item
84
+ items.first.item_attributes.title
85
+ # => Learn Objective-C on the Mac (Learn Series)
86
+
87
+ # search for any kind of stuff on amazon with keywords
88
+ items = client.search_keywords 'Learn', 'Objective-C'
89
+ items.first.item_attributes.title
90
+ # => "Learn Objective-C on the Mac (Learn Series)"
114
91
 
115
- client = ASIN::Client.instance
116
-
117
- # create a cart with an item
118
- node = client.browse_node('17', :ResponseGroup => :TopSellers)
119
- node.first.browse_node_id
120
- => '163357'
121
- node.first.name
122
- => 'Literature & Fiction'
92
+ # search for any kind of stuff on amazon with custom parameters
93
+ items = client.search :Keywords => 'Learn Objective-C', :SearchIndex => :Books
94
+ items.first.item_attributes.title
95
+ # => "Learn Objective-C on the Mac (Learn Series)"
123
96
 
97
+ # search for similar items like the one you already have
98
+ items = client.similar '1430218150'
99
+ items.first.item_attributes.title
100
+ # => "Beginning iOS 7 Development: Exploring the iOS SDK"
101
+ ```
124
102
 
125
- ## HTTPI
103
+ There is an additional set of methods to support AWS cart operations:
104
+
105
+ ```ruby
106
+ client = ASIN::Client.instance
126
107
 
127
- ASIN uses [HTTPI](https://github.com/rubiii/httpi) as a HTTP-Client adapter.
128
- See the HTTPI documentation for how to configure different clients or the logger.
129
- As a default HTTPI uses _httpclient_ so you should add that dependency to your project:
108
+ # create a cart with an item
109
+ cart = client.create_cart({:asin => '1430218150', :quantity => 1})
110
+ cart.cart_items.cart_item
111
+ # => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
130
112
 
131
- gem 'httpclient'
113
+ # clear everything from the cart
114
+ cart = client.clear_cart(cart)
115
+ cart.cart_items.cart_item
116
+ # => []
132
117
 
118
+ # update items in the cart
119
+ cart = client.update_items(cart, {:cart_item_id => cart.items.first.CartItemId, :action => :SaveForLater}, {:cart_item_id # => cart.items.first.CartItemId, :quantity => 7})
120
+ cart.saved_for_later_items.saved_for_later_item
121
+ # => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
122
+ ```
123
+
124
+ It's also possible to access browse nodes:
125
+
126
+ ```ruby
127
+ client = ASIN::Client.instance
128
+
129
+ # create a cart with an item
130
+ node = client.browse_node('17', :ResponseGroup => :TopSellers)
131
+ node.first.browse_node_id
132
+ # => '163357'
133
+ node.first.name
134
+ # => 'Literature & Fiction'
135
+ ```
133
136
 
134
137
  ## Confiture
135
138
 
@@ -139,7 +142,7 @@ See the Confiture documentation for different configuration styles.
139
142
 
140
143
  ## License
141
144
 
142
- "THE BEER-WARE LICENSE" (Revision 42):
143
- [ps@nofail.de](mailto:ps@nofail.de) wrote this file. As long as you retain this notice you
144
- can do whatever you want with this stuff. If we meet some day, and you think
145
- this stuff is worth it, you can buy me a beer in return Peter Schröder
145
+ "THE (extended) BEER-WARE LICENSE" (Revision 42.0815): [phoet](mailto:ps@nofail.de) contributed to this project.
146
+
147
+ As long as you retain this notice you can do whatever you want with this stuff.
148
+ If we meet some day, and you think this stuff is worth it, you can buy me some beers in return.
data/asin.gemspec CHANGED
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  $:.push File.expand_path("../lib", __FILE__)
3
2
  require "asin/version"
4
3
 
@@ -18,18 +17,15 @@ Gem::Specification.new do |s|
18
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
18
  s.require_paths = ["lib"]
20
19
 
21
- s.add_dependency('crack', '>= 0.3')
22
- s.add_dependency('hashie', '>= 1.1')
23
- s.add_dependency('rash', '>= 0.4')
24
- s.add_dependency('httpi', '>= 0.9')
25
- s.add_dependency('confiture', '>= 0.1')
20
+ s.add_dependency('crack', '>= 0.3')
21
+ s.add_dependency('hashie', '>= 1.1')
22
+ s.add_dependency('http', '>= 3.0')
23
+ s.add_dependency('confiture', '>= 0.1')
24
+ s.add_dependency('activesupport', '>= 4.0')
26
25
 
27
- s.add_runtime_dependency('jruby-openssl') if RUBY_PLATFORM == 'java'
28
-
29
- s.add_development_dependency('httpclient', '>= 2.2.3')
30
-
31
- s.add_development_dependency('rake', '~> 0.9.2.2')
32
- s.add_development_dependency('vcr', '~> 2.2.5')
33
- s.add_development_dependency('webmock', '~> 1.8.7')
34
- s.add_development_dependency('rspec', '~> 2.11.0')
26
+ s.add_development_dependency('rake', '~> 0.9')
27
+ s.add_development_dependency('vcr', '~> 4.0')
28
+ s.add_development_dependency('webmock', '~> 3.4')
29
+ s.add_development_dependency('rspec', '~> 2.11')
30
+ s.add_development_dependency('rspec-collection_matchers', '~> 1.1')
35
31
  end
data/lib/asin/adapter.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module ASIN
2
2
  module Adapter
3
3
  def handle_type(data, type)
4
- Hashie::Rash.new(data).tap do |rash|
5
- rash.instance_eval do
4
+ Response.create(data).tap do |schash|
5
+ schash.instance_eval do
6
6
  case type
7
7
  when :cart
8
8
  def url
@@ -52,14 +52,6 @@ module ASIN
52
52
  large_image!.url
53
53
  end
54
54
 
55
- def review
56
- EditorialReviews!.EditorialReview!.Content
57
- end
58
-
59
- def image_url
60
- LargeImage!.URL
61
- end
62
-
63
55
  # <ItemAttributes>
64
56
  def author
65
57
  item_attributes!.author
@@ -215,8 +207,6 @@ module ASIN
215
207
  end
216
208
 
217
209
  module Client
218
- # REM (ps) this is a workaround for jruby, because they don't support Module.prepend https://github.com/jruby/jruby/issues/751
219
- remove_method :handle_type
220
- include ASIN::Adapter
210
+ prepend ASIN::Adapter
221
211
  end
222
212
  end
data/lib/asin/client.rb CHANGED
@@ -1,14 +1,13 @@
1
- require 'httpi'
1
+ require 'http'
2
2
  require 'rexml/document' # https://github.com/phoet/asin/pull/23
3
3
  require 'crack/xml'
4
4
  require 'cgi'
5
5
  require 'base64'
6
- require 'rash'
7
6
 
8
7
  module ASIN
9
8
  module Client
10
9
 
11
- DIGEST = OpenSSL::Digest::Digest.new('sha256')
10
+ DIGEST = OpenSSL::Digest.new('sha256')
12
11
  PATH = '/onca/xml'
13
12
 
14
13
  # Convenience method to create an ASIN client.
@@ -216,7 +215,7 @@ module ASIN
216
215
  end
217
216
 
218
217
  def handle_type(data, type)
219
- Hashie::Rash.new(data)
218
+ Response.create(data)
220
219
  end
221
220
 
222
221
  def create_item_params(items)
@@ -252,7 +251,7 @@ module ASIN
252
251
  url = "http://#{Configuration.host}#{PATH}?#{signed}"
253
252
  log(:info, "performing rest call to url='#{url}'")
254
253
 
255
- response = HTTPI.get(url)
254
+ response = HTTP.get(url)
256
255
  if response.code == 200
257
256
  # force utf-8 chars, works only on 1.9 string
258
257
  resp = response.body
@@ -0,0 +1,14 @@
1
+ require 'hashie'
2
+ require 'active_support/core_ext/hash/keys'
3
+ require 'active_support/inflector'
4
+
5
+ module ASIN
6
+ class Response < Hashie::Mash
7
+ disable_warnings
8
+
9
+ def self.create(data)
10
+ data.deep_transform_keys! { |key| key.underscore }
11
+ new(data)
12
+ end
13
+ end
14
+ end
data/lib/asin/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ASIN
2
- VERSION = "2.0.0"
2
+ VERSION = "3.0.0"
3
3
  end
data/lib/asin.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module ASIN
2
- require 'asin/client'
3
2
  require 'asin/version'
4
3
  require 'asin/configuration'
4
+ require 'asin/response'
5
+ require 'asin/client'
5
6
  end
@@ -11,8 +11,8 @@ module ASIN
11
11
 
12
12
  it "should create a cart", :vcr do
13
13
  cart = @helper.create_cart({:asin => ANY_ASIN, :quantity => 1}, {:asin => ANY_OTHER_ASIN, :quantity => 2})
14
- expect(cart.valid?).to be_true
15
- expect(cart.empty?).to be_false
14
+ expect(cart.valid?).to be_truthy
15
+ expect(cart.empty?).to be_falsey
16
16
  end
17
17
 
18
18
  it "should handle item paramters" do
@@ -25,22 +25,22 @@ module ASIN
25
25
  it "should clear a cart", :vcr do
26
26
  @cart = @helper.create_cart({:asin => ANY_ASIN, :quantity => 1})
27
27
  cart = @helper.clear_cart(@cart)
28
- expect(cart.valid?).to be_true
29
- expect(cart.empty?).to be_true
28
+ expect(cart.valid?).to be_truthy
29
+ expect(cart.empty?).to be_truthy
30
30
  end
31
31
 
32
32
  it "should get a cart", :vcr do
33
33
  @cart = @helper.create_cart({:asin => ANY_ASIN, :quantity => 1})
34
34
  cart = @helper.get_cart(@cart.cart_id, @cart.hmac)
35
- expect(cart.valid?).to be_true
36
- expect(cart.empty?).to be_false
35
+ expect(cart.valid?).to be_truthy
36
+ expect(cart.empty?).to be_falsey
37
37
  end
38
38
 
39
39
  it "should add items to a cart", :vcr do
40
40
  @cart = @helper.create_cart({:asin => ANY_ASIN, :quantity => 1})
41
41
  cart = @helper.add_items(@cart, {:asin => ANY_OTHER_ASIN, :quantity => 2})
42
- expect(cart.valid?).to be_true
43
- expect(cart.empty?).to be_false
42
+ expect(cart.valid?).to be_truthy
43
+ expect(cart.empty?).to be_falsey
44
44
  expect(cart).to have(2).items
45
45
  end
46
46
 
@@ -49,7 +49,7 @@ module ASIN
49
49
  item_id = @cart.items.first.cart_item_id
50
50
  cart = @helper.update_items(@cart, {:cart_item_id => item_id, :action => 'SaveForLater'}, {:cart_item_id => item_id, :quantity => 7})
51
51
  expect(cart).to have(1).saved_items
52
- expect(cart.valid?).to be_true
52
+ expect(cart.valid?).to be_truthy
53
53
  end
54
54
 
55
55
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,9 @@
1
+ # coverage is supposed to be the first thing in the file!
2
+ if ENV['CODECLIMATE_REPO_TOKEN']
3
+ require 'codeclimate-test-reporter'
4
+ CodeClimate::TestReporter.start
5
+ end
6
+
1
7
  # WORKAROUND (ps) for http://travis-ci.org/#!/phoet/asin/jobs/1794039
2
8
  require "net/http"
3
9
  unless Net.const_defined? :HTTPSession
@@ -5,21 +11,17 @@ unless Net.const_defined? :HTTPSession
5
11
  class Net::HTTPSession < Net::HTTP::HTTPSession; end
6
12
  end
7
13
 
8
- require 'coveralls'
9
- Coveralls.wear!
10
-
11
- require 'pry' unless defined? JRUBY_VERSION
12
14
  require 'rspec'
15
+ require 'rspec/collection_matchers'
13
16
  require 'asin'
14
- require 'asin/client' # is somehow needed for jruby
15
17
  require 'asin/adapter'
16
- require 'httpclient'
17
18
  require 'vcr'
18
- require 'httpi'
19
+ require 'byebug'
19
20
 
20
- VCR.configure do |c|
21
- c.cassette_library_dir = 'spec/cassettes'
22
- c.hook_into :webmock
21
+ VCR.configure do |config|
22
+ config.cassette_library_dir = 'spec/cassettes'
23
+ config.hook_into :webmock
24
+ config.ignore_hosts 'codeclimate.com'
23
25
  end
24
26
 
25
27
  ANY_ASIN = '1430218150'
@@ -39,8 +41,6 @@ RSpec.configure do |config|
39
41
  end
40
42
 
41
43
  config.before :each do
42
- HTTPI.log = false
43
-
44
44
  ASIN::Configuration.reset!
45
45
  @helper = ASIN::Client.instance
46
46
  @helper.configure :logger => nil
metadata CHANGED
@@ -1,155 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Schröder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hashie
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rash
42
+ name: http
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.4'
47
+ version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.4'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: httpi
56
+ name: confiture
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.9'
61
+ version: '0.1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0.9'
68
+ version: '0.1'
69
69
  - !ruby/object:Gem::Dependency
70
- name: confiture
70
+ name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.1'
75
+ version: '4.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.1'
82
+ version: '4.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: httpclient
84
+ name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.2.3
89
+ version: '0.9'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.2.3
96
+ version: '0.9'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake
98
+ name: vcr
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.9.2.2
103
+ version: '4.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.9.2.2
110
+ version: '4.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: vcr
112
+ name: webmock
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 2.2.5
117
+ version: '3.4'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 2.2.5
124
+ version: '3.4'
125
125
  - !ruby/object:Gem::Dependency
126
- name: webmock
126
+ name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.8.7
131
+ version: '2.11'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.8.7
138
+ version: '2.11'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rspec
140
+ name: rspec-collection_matchers
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 2.11.0
145
+ version: '1.1'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 2.11.0
152
+ version: '1.1'
153
153
  description: Amazon Simple INterface - Support for ItemLookup, SimilarityLookup, Search,
154
154
  BrowseNode and Cart Operations.
155
155
  email:
@@ -158,11 +158,11 @@ executables: []
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
- - .document
162
- - .gitignore
163
- - .irbrc
164
- - .rspec
165
- - .travis.yml
161
+ - ".document"
162
+ - ".gitignore"
163
+ - ".irbrc"
164
+ - ".rspec"
165
+ - ".travis.yml"
166
166
  - CHANGELOG.md
167
167
  - Gemfile
168
168
  - Gemfile.lock
@@ -172,6 +172,7 @@ files:
172
172
  - lib/asin/adapter.rb
173
173
  - lib/asin/client.rb
174
174
  - lib/asin/configuration.rb
175
+ - lib/asin/response.rb
175
176
  - lib/asin/version.rb
176
177
  - rakefile.rb
177
178
  - spec/asin.yml
@@ -210,17 +211,16 @@ require_paths:
210
211
  - lib
211
212
  required_ruby_version: !ruby/object:Gem::Requirement
212
213
  requirements:
213
- - - '>='
214
+ - - ">="
214
215
  - !ruby/object:Gem::Version
215
216
  version: '0'
216
217
  required_rubygems_version: !ruby/object:Gem::Requirement
217
218
  requirements:
218
- - - '>='
219
+ - - ">="
219
220
  - !ruby/object:Gem::Version
220
221
  version: '0'
221
222
  requirements: []
222
- rubyforge_project: asin
223
- rubygems_version: 2.0.3
223
+ rubygems_version: 3.1.6
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Amazon Simple INterface - Support for ItemLookup, SimilarityLookup, Search,
@@ -253,4 +253,3 @@ test_files:
253
253
  - spec/lib/search_spec.rb
254
254
  - spec/lib/similarity_spec.rb
255
255
  - spec/spec_helper.rb
256
- has_rdoc: