asin 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d24c856333d2ff7d131765947bd4d4abe8f1451
4
- data.tar.gz: 2aa29f96ed6ec63316f37bfc8af91b4da330a498
3
+ metadata.gz: 2bce335cc98a4e105831d955ac58ef571fa1f787
4
+ data.tar.gz: 6edddcd8a872b3cd0e808ad7d77ce5a36f3a400b
5
5
  SHA512:
6
- metadata.gz: b0ba427f9ae87eecbba63fc1ce18c783e246b0796fb2b4e73e1d173636c059f5ce569f82b7635937d24f867ce2cf9fdb25a3e8007aec6f43f694ee1fd7f7aa9b
7
- data.tar.gz: 2df98bbd2428438fdd2c5179bd700de5aff4d98d7e3a15ab8746db2b7e0266d3e8142fb0ba493890a74ab6703c4387c4139c133b4aec4c0ec56757eb720c823a
6
+ metadata.gz: 40923d103c60cd2ebe4349784c8a470513fc31eb3bc302891cdff7fe8fa67b36aaf57803ffc93523ef08e3e6e13934ed98dad2596c57afbefaa6e565f562e597
7
+ data.tar.gz: d248e664238f55980980222a03612a78c4cb3f44658a19f880213d4e2890a75208d0ff741045a90b6d8a76c8a7454d2d88ac42a3ed3287db5e501f7408d14fac
@@ -1,7 +1,3 @@
1
1
  sudo: false
2
- script: "CODECLIMATE_REPO_TOKEN=eb04e2a7fa1767ae9055bcb6d74aee731b3ada7eff6dad170cedadca3d649fb7 bundle exec rake"
3
2
  rvm:
4
- - 2.0.0
5
- - 2.1.0
6
- - 2.2.0
7
- - 2.3.0
3
+ - 2.5.0
@@ -1,3 +1,7 @@
1
+ ## 2.1.0
2
+
3
+ * use the http.rb gem instead of HTTPI adapter
4
+
1
5
  ## 2.0.2
2
6
 
3
7
  * changes from Hashie::Rash to Hashie::SCHash, because Hashie added its own Rash class that conflicted with the Rash gem.
@@ -1,56 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asin (2.0.2)
4
+ asin (2.1.0)
5
5
  confiture (>= 0.1)
6
6
  crack (>= 0.3)
7
7
  hashie (>= 1.1)
8
- httpi (>= 0.9)
8
+ http (>= 3.0)
9
9
  snake_case_hash (>= 1.0.2)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- addressable (2.3.2)
15
- byebug (3.5.1)
16
- columnize (~> 0.8)
17
- debugger-linecache (~> 1.2)
18
- slop (~> 3.6)
19
- codeclimate-test-reporter (0.3.0)
20
- simplecov (>= 0.7.1, < 1.0.0)
21
- columnize (0.8.9)
14
+ addressable (2.5.2)
15
+ public_suffix (>= 2.0.2, < 4.0)
16
+ byebug (10.0.2)
17
+ codeclimate-test-reporter (1.0.8)
18
+ simplecov (<= 0.13)
22
19
  confiture (0.1.4)
23
- crack (0.3.1)
24
- debugger-linecache (1.2.0)
25
- diff-lcs (1.2.5)
26
- docile (1.1.3)
27
- hashie (3.4.3)
28
- httpclient (2.3.0.1)
29
- httpi (2.4.1)
30
- rack
31
- multi_json (1.10.0)
32
- rack (1.6.4)
33
- rake (0.9.2.2)
34
- rspec (2.14.1)
35
- rspec-core (~> 2.14.0)
36
- rspec-expectations (~> 2.14.0)
37
- rspec-mocks (~> 2.14.0)
38
- rspec-core (2.14.8)
39
- rspec-expectations (2.14.5)
20
+ crack (0.4.3)
21
+ safe_yaml (~> 1.0.0)
22
+ diff-lcs (1.3)
23
+ docile (1.1.5)
24
+ domain_name (0.5.20180417)
25
+ unf (>= 0.0.5, < 1.0.0)
26
+ hashdiff (0.3.7)
27
+ hashie (3.5.7)
28
+ http (3.3.0)
29
+ addressable (~> 2.3)
30
+ http-cookie (~> 1.0)
31
+ http-form_data (~> 2.0)
32
+ http_parser.rb (~> 0.6.0)
33
+ http-cookie (1.0.3)
34
+ domain_name (~> 0.5)
35
+ http-form_data (2.1.1)
36
+ http_parser.rb (0.6.0)
37
+ http_parser.rb (0.6.0-java)
38
+ json (2.1.0)
39
+ json (2.1.0-java)
40
+ public_suffix (3.0.2)
41
+ rake (0.9.6)
42
+ rspec (2.99.0)
43
+ rspec-core (~> 2.99.0)
44
+ rspec-expectations (~> 2.99.0)
45
+ rspec-mocks (~> 2.99.0)
46
+ rspec-collection_matchers (1.1.3)
47
+ rspec-expectations (>= 2.99.0.beta1)
48
+ rspec-core (2.99.2)
49
+ rspec-expectations (2.99.2)
40
50
  diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.14.6)
42
- simplecov (0.8.2)
51
+ rspec-mocks (2.99.4)
52
+ safe_yaml (1.0.4)
53
+ simplecov (0.13.0)
43
54
  docile (~> 1.1.0)
44
- multi_json
45
- simplecov-html (~> 0.8.0)
46
- simplecov-html (0.8.0)
47
- slop (3.6.0)
48
- snake_case_hash (1.0.2)
55
+ json (>= 1.8, < 3)
56
+ simplecov-html (~> 0.10.0)
57
+ simplecov-html (0.10.2)
58
+ snake_case_hash (1.0.4)
49
59
  hashie (~> 3.0)
50
- vcr (2.2.5)
51
- webmock (1.8.11)
52
- addressable (>= 2.2.7)
53
- crack (>= 0.1.7)
60
+ unf (0.1.4)
61
+ unf_ext
62
+ unf (0.1.4-java)
63
+ unf_ext (0.0.7.5)
64
+ vcr (4.0.0)
65
+ webmock (3.4.2)
66
+ addressable (>= 2.3.6)
67
+ crack (>= 0.3.2)
68
+ hashdiff
54
69
 
55
70
  PLATFORMS
56
71
  java
@@ -60,11 +75,11 @@ DEPENDENCIES
60
75
  asin!
61
76
  byebug
62
77
  codeclimate-test-reporter
63
- httpclient (>= 2.2.3)
64
- rake (~> 0.9.2)
78
+ rake (~> 0.9)
65
79
  rspec (~> 2.11)
66
- vcr (~> 2.2)
67
- webmock (~> 1.8)
80
+ rspec-collection_matchers (~> 1.1)
81
+ vcr (~> 4.0)
82
+ webmock (~> 3.4)
68
83
 
69
84
  BUNDLED WITH
70
- 1.11.2
85
+ 1.16.1
data/README.md CHANGED
@@ -1,8 +1,6 @@
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](http://img.shields.io/codeclimate/coverage/github/phoet/asin.svg)](https://codeclimate.com/github/phoet/asin)
6
4
 
7
5
 
8
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).
@@ -32,14 +30,12 @@ It's also a good starting point for looking into writing your own asin-adapter.
32
30
 
33
31
  ```bash
34
32
  gem install asin
35
- gem install curb # optional, see HTTPI
36
33
  ```
37
34
 
38
35
  or in your Gemfile:
39
36
 
40
37
  ```ruby
41
38
  gem 'asin'
42
- gem 'curb' # optional, see HTTPI
43
39
  ```
44
40
 
45
41
  ## Configuration
@@ -86,20 +82,22 @@ items = client.lookup '1430218150'
86
82
 
87
83
  # have a look at the title of the item
88
84
  items.first.item_attributes.title
89
- => Learn Objective-C on the Mac (Learn Series)
85
+ # => Learn Objective-C on the Mac (Learn Series)
90
86
 
91
87
  # search for any kind of stuff on amazon with keywords
92
- items = search_keywords 'Learn', 'Objective-C'
88
+ items = client.search_keywords 'Learn', 'Objective-C'
93
89
  items.first.item_attributes.title
94
- => "Learn Objective-C on the Mac (Learn Series)"
90
+ # => "Learn Objective-C on the Mac (Learn Series)"
95
91
 
96
92
  # search for any kind of stuff on amazon with custom parameters
97
- search :Keywords => 'Learn Objective-C', :SearchIndex => :Books
93
+ items = client.search :Keywords => 'Learn Objective-C', :SearchIndex => :Books
98
94
  items.first.item_attributes.title
99
- => "Learn Objective-C on the Mac (Learn Series)"
95
+ # => "Learn Objective-C on the Mac (Learn Series)"
100
96
 
101
97
  # search for similar items like the one you already have
102
98
  items = client.similar '1430218150'
99
+ items.first.item_attributes.title
100
+ # => "Beginning iOS 7 Development: Exploring the iOS SDK"
103
101
  ```
104
102
 
105
103
  There is an additional set of methods to support AWS cart operations:
@@ -110,17 +108,17 @@ client = ASIN::Client.instance
110
108
  # create a cart with an item
111
109
  cart = client.create_cart({:asin => '1430218150', :quantity => 1})
112
110
  cart.cart_items.cart_item
113
- => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
111
+ # => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
114
112
 
115
113
  # clear everything from the cart
116
114
  cart = client.clear_cart(cart)
117
115
  cart.cart_items.cart_item
118
- => []
116
+ # => []
119
117
 
120
118
  # update items in the cart
121
- cart = client.update_items(cart, {:cart_item_id => cart.items.first.CartItemId, :action => :SaveForLater}, {:cart_item_id => cart.items.first.CartItemId, :quantity => 7})
119
+ cart = client.update_items(cart, {:cart_item_id => cart.items.first.CartItemId, :action => :SaveForLater}, {:cart_item_id # => cart.items.first.CartItemId, :quantity => 7})
122
120
  cart.saved_for_later_items.saved_for_later_item
123
- => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
121
+ # => [<#Hashie::Rash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]
124
122
  ```
125
123
 
126
124
  It's also possible to access browse nodes:
@@ -131,19 +129,9 @@ client = ASIN::Client.instance
131
129
  # create a cart with an item
132
130
  node = client.browse_node('17', :ResponseGroup => :TopSellers)
133
131
  node.first.browse_node_id
134
- => '163357'
132
+ # => '163357'
135
133
  node.first.name
136
- => 'Literature & Fiction'
137
- ```
138
-
139
- ## HTTPI
140
-
141
- ASIN uses [HTTPI](https://github.com/rubiii/httpi) as a HTTP-Client adapter.
142
- See the HTTPI documentation for how to configure different clients or the logger.
143
- As a default HTTPI uses _httpclient_ so you should add that dependency to your project:
144
-
145
- ```ruby
146
- gem 'httpclient'
134
+ # => 'Literature & Fiction'
147
135
  ```
148
136
 
149
137
  ## Confiture
@@ -17,18 +17,15 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency('crack', '>= 0.3')
21
- s.add_dependency('hashie', '>= 1.1')
22
- s.add_dependency('snake_case_hash', '>= 1.0.2')
23
- s.add_dependency('httpi', '>= 0.9')
24
- s.add_dependency('confiture', '>= 0.1')
20
+ s.add_dependency('crack', '>= 0.3')
21
+ s.add_dependency('hashie', '>= 1.1')
22
+ s.add_dependency('snake_case_hash', '>= 1.0.2')
23
+ s.add_dependency('http', '>= 3.0')
24
+ s.add_dependency('confiture', '>= 0.1')
25
25
 
26
- s.add_runtime_dependency('jruby-openssl') if RUBY_PLATFORM == 'java'
27
-
28
- s.add_development_dependency('httpclient', '>= 2.2.3')
29
-
30
- s.add_development_dependency('rake', '~> 0.9.2')
31
- s.add_development_dependency('vcr', '~> 2.2')
32
- s.add_development_dependency('webmock', '~> 1.8')
33
- s.add_development_dependency('rspec', '~> 2.11')
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')
34
31
  end
@@ -138,7 +138,7 @@ module ASIN
138
138
  end
139
139
 
140
140
  def language
141
- item_attributes!.languages.language.first.name
141
+ item_attributes!.languages.language.first['Name']
142
142
  end
143
143
 
144
144
  def formatted_price
@@ -1,4 +1,4 @@
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'
@@ -252,7 +252,7 @@ module ASIN
252
252
  url = "http://#{Configuration.host}#{PATH}?#{signed}"
253
253
  log(:info, "performing rest call to url='#{url}'")
254
254
 
255
- response = HTTPI.get(url)
255
+ response = HTTP.get(url)
256
256
  if response.code == 200
257
257
  # force utf-8 chars, works only on 1.9 string
258
258
  resp = response.body
@@ -1,3 +1,3 @@
1
1
  module ASIN
2
- VERSION = "2.0.2"
2
+ VERSION = "2.1.0"
3
3
  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
@@ -12,13 +12,11 @@ unless Net.const_defined? :HTTPSession
12
12
  end
13
13
 
14
14
  require 'rspec'
15
+ require 'rspec/collection_matchers'
15
16
  require 'asin'
16
- require 'asin/client' # is somehow needed for jruby
17
17
  require 'asin/adapter'
18
- require 'httpclient'
19
18
  require 'vcr'
20
- require 'httpi'
21
-
19
+ require 'byebug'
22
20
 
23
21
  VCR.configure do |config|
24
22
  config.cassette_library_dir = 'spec/cassettes'
@@ -43,8 +41,6 @@ RSpec.configure do |config|
43
41
  end
44
42
 
45
43
  config.before :each do
46
- HTTPI.log = false
47
-
48
44
  ASIN::Configuration.reset!
49
45
  @helper = ASIN::Client.instance
50
46
  @helper.configure :logger => nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.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: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2018-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crack
@@ -53,19 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.2
55
55
  - !ruby/object:Gem::Dependency
56
- name: httpi
56
+ name: http
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.9'
61
+ version: '3.0'
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: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: confiture
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,75 +81,75 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.1'
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
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
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'
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'
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'
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'
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'
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'
152
+ version: '1.1'
153
153
  description: Amazon Simple INterface - Support for ItemLookup, SimilarityLookup, Search,
154
154
  BrowseNode and Cart Operations.
155
155
  email:
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  version: '0'
221
221
  requirements: []
222
222
  rubyforge_project: asin
223
- rubygems_version: 2.5.1
223
+ rubygems_version: 2.6.13
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Amazon Simple INterface - Support for ItemLookup, SimilarityLookup, Search,