rakuten_web_service 1.10.0 → 1.11.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
  SHA256:
3
- metadata.gz: 415917a50517faaba6319b58c399fa8b52685d3116725e32152592a87f6e89ea
4
- data.tar.gz: c6fd00ef38214d6008dd2db3417dccf066cdf4ae1f1243a9249413e4d3dac1e0
3
+ metadata.gz: ed9f7ae4ab29a8e7fbfc3ffd5fe037dbe1d4f136766ec20b6ded70546ae70025
4
+ data.tar.gz: 0e43fe72a9805aff0b60ce70c3eca8a072fafbcc537ac8cf2dca56250dfdd579
5
5
  SHA512:
6
- metadata.gz: 070ae2ea7f6ca3c0877d4ec36d4f13012ba0c7b990dfd4591694d5e278f83352be927966e91714378da1140b8538eadcdcf9e8b1ebfc8aefb32456849f397780
7
- data.tar.gz: 7911a4ca4d7927477e683290948316e49290de31cc7fd02380437564f38ebbe7af3c05d47b92316e5fb91e5ff3f0488ad6f4d71d1dfbfd2c5ae2f08b7145928f
6
+ metadata.gz: 5c613c66feb43d62f5ad0515c72a93bbcf0b7df98f1da0a6a3eb3a3e53c75fd4917f19d07ace63f440c4c9e93558c2409330569f0dcf6a0f6ef6e1fe241b80b3
7
+ data.tar.gz: da198c232b7be05b180eef34e9a5c278618e7e2eba9405d437b70aed65f938f3af79a1c00c808c3be9d2cc3c2821017f7a25c4421e204fb95c82cd997d9433f5
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.6
4
3
  - 2.4.3
5
4
  - 2.5.0
6
5
  - 2.6.0
@@ -32,10 +31,10 @@ matrix:
32
31
  allow_failures:
33
32
  - rvm: ruby-head
34
33
  exclude:
35
- - rvm: 2.3.6
36
- env: INTEGRATION=yes
37
34
  - rvm: 2.4.3
38
35
  env: INTEGRATION=yes
36
+ - rvm: 2.5.0
37
+ env: INTEGRATION=yes
39
38
  - rvm: ruby-head
40
39
  env: INTEGRATION=yes
41
40
 
data/CHANGELOG.md CHANGED
@@ -1,168 +1,176 @@
1
- # v1.10.0
1
+ # CHANGELOG
2
2
 
3
- ## Enhancements
3
+ ## v1.11.0 (2019/07/11)
4
+
5
+ ### Improvements
6
+
7
+ * Drop ruby 2.3 from supported ruby versions. [#104](https://github.com/rakuten-ws/rws-ruby-sdk/pull/104)
8
+ * Fixes some issues reported by CoceClimate [#108](https://github.com/rakuten-ws/rws-ruby-sdk/pull/108)
9
+ * `RWS.configuration` no longer accepsts block [#107](https://github.com/rakuten-ws/rws-ruby-sdk/pull/107)
10
+
11
+ ## v1.10.0 (2019/03/11)
12
+
13
+ ### Enhancements
4
14
 
5
15
  * Starts Support of two Travel APIs: SimpleHotelSearch and GetAreaClass. [#91](https://github.com/rakuten-ws/rws-ruby-sdk/pull/91)
6
16
 
7
- # v1.9.2 (2018/12/28)
17
+ ## v1.9.2 (2018/12/28)
8
18
 
9
- ## Enhancements
19
+ ### Enhancements
10
20
 
11
21
  * Ruby 2.6 has been released :tada: this version joined the supported versions! [#100](https://github.com/rakuten-ws/rws-ruby-sdk/pull/100)
12
22
 
13
- # v1.9.1 (2018/03/30)
23
+ ## v1.9.1 (2018/03/30)
14
24
 
15
- ## Improvements
25
+ ### Improvements
16
26
 
17
27
  * Use the magic comment to frozen all string literals.[#93](https://github.com/rakuten-ws/rws-ruby-sdk/pull/93)
18
28
  * Drop ruby 2.2 from supported ruby versions since it goes to the EOL. [#95](https://github.com/rakuten-ws/rws-ruby-sdk/pull/95)
19
29
 
20
- # v1.9.0 (2018/01/04)
30
+ ## v1.9.0 (2018/01/04)
21
31
 
22
- ## Enhancements
32
+ ### Enhancements
23
33
 
24
34
  * Update supported API versions. [#87](https://github.com/rakuten-ws/rws-ruby-sdk/pull/87)
25
35
 
26
- # v1.8.0 (2017/12/30)
36
+ ## v1.8.0 (2017/12/30)
27
37
 
28
- ## Enhancements
38
+ ### Enhancements
29
39
 
30
40
  * Add `RWS::Resource#attributes` method. [#85](https://github.com/rakuten-ws/rws-ruby-sdk/pull/85)
31
41
 
32
- ## Improvements
42
+ ### Improvements
33
43
 
34
44
  * Start supporting Ruby 2.5 and drop 2.1 from supported versions. [#83](https://github.com/rakuten-ws/rws-ruby-sdk/pull/83)
35
45
  * Update outdated gems. [#84](https://github.com/rakuten-ws/rws-ruby-sdk/pull/84)
36
46
 
37
- # v1.7.0 (2017/09/17)
47
+ ## v1.7.0 (2017/09/17)
38
48
 
39
- ## Enhancements
49
+ ### Enhancements
40
50
 
41
51
  * Add Helpers for pagination. [#78](https://github.com/rakuten-ws/rws-ruby-sdk/pull/78)
42
52
 
43
- ## Improvements
53
+ ### Improvements
44
54
 
45
55
  * Minor fix for README.ja.md [#77](https://github.com/rakuten-ws/rws-ruby-sdk/pull/77)
46
56
  * Suppressing installing gems required for debugging with VSCode in CI. [#79](https://github.com/rakuten-ws/rws-ruby-sdk/pull/79)
47
57
 
48
- ## Thanks
58
+ ### Thanks
49
59
 
50
60
  I'm pleasured to say thanks to @jinco13. He fixed wrong method names and links in README.ja.md.
51
61
 
52
- # v1.6.1 (2017/08/21)
62
+ ## v1.6.1 (2017/08/21)
53
63
 
54
- ## Bug Fix
64
+ ### Bug Fix
55
65
 
56
66
  * `RakutenWebService::Ichiba::Genre#brothers` always returns an empty array. [#75](https://github.com/rakuten-ws/rws-ruby-sdk/pull/75)
57
67
 
58
- # v1.6.0 (2017/08/16)
68
+ ## v1.6.0 (2017/08/16)
59
69
 
60
- ## Improvements
70
+ ### Improvements
61
71
 
62
72
  * Added `RakutenWebService::BaseGenre#brothers`. [#74](https://github.com/rakuten-ws/rws-ruby-sdk/pull/74)
63
73
 
64
- # v1.5.0 (2017/03/31)
74
+ ## v1.5.0 (2017/03/31)
65
75
 
66
- ## Improvements
76
+ ### Improvements
67
77
 
68
78
  * Allows to call `RakutenWebService::Recipe.ranking` without `category_id`. [#70](https://github.com/rakuten-ws/rws-ruby-sdk/pull/70)
69
79
 
70
- ## Thanks
80
+ ### Thanks
71
81
 
72
82
  I'm pleasured to say thanks to @kakakakakku. His work has made the usage of `RWS::Recipe.raning` easy to get the ranking in all genres.
73
83
  Thanks!
74
84
 
75
- # v1.4.2 (2017/01/22)
85
+ ## v1.4.2 (2017/01/22)
76
86
 
77
- ## Bug Fixes
87
+ ### Bug Fixes
78
88
 
79
89
  * `Net::HTTP` is NOT `reuquire`d anywhere in the codebase. [#67](https://github.com/rakuten-ws/rws-ruby-sdk/pull/67)
80
90
 
81
91
  The version 1.4.1 or earlier of this gem doesn't `require 'net/http'` by itself.
82
92
  @gouf found the bug report in [teratail](https://teratail.com/questions/62804) and made a pull-request to fix it. Thanks!
83
93
 
84
- ## Improvements
94
+ ### Improvements
85
95
 
86
96
  * `debug_mode` has come again! if you want to see responses from Rakuten Web Service APIs, you can see the ones by set `debug_mode` `true`. [#56](https://github.com/rakuten-ws/rws-ruby-sdk/pull/56)
87
97
  * Refactoring: use new Hash syntax as supporting ruby 1.9 series has been stopped already. [#60](https://github.com/rakuten-ws/rws-ruby-sdk/pull/60)
88
98
 
89
- # v1.4.1 (2016/11/22)
99
+ ## v1.4.1 (2016/11/22)
90
100
 
91
- ## Bug Fix
101
+ ### Bug Fix
92
102
 
93
103
  * Fixed: `WrongParameter` raises when giving any `sort` option to `RakutenWebService::Resource.serch`. [#54](https://github.com/rakuten-ws/rws-ruby-sdk/pull/54)
94
104
 
95
- ## Thanks
105
+ ### Thanks
96
106
 
97
107
  I'm pleased to say thanks to @sho-yamane since he reported the bug #53. If he didn't do it, I would find the bug much later.
98
108
  Thanks, @sho-yamane.
99
109
 
110
+ ## v1.4.0 (2016/11/11)
100
111
 
101
- # v1.4.0 (2016/11/11)
102
-
103
- ## Enhancements
112
+ ### Enhancements
104
113
 
105
114
  * Raise RuntimeError if required option `application_id` is not set when generating parameters. [#51](https://github.com/rakuten-ws/rws-ruby-sdk/pull/51)
106
115
 
116
+ ## v1.3.0 (2016/11/08)
107
117
 
108
- # v1.3.0 (2016/11/08)
109
-
110
- ## Enhancements
118
+ ### Enhancements
111
119
 
112
120
  * Loads Application ID and Affiliate ID from environment varaibles `RWS_APPLICATION_ID` and `RWS_AFFILIATE_ID` respectively. [#47](https://github.com/rakuten-ws/rws-ruby-sdk/pull/47)
113
121
 
114
- ## Improvements
122
+ ### Improvements
115
123
 
116
124
  * Upgraded `codeclimate-test-reporter`. [#48](https://github.com/rakuten-ws/rws-ruby-sdk/pull/48)
117
125
 
118
- # v1.2.0 (2016/10/25)
126
+ ## v1.2.0 (2016/10/25)
119
127
 
120
- ## Ehancements
128
+ ### Ehancements
121
129
 
122
130
  * Started supporting GenreInformation. [#45](https://github.com/rakuten-ws/rws-ruby-sdk/pull/45)
123
131
  * `RakutenWebService::BaseGenre#parent` returns Genre object of the parent genre. [#44](https://github.com/rakuten-ws/rws-ruby-sdk/pull/44)
124
132
 
125
- # v1.1.1 (2016/09/12)
133
+ ## v1.1.1 (2016/09/12)
126
134
 
127
- ## Bug Fix
135
+ ### Bug Fix
128
136
 
129
137
  * Fixed `RakutenWebService::Ichiba::Genre#ranking` ignores given options to be passed to Ichiba Ranking API. [#43](https://github.com/rakuten-ws/rws-ruby-sdk/pull/43)
130
138
 
131
- # v1.1.0 (2016/09/12)
139
+ ## v1.1.0 (2016/09/12)
132
140
 
133
- ## Enhancements
141
+ ### Enhancements
134
142
 
135
143
  * Remove the dependency on faraday, using `Net::HTTP`. [#39](https://github.com/rakuten-ws/rws-ruby-sdk/pull/39)
136
144
  * Allows users to rescue any exception with `RakutenWebService::Error` which is a superclass of all the error class like `RakutenWebService::NotFound`. [#41](https://github.com/rakuten-ws/rws-ruby-sdk/pull/41)
137
145
 
138
- # v1.0.0 (2016/07/29)
146
+ ## v1.0.0 (2016/07/29)
139
147
 
140
- ## Enhancements
148
+ ### Enhancements
141
149
 
142
150
  * Upgrade the version of RSpec and refactoring the configuration. [#36](https://github.com/rakuten-ws/rws-ruby-sdk/pull/36) and [#37](https://github.com/rakuten-ws/rws-ruby-sdk/pull/36)
143
151
 
144
- # v1.0.0.rc1
152
+ ## v1.0.0.rc1
145
153
 
146
- ## Enhancements
154
+ ### Enhancements
147
155
 
148
156
  * Started supporting Gora APIs by @kamatama41 .[#29](https://github.com/rakuten-ws/rws-ruby-sdk/pull/29)
149
157
  * Started supporting Recipe APIs. [#31](https://github.com/rakuten-ws/rws-ruby-sdk/pull/31)
150
158
  * Updated versions of supported Rakuten Web Service APIs.
151
159
 
152
- ## Compatibility Changes
160
+ ### Compatibility Changes
153
161
 
154
162
  * Updated supported Ruby versions to 2.1.0 or later
155
163
  * Any resource's `search` such as `RakutenWebService::Ichiba::Item` returns Enumerator which provides resources fetched at one page.
156
164
  It used to provide all resources by auto-pagerize. From this version provides methods for pagerizing. Please refer to [the sample in README](https://github.com/rakuten-ws/rws-ruby-sdk/blob/master/README.md#pagerizing).
157
165
  * Deprecated calling `RakutenWebService.configuration` with a block, recommending to use `RakutenWebService.configure`.
158
166
 
159
- ## Thanks
167
+ ### Thanks
160
168
 
161
169
  At first, I should appreciate all users of the gems.
162
170
  One of the enhancements, supporting Gora APIs, is realized by @kamatama41 's seminal work.
163
171
  Thank you for your contribution!
164
172
 
165
- # v0.6.3 (2015/07/03)
173
+ ## v0.6.3 (2015/07/03)
166
174
 
167
175
  * Update a gem dependency by @45deg
168
176
  * Fix typo by @45deg
data/README.md CHANGED
@@ -57,12 +57,12 @@ If you have not got it, register your application [here](https://webservice.raku
57
57
 
58
58
  ### Configuration
59
59
 
60
- At first, you have to specify your application's key. And you can tell the client your afiiliate id with `RakutenWebService.configuration`.
60
+ At first, you have to specify your application's key. And you can tell the client your afiiliate id with `RakutenWebService.configure`.
61
61
 
62
62
  #### In Your Code
63
63
 
64
64
  ```ruby
65
- RakutenWebService.configuration do |c|
65
+ RakutenWebService.configure do |c|
66
66
  # (Required) Appliction ID for your application.
67
67
  c.application_id = 'YOUR_APPLICATION_ID'
68
68
 
@@ -1,6 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RakutenWebService; end
3
+ require 'rakuten_web_service/configuration'
4
+
5
+ module RakutenWebService
6
+ def configure(&block)
7
+ raise ArgumentError, 'Block is required' unless block
8
+ raise ArgumentError, 'Block is required to have one argument' if block.arity != 1
9
+ yield configuration
10
+
11
+ configuration
12
+ end
13
+
14
+ def configuration
15
+ @configuration ||= Configuration.new
16
+ end
17
+
18
+ module_function :configure, :configuration
19
+ end
4
20
  RWS = RakutenWebService
5
21
 
6
22
  require 'rakuten_web_service/ichiba'
@@ -41,20 +41,4 @@ module RakutenWebService
41
41
  end
42
42
  end
43
43
  end
44
-
45
- def configure(&block)
46
- @configuration ||= Configuration.new
47
- if block
48
- raise ArgumentError, 'Block is required to have one argument' if block.arity != 1
49
- yield @configuration
50
- end
51
- @configuration
52
- end
53
-
54
- def configuration(&block)
55
- warn 'Warning: RakutenWebService.configuration is deprecated. Use RakutenWebService.configure.' if block_given?
56
- configure(&block)
57
- end
58
-
59
- module_function :configure, :configuration
60
44
  end
@@ -3,7 +3,7 @@ require 'rakuten_web_service/travel/resource'
3
3
  module RakutenWebService
4
4
  module Travel
5
5
  module AreaClass
6
- def search(options={})
6
+ def search(options = {})
7
7
  Base.search(options)
8
8
  end
9
9
 
@@ -14,13 +14,7 @@ module RakutenWebService
14
14
  DetailClass[class_code]
15
15
  end
16
16
  module_function :search, :[]
17
- end
18
- end
19
- end
20
17
 
21
- module RakutenWebService
22
- module Travel
23
- module AreaClass
24
18
  class Base < RakutenWebService::Travel::Resource
25
19
  endpoint 'https://app.rakuten.co.jp/services/api/Travel/GetAreaClass/20131024'
26
20
 
@@ -66,22 +60,23 @@ module RakutenWebService
66
60
 
67
61
  attr_reader :parent, :children
68
62
 
69
- def initialize(data, parent=nil)
63
+ def initialize(data, parent = nil)
70
64
  @parent = parent
71
65
  class_data = data
72
66
  @params, @children = *(case class_data
73
- when Array
74
- class_data.first(2)
75
- when Hash
76
- [class_data, nil]
77
- end)
78
-
79
- if !(children.nil?) and !(children.empty?)
80
- children_class = children.keys.map { |k| k[/\A(\w*)Classes\Z/, 1] }.first rescue data.tapp
81
- @params["#{children_class}Classes"] = children["#{children_class}Classes"].map do |child_data|
67
+ when Array
68
+ class_data.first(2)
69
+ when Hash
70
+ [class_data, nil]
71
+ end)
72
+
73
+ if !children.nil? && !children.empty?
74
+ children_class = children.keys.first[/\A(\w*)Classes\Z/, 1]
75
+ class_name = "#{children_class}Classes"
76
+ @params[class_name] = children[class_name].map do |child_data|
82
77
  Base.area_classes[children_class].new(child_data["#{children_class}Class"], self)
83
78
  end
84
- @children = @params["#{children_class}Classes"]
79
+ @children = @params[class_name]
85
80
  else
86
81
  @children = []
87
82
  end
@@ -105,7 +100,7 @@ module RakutenWebService
105
100
  query
106
101
  end
107
102
 
108
- def search(params={})
103
+ def search(params = {})
109
104
  params = to_query.merge(params)
110
105
 
111
106
  Hotel.search(params)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RakutenWebService
4
- VERSION = '1.10.0'.freeze
4
+ VERSION = '1.11.0'.freeze
5
5
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.files = `git ls-files`.split($/)
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ['lib']
18
- spec.required_ruby_version = '>= 2.3.0'
18
+ spec.required_ruby_version = '>= 2.4.0'
19
19
 
20
20
  spec.add_development_dependency 'bundler'
21
21
  spec.add_development_dependency 'rake', '~> 12.3.0'
@@ -23,58 +23,6 @@ describe RakutenWebService::Configuration do
23
23
  end
24
24
  end
25
25
 
26
- describe '.configure' do
27
- context 'given block has one arity' do
28
- before do
29
- RakutenWebService.configure do |c|
30
- c.affiliate_id = 'dummy_affiliate_id'
31
- c.application_id = 'dummy_application_id'
32
- end
33
- end
34
-
35
- subject { RakutenWebService.configuration }
36
-
37
- describe '#affiliate_id' do
38
- subject { super().affiliate_id }
39
- it { is_expected.to eq('dummy_affiliate_id') }
40
- end
41
-
42
- describe '#application_id' do
43
- subject { super().application_id }
44
- it { is_expected.to eq('dummy_application_id') }
45
- end
46
- end
47
-
48
- context 'given block has more or less one arity' do
49
- specify 'raise ArgumentError' do
50
- expect do
51
- RakutenWebService.configure do
52
- end
53
- end.to raise_error(ArgumentError)
54
-
55
- expect do
56
- RakutenWebService.configure do |c, _|
57
- c.affiliate_id = 'dummy_affiliate_id'
58
- c.application_id = 'dummy_application_id'
59
- end
60
- end.to raise_error(ArgumentError)
61
- end
62
- end
63
- end
64
-
65
- describe '.configuration' do
66
- context 'When calling with a block' do
67
- specify 'should show warning message' do
68
- $stderr = StringIO.new
69
- RakutenWebService.configuration do |c|
70
- c.application_id = 'dummy_affiliate_id'
71
- end
72
- expect($stderr.string).to match(/Warning: /)
73
- $stderr = STDERR
74
- end
75
- end
76
- end
77
-
78
26
  describe '#debug_mode?' do
79
27
  let(:configuration) { RakutenWebService.configuration }
80
28
 
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe RakutenWebService do
4
+ describe '.configure' do
5
+ context 'given block has one arity' do
6
+ before do
7
+ RakutenWebService.configure do |c|
8
+ c.affiliate_id = 'dummy_affiliate_id'
9
+ c.application_id = 'dummy_application_id'
10
+ end
11
+ end
12
+
13
+ subject { RakutenWebService.configuration }
14
+
15
+ describe '#affiliate_id' do
16
+ subject { super().affiliate_id }
17
+ it { is_expected.to eq('dummy_affiliate_id') }
18
+ end
19
+
20
+ describe '#application_id' do
21
+ subject { super().application_id }
22
+
23
+ it { is_expected.to eq('dummy_application_id') }
24
+ end
25
+ end
26
+
27
+ context 'given block has more or less one arity' do
28
+ specify 'raise ArgumentError' do
29
+ expect do
30
+ RakutenWebService.configure do
31
+ end
32
+ end.to raise_error(ArgumentError)
33
+
34
+ expect do
35
+ RakutenWebService.configure do |c, _|
36
+ c.affiliate_id = 'dummy_affiliate_id'
37
+ c.application_id = 'dummy_application_id'
38
+ end
39
+ end.to raise_error(ArgumentError)
40
+ end
41
+ end
42
+ context 'call without block' do
43
+ specify 'raise ArgumentError' do
44
+ expect { RakutenWebService.configure }.to raise_error(ArgumentError)
45
+ end
46
+ end
47
+ end
48
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakuten_web_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuya Sato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -220,6 +220,7 @@ files:
220
220
  - spec/rakuten_web_service/travel/open_struct_spec.rb
221
221
  - spec/rakuten_web_service/travel/search_result_spec.rb
222
222
  - spec/rakuten_web_service/travel/simple_hotel_search_spec.rb
223
+ - spec/rakuten_web_service_spec.rb
223
224
  - spec/spec_helper.rb
224
225
  - spec/support/fixture_suppot.rb
225
226
  homepage: http://webservice.rakuten.co.jp/
@@ -234,14 +235,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
235
  requirements:
235
236
  - - ">="
236
237
  - !ruby/object:Gem::Version
237
- version: 2.3.0
238
+ version: 2.4.0
238
239
  required_rubygems_version: !ruby/object:Gem::Requirement
239
240
  requirements:
240
241
  - - ">="
241
242
  - !ruby/object:Gem::Version
242
243
  version: '0'
243
244
  requirements: []
244
- rubygems_version: 3.0.1
245
+ rubygems_version: 3.0.3
245
246
  signing_key:
246
247
  specification_version: 4
247
248
  summary: Ruby Client for Rakuten Web Service
@@ -301,5 +302,6 @@ test_files:
301
302
  - spec/rakuten_web_service/travel/open_struct_spec.rb
302
303
  - spec/rakuten_web_service/travel/search_result_spec.rb
303
304
  - spec/rakuten_web_service/travel/simple_hotel_search_spec.rb
305
+ - spec/rakuten_web_service_spec.rb
304
306
  - spec/spec_helper.rb
305
307
  - spec/support/fixture_suppot.rb