asin 2.1.0 → 3.0.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
- SHA1:
3
- metadata.gz: 2bce335cc98a4e105831d955ac58ef571fa1f787
4
- data.tar.gz: 6edddcd8a872b3cd0e808ad7d77ce5a36f3a400b
2
+ SHA256:
3
+ metadata.gz: a123caf2606ef57b6c970b1cc80762fdec163de3df7cae33ae2b1653cf1576e5
4
+ data.tar.gz: af1d22414d49842b4b37a2d70d4e25cfcbaa470ef9f3665ac2dc3d812a25d368
5
5
  SHA512:
6
- metadata.gz: 40923d103c60cd2ebe4349784c8a470513fc31eb3bc302891cdff7fe8fa67b36aaf57803ffc93523ef08e3e6e13934ed98dad2596c57afbefaa6e565f562e597
7
- data.tar.gz: d248e664238f55980980222a03612a78c4cb3f44658a19f880213d4e2890a75208d0ff741045a90b6d8a76c8a7454d2d88ac42a3ed3287db5e501f7408d14fac
6
+ metadata.gz: bff07d1891750eb61b25e43512b06e68ceb7d13c62ab93af2464b96433a5d0748520f7ced832c523a8fac5bc6ab8eaa61cdb9c8d523fa289d0809b38afec7874
7
+ data.tar.gz: 6c8aca5e617263051bd663229300ef248ed0f09d099700af323865ca9f523799cfa1158f17271182ac1b35d785c0175fb129f4f4e785e30ec68b74686f201e6f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.0.0
2
+
3
+ * drop SCHash and convert keys using activesupport
4
+
1
5
  ## 2.1.0
2
6
 
3
7
  * use the http.rb gem instead of HTTPI adapter
data/Gemfile CHANGED
@@ -5,7 +5,3 @@ gemspec
5
5
  group :development do
6
6
  gem 'byebug', platforms: :ruby
7
7
  end
8
-
9
- group :test do
10
- gem "codeclimate-test-reporter", require: false
11
- end
data/Gemfile.lock CHANGED
@@ -1,71 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asin (2.1.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
9
  http (>= 3.0)
9
- snake_case_hash (>= 1.0.2)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
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)
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)
19
23
  confiture (0.1.4)
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)
24
+ crack (0.4.5)
25
+ rexml
26
+ diff-lcs (1.5.0)
27
+ domain_name (0.5.20190701)
25
28
  unf (>= 0.0.5, < 1.0.0)
26
- hashdiff (0.3.7)
27
- hashie (3.5.7)
28
- http (3.3.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)
29
37
  addressable (~> 2.3)
30
38
  http-cookie (~> 1.0)
31
- http-form_data (~> 2.0)
32
- http_parser.rb (~> 0.6.0)
33
- http-cookie (1.0.3)
39
+ http-form_data (~> 2.2)
40
+ http-parser (~> 1.2.0)
41
+ http-cookie (1.0.4)
34
42
  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)
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)
41
50
  rake (0.9.6)
51
+ rexml (3.2.5)
42
52
  rspec (2.99.0)
43
53
  rspec-core (~> 2.99.0)
44
54
  rspec-expectations (~> 2.99.0)
45
55
  rspec-mocks (~> 2.99.0)
46
- rspec-collection_matchers (1.1.3)
56
+ rspec-collection_matchers (1.2.0)
47
57
  rspec-expectations (>= 2.99.0.beta1)
48
58
  rspec-core (2.99.2)
49
59
  rspec-expectations (2.99.2)
50
60
  diff-lcs (>= 1.1.3, < 2.0)
51
61
  rspec-mocks (2.99.4)
52
- safe_yaml (1.0.4)
53
- simplecov (0.13.0)
54
- docile (~> 1.1.0)
55
- json (>= 1.8, < 3)
56
- simplecov-html (~> 0.10.0)
57
- simplecov-html (0.10.2)
58
- snake_case_hash (1.0.4)
59
- hashie (~> 3.0)
62
+ tzinfo (2.0.4)
63
+ concurrent-ruby (~> 1.0)
60
64
  unf (0.1.4)
61
65
  unf_ext
62
66
  unf (0.1.4-java)
63
- unf_ext (0.0.7.5)
67
+ unf_ext (0.0.8)
64
68
  vcr (4.0.0)
65
- webmock (3.4.2)
66
- addressable (>= 2.3.6)
69
+ webmock (3.14.0)
70
+ addressable (>= 2.8.0)
67
71
  crack (>= 0.3.2)
68
- hashdiff
72
+ hashdiff (>= 0.4.0, < 2.0.0)
69
73
 
70
74
  PLATFORMS
71
75
  java
@@ -74,7 +78,6 @@ PLATFORMS
74
78
  DEPENDENCIES
75
79
  asin!
76
80
  byebug
77
- codeclimate-test-reporter
78
81
  rake (~> 0.9)
79
82
  rspec (~> 2.11)
80
83
  rspec-collection_matchers (~> 1.1)
@@ -82,4 +85,4 @@ DEPENDENCIES
82
85
  webmock (~> 3.4)
83
86
 
84
87
  BUNDLED WITH
85
- 1.16.1
88
+ 2.1.4
data/asin.gemspec CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_dependency('crack', '>= 0.3')
21
21
  s.add_dependency('hashie', '>= 1.1')
22
- s.add_dependency('snake_case_hash', '>= 1.0.2')
23
22
  s.add_dependency('http', '>= 3.0')
24
23
  s.add_dependency('confiture', '>= 0.1')
24
+ s.add_dependency('activesupport', '>= 4.0')
25
25
 
26
26
  s.add_development_dependency('rake', '~> 0.9')
27
27
  s.add_development_dependency('vcr', '~> 4.0')
data/lib/asin/adapter.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module ASIN
2
2
  module Adapter
3
3
  def handle_type(data, type)
4
- Hashie::SCHash.new(data).tap do |schash|
4
+ Response.create(data).tap do |schash|
5
5
  schash.instance_eval do
6
6
  case type
7
7
  when :cart
@@ -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
@@ -138,7 +130,7 @@ module ASIN
138
130
  end
139
131
 
140
132
  def language
141
- item_attributes!.languages.language.first['Name']
133
+ item_attributes!.languages.language.first.name
142
134
  end
143
135
 
144
136
  def formatted_price
@@ -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
@@ -3,7 +3,6 @@ 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 'sc_hash'
7
6
 
8
7
  module ASIN
9
8
  module Client
@@ -216,7 +215,7 @@ module ASIN
216
215
  end
217
216
 
218
217
  def handle_type(data, type)
219
- Hashie::SCHash.new(data)
218
+ Response.create(data)
220
219
  end
221
220
 
222
221
  def create_item_params(items)
@@ -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.1.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
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.1.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: 2018-06-13 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
@@ -39,47 +39,47 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
- name: snake_case_hash
42
+ name: http
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.2
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: 1.0.2
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: http
56
+ name: confiture
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
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: '3.0'
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
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -219,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
220
  - !ruby/object:Gem::Version
220
221
  version: '0'
221
222
  requirements: []
222
- rubyforge_project: asin
223
- rubygems_version: 2.6.13
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,