rakuten_web_service 1.10.0 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +12 -0
  3. data/.github/workflows/ci.yml +30 -0
  4. data/CHANGELOG.md +103 -48
  5. data/Gemfile +3 -3
  6. data/README.ja.md +118 -48
  7. data/README.md +35 -10
  8. data/examples/ichiba_item_search.rb +1 -1
  9. data/examples/recipe_search.rb +16 -0
  10. data/lib/rakuten_web_service/all_proxy.rb +2 -1
  11. data/lib/rakuten_web_service/books/genre.rb +1 -1
  12. data/lib/rakuten_web_service/books/resource.rb +1 -1
  13. data/lib/rakuten_web_service/books/total.rb +1 -1
  14. data/lib/rakuten_web_service/client.rb +9 -9
  15. data/lib/rakuten_web_service/configuration.rb +0 -16
  16. data/lib/rakuten_web_service/error.rb +5 -0
  17. data/lib/rakuten_web_service/genre.rb +1 -1
  18. data/lib/rakuten_web_service/gora/course.rb +1 -1
  19. data/lib/rakuten_web_service/gora/course_detail.rb +1 -1
  20. data/lib/rakuten_web_service/gora/plan.rb +1 -1
  21. data/lib/rakuten_web_service/ichiba/item.rb +3 -3
  22. data/lib/rakuten_web_service/ichiba/product.rb +1 -1
  23. data/lib/rakuten_web_service/ichiba/ranking.rb +1 -1
  24. data/lib/rakuten_web_service/ichiba/tag.rb +16 -0
  25. data/lib/rakuten_web_service/ichiba/tag_group.rb +23 -0
  26. data/lib/rakuten_web_service/ichiba.rb +2 -0
  27. data/lib/rakuten_web_service/kobo/ebook.rb +1 -1
  28. data/lib/rakuten_web_service/kobo/genre.rb +1 -1
  29. data/lib/rakuten_web_service/recipe/category.rb +3 -1
  30. data/lib/rakuten_web_service/recipe.rb +1 -1
  31. data/lib/rakuten_web_service/resource.rb +29 -20
  32. data/lib/rakuten_web_service/response.rb +5 -4
  33. data/lib/rakuten_web_service/search_result.rb +14 -15
  34. data/lib/rakuten_web_service/travel/area_class.rb +30 -29
  35. data/lib/rakuten_web_service/travel/hotel.rb +3 -1
  36. data/lib/rakuten_web_service/travel/search_result.rb +1 -1
  37. data/lib/rakuten_web_service/version.rb +1 -1
  38. data/lib/rakuten_web_service.rb +17 -1
  39. data/rakuten_web_service.gemspec +6 -4
  40. data/spec/fixtures/ichiba/item_search_with_no_items.json +8 -0
  41. data/spec/fixtures/ichiba/tag_search.json +15 -0
  42. data/spec/rakuten_web_service/configuration_spec.rb +0 -52
  43. data/spec/rakuten_web_service/genre_spec.rb +1 -1
  44. data/spec/rakuten_web_service/ichiba/item_spec.rb +13 -0
  45. data/spec/rakuten_web_service/ichiba/tag_group_spec.rb +68 -0
  46. data/spec/rakuten_web_service/ichiba/tag_spec.rb +35 -0
  47. data/spec/rakuten_web_service/resource_spec.rb +2 -2
  48. data/spec/rakuten_web_service/response_spec.rb +7 -7
  49. data/spec/rakuten_web_service/travel/search_result_spec.rb +4 -4
  50. data/spec/rakuten_web_service_spec.rb +48 -0
  51. metadata +56 -16
  52. data/.travis.yml +0 -46
  53. data/spec/integration/integration_spec.rb +0 -78
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe RakutenWebService::Resource do
4
4
  let(:resource_class) do
5
5
  Class.new(RakutenWebService::Resource) do
6
- set_resource_name 'Dummy'
6
+ self.resource_name = 'Dummy'
7
7
 
8
8
  attribute :name, :dummySampleAttribute
9
9
  end
@@ -23,7 +23,7 @@ describe RakutenWebService::Resource do
23
23
  context 'When some resources are inherited from other resource' do
24
24
  let(:other_resource_class) do
25
25
  Class.new(resource_class) do
26
- set_resource_name 'NestedResource'
26
+ self.resource_name = 'NestedResource'
27
27
 
28
28
  attribute :name, :someOtherAttribute
29
29
  end
@@ -14,9 +14,9 @@ describe RakutenWebService::Response do
14
14
  }
15
15
  end
16
16
 
17
- it { is_expected.to have_next_page }
17
+ it { is_expected.to be_next_page }
18
18
  it { is_expected.to_not be_last_page }
19
- it { is_expected.to_not have_previous_page }
19
+ it { is_expected.to_not be_previous_page }
20
20
  it { is_expected.to be_first_page }
21
21
  end
22
22
  context "When page is equal to pageCount" do
@@ -26,9 +26,9 @@ describe RakutenWebService::Response do
26
26
  }
27
27
  end
28
28
 
29
- it { is_expected.to_not have_next_page }
29
+ it { is_expected.to_not be_next_page }
30
30
  it { is_expected.to be_last_page }
31
- it { is_expected.to have_previous_page }
31
+ it { is_expected.to be_previous_page }
32
32
  it { is_expected.to_not be_first_page }
33
33
  end
34
34
  context "When current page is in pages" do
@@ -38,10 +38,10 @@ describe RakutenWebService::Response do
38
38
  }
39
39
  end
40
40
 
41
- it { is_expected.to have_next_page }
41
+ it { is_expected.to be_next_page }
42
42
  it { is_expected.to_not be_last_page }
43
- it { is_expected.to have_previous_page }
43
+ it { is_expected.to be_previous_page }
44
44
  it { is_expected.to_not be_last_page }
45
45
  end
46
46
  end
47
- end
47
+ end
@@ -10,7 +10,7 @@ describe RakutenWebService::Travel::SearchResult do
10
10
  RakutenWebService::Travel::SearchResult.new({}, resource_class)
11
11
  end
12
12
 
13
- describe '#has_next_page?' do
13
+ describe '#next_page?' do
14
14
  let(:response) do
15
15
  double().tap do |d|
16
16
  allow(d).to receive('[]').with('pagingInfo').and_return(pagingInfo)
@@ -27,7 +27,7 @@ describe RakutenWebService::Travel::SearchResult do
27
27
  end
28
28
 
29
29
  it 'should have next page' do
30
- expect(search_result).to have_next_page
30
+ expect(search_result).to be_next_page
31
31
  end
32
32
  end
33
33
  context 'when current page reaches at the last page' do
@@ -36,7 +36,7 @@ describe RakutenWebService::Travel::SearchResult do
36
36
  end
37
37
 
38
38
  it 'should not have next page' do
39
- expect(search_result).to_not have_next_page
39
+ expect(search_result).to_not be_next_page
40
40
  end
41
41
  end
42
42
  end
@@ -68,4 +68,4 @@ describe RakutenWebService::Travel::SearchResult do
68
68
  expect(search_result.search({})).to be_a(RakutenWebService::Travel::SearchResult)
69
69
  end
70
70
  end
71
- end
71
+ end
@@ -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,15 +1,29 @@
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.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuya Sato
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.3'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -30,28 +44,42 @@ dependencies:
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 12.3.0
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rexml
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
- version: 12.3.0
68
+ version: '3.2'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rspec
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: 3.8.0
75
+ version: '3.9'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: 3.8.0
82
+ version: '3.9'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: tapp
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +114,14 @@ dependencies:
86
114
  requirements:
87
115
  - - "~>"
88
116
  - !ruby/object:Gem::Version
89
- version: 3.5.0
117
+ version: '3.9'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
- version: 3.5.0
124
+ version: '3.9'
97
125
  description: Ruby Client for Rakuten Web Service
98
126
  email:
99
127
  - tatsuya.b.sato@mail.rakuten.com
@@ -102,8 +130,9 @@ extensions: []
102
130
  extra_rdoc_files: []
103
131
  files:
104
132
  - ".codeclimate.yml"
133
+ - ".github/FUNDING.yml"
134
+ - ".github/workflows/ci.yml"
105
135
  - ".gitignore"
106
- - ".travis.yml"
107
136
  - ".vscode/launch.json"
108
137
  - ".vscode/tasks.json"
109
138
  - CHANGELOG.md
@@ -119,6 +148,7 @@ files:
119
148
  - examples/books_item_search.rb
120
149
  - examples/gora_search.rb
121
150
  - examples/ichiba_item_search.rb
151
+ - examples/recipe_search.rb
122
152
  - examples/travel_apis.rb
123
153
  - lib/rakuten_web_service.rb
124
154
  - lib/rakuten_web_service/all_proxy.rb
@@ -148,6 +178,8 @@ files:
148
178
  - lib/rakuten_web_service/ichiba/product.rb
149
179
  - lib/rakuten_web_service/ichiba/ranking.rb
150
180
  - lib/rakuten_web_service/ichiba/shop.rb
181
+ - lib/rakuten_web_service/ichiba/tag.rb
182
+ - lib/rakuten_web_service/ichiba/tag_group.rb
151
183
  - lib/rakuten_web_service/kobo.rb
152
184
  - lib/rakuten_web_service/kobo/ebook.rb
153
185
  - lib/rakuten_web_service/kobo/genre.rb
@@ -179,16 +211,17 @@ files:
179
211
  - spec/fixtures/gora/plan_search_with_area_code.json
180
212
  - spec/fixtures/ichiba/genre_search.json
181
213
  - spec/fixtures/ichiba/item_search_with_keyword_Ruby.json
214
+ - spec/fixtures/ichiba/item_search_with_no_items.json
182
215
  - spec/fixtures/ichiba/parents_genre_search.json
183
216
  - spec/fixtures/ichiba/product_search.json
184
217
  - spec/fixtures/ichiba/ranking_search.json
218
+ - spec/fixtures/ichiba/tag_search.json
185
219
  - spec/fixtures/kobo/ebook_search_with_Ruby.json
186
220
  - spec/fixtures/kobo/genre_search.json
187
221
  - spec/fixtures/recipe/category.json
188
222
  - spec/fixtures/recipe/ranking.json
189
223
  - spec/fixtures/travel/area_class.json
190
224
  - spec/fixtures/travel/simple_hotel_search.json
191
- - spec/integration/integration_spec.rb
192
225
  - spec/rakuten_web_service/books/book_spec.rb
193
226
  - spec/rakuten_web_service/books/cd_spec.rb
194
227
  - spec/rakuten_web_service/books/dvd_spec.rb
@@ -210,6 +243,8 @@ files:
210
243
  - spec/rakuten_web_service/ichiba/product_search_spec.rb
211
244
  - spec/rakuten_web_service/ichiba/ranking_spec.rb
212
245
  - spec/rakuten_web_service/ichiba/shop_spec.rb
246
+ - spec/rakuten_web_service/ichiba/tag_group_spec.rb
247
+ - spec/rakuten_web_service/ichiba/tag_spec.rb
213
248
  - spec/rakuten_web_service/kobo/ebook_spec.rb
214
249
  - spec/rakuten_web_service/kobo/genre_spec.rb
215
250
  - spec/rakuten_web_service/recipe/category_spec.rb
@@ -220,13 +255,14 @@ files:
220
255
  - spec/rakuten_web_service/travel/open_struct_spec.rb
221
256
  - spec/rakuten_web_service/travel/search_result_spec.rb
222
257
  - spec/rakuten_web_service/travel/simple_hotel_search_spec.rb
258
+ - spec/rakuten_web_service_spec.rb
223
259
  - spec/spec_helper.rb
224
260
  - spec/support/fixture_suppot.rb
225
261
  homepage: http://webservice.rakuten.co.jp/
226
262
  licenses:
227
263
  - MIT
228
264
  metadata: {}
229
- post_install_message:
265
+ post_install_message:
230
266
  rdoc_options: []
231
267
  require_paths:
232
268
  - lib
@@ -234,15 +270,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
270
  requirements:
235
271
  - - ">="
236
272
  - !ruby/object:Gem::Version
237
- version: 2.3.0
273
+ version: 2.5.0
238
274
  required_rubygems_version: !ruby/object:Gem::Requirement
239
275
  requirements:
240
276
  - - ">="
241
277
  - !ruby/object:Gem::Version
242
278
  version: '0'
243
279
  requirements: []
244
- rubygems_version: 3.0.1
245
- signing_key:
280
+ rubygems_version: 3.1.6
281
+ signing_key:
246
282
  specification_version: 4
247
283
  summary: Ruby Client for Rakuten Web Service
248
284
  test_files:
@@ -260,16 +296,17 @@ test_files:
260
296
  - spec/fixtures/gora/plan_search_with_area_code.json
261
297
  - spec/fixtures/ichiba/genre_search.json
262
298
  - spec/fixtures/ichiba/item_search_with_keyword_Ruby.json
299
+ - spec/fixtures/ichiba/item_search_with_no_items.json
263
300
  - spec/fixtures/ichiba/parents_genre_search.json
264
301
  - spec/fixtures/ichiba/product_search.json
265
302
  - spec/fixtures/ichiba/ranking_search.json
303
+ - spec/fixtures/ichiba/tag_search.json
266
304
  - spec/fixtures/kobo/ebook_search_with_Ruby.json
267
305
  - spec/fixtures/kobo/genre_search.json
268
306
  - spec/fixtures/recipe/category.json
269
307
  - spec/fixtures/recipe/ranking.json
270
308
  - spec/fixtures/travel/area_class.json
271
309
  - spec/fixtures/travel/simple_hotel_search.json
272
- - spec/integration/integration_spec.rb
273
310
  - spec/rakuten_web_service/books/book_spec.rb
274
311
  - spec/rakuten_web_service/books/cd_spec.rb
275
312
  - spec/rakuten_web_service/books/dvd_spec.rb
@@ -291,6 +328,8 @@ test_files:
291
328
  - spec/rakuten_web_service/ichiba/product_search_spec.rb
292
329
  - spec/rakuten_web_service/ichiba/ranking_spec.rb
293
330
  - spec/rakuten_web_service/ichiba/shop_spec.rb
331
+ - spec/rakuten_web_service/ichiba/tag_group_spec.rb
332
+ - spec/rakuten_web_service/ichiba/tag_spec.rb
294
333
  - spec/rakuten_web_service/kobo/ebook_spec.rb
295
334
  - spec/rakuten_web_service/kobo/genre_spec.rb
296
335
  - spec/rakuten_web_service/recipe/category_spec.rb
@@ -301,5 +340,6 @@ test_files:
301
340
  - spec/rakuten_web_service/travel/open_struct_spec.rb
302
341
  - spec/rakuten_web_service/travel/search_result_spec.rb
303
342
  - spec/rakuten_web_service/travel/simple_hotel_search_spec.rb
343
+ - spec/rakuten_web_service_spec.rb
304
344
  - spec/spec_helper.rb
305
345
  - spec/support/fixture_suppot.rb
data/.travis.yml DELETED
@@ -1,46 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.6
4
- - 2.4.3
5
- - 2.5.0
6
- - 2.6.0
7
- - ruby-head
8
-
9
- env:
10
- - INTEGRATION=yes
11
- - INTEGRATION=no
12
-
13
- group: travis_lts
14
-
15
- cache: bundler
16
-
17
- before_install:
18
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
19
- - chmod +x ./cc-test-reporter
20
- - ./cc-test-reporter before-build
21
- - gem install bundler
22
-
23
- bundler_args: --without vscode
24
-
25
- script:
26
- - bundle exec rake
27
-
28
- after_script:
29
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
30
-
31
- matrix:
32
- allow_failures:
33
- - rvm: ruby-head
34
- exclude:
35
- - rvm: 2.3.6
36
- env: INTEGRATION=yes
37
- - rvm: 2.4.3
38
- env: INTEGRATION=yes
39
- - rvm: ruby-head
40
- env: INTEGRATION=yes
41
-
42
- notifications:
43
- email: false
44
- webhooks:
45
- urls:
46
- - https://webhooks.gitter.im/e/059b85fcc75550b7bc39
@@ -1,78 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Call all APIs', type: 'integration' do
4
- describe RakutenWebService::Ichiba do
5
- it do
6
- expect { RWS::Ichiba::Item.search(keyword: 'Ruby').first }.not_to raise_error
7
- end
8
- it do
9
- expect { RWS::Ichiba::Genre.search(genre_id: 559887).first }.not_to raise_error
10
- end
11
- it do
12
- expect { RWS::Ichiba::Product.search(keyword: 'Ruby').first }.not_to raise_error
13
- end
14
- it do
15
- expect { RWS::Ichiba::RankingItem.search(age: 30, sex: 0).first }.not_to raise_error
16
- end
17
- end
18
-
19
- describe RakutenWebService::Books do
20
- it do
21
- expect { RWS::Books::Total.search(keyword: 'Ruby').first }.not_to raise_error
22
- end
23
- it do
24
- expect { RWS::Books::Book.search(title: 'Ruby').first }.not_to raise_error
25
- end
26
- it do
27
- expect { RWS::Books::CD.search(title: 'Ruby').first }.not_to raise_error
28
- end
29
- it do
30
- expect { RWS::Books::DVD.search(title: 'Ruby').first }.not_to raise_error
31
- end
32
- it do
33
- expect { RWS::Books::ForeignBook.search(title: 'Ruby').first }.not_to raise_error
34
- end
35
- it do
36
- expect { RWS::Books::Magazine.search(title: 'Ruby').first }.not_to raise_error
37
- end
38
- it do
39
- expect { RWS::Books::Game.search(title: 'Ruby').first }.not_to raise_error
40
- end
41
- it do
42
- expect { RWS::Books::Software.search(title: 'Ruby').first }.not_to raise_error
43
- end
44
- it do
45
- expect { RWS::Books::Genre.search(books_genre_id: '001005').first }.not_to raise_error
46
- end
47
- end
48
-
49
- describe RakutenWebService::Recipe do
50
- it do
51
- expect { RWS::Recipe.categories('large') }.not_to raise_error
52
- end
53
- it do
54
- expect { RWS::Recipe.categories('large').first.ranking.first }.not_to raise_error
55
- end
56
- end
57
-
58
- describe RakutenWebService::Kobo do
59
- it do
60
- expect { RWS::Kobo::Ebook.search(keyword: 'Ruby').first }.not_to raise_error
61
- end
62
- it do
63
- expect { RWS::Kobo::Genre.search(kobo_genre_id: 101).first }.not_to raise_error
64
- end
65
- end
66
-
67
- describe RakutenWebService::Gora do
68
- it do
69
- expect { RWS::Gora::Course.search(keyword: 'セグウェイ').first }.not_to raise_error
70
- end
71
- it do
72
- expect { RWS::Gora::CourseDetail.search(golf_course_id: 80004).first }.not_to raise_error
73
- end
74
- xit do
75
- expect { RWS::Gora::Plan.search(playDate: '2017-01-11', areaCode: 0).first }.not_to raise_error
76
- end
77
- end
78
- end