rakuten_web_service 1.12.0 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +12 -0
- data/.travis.yml +4 -16
- data/CHANGELOG.md +28 -0
- data/Gemfile +3 -3
- data/README.ja.md +118 -48
- data/README.md +30 -6
- data/examples/ichiba_item_search.rb +1 -1
- data/examples/recipe_search.rb +16 -0
- data/lib/rakuten_web_service/all_proxy.rb +2 -1
- data/lib/rakuten_web_service/books/genre.rb +1 -1
- data/lib/rakuten_web_service/books/resource.rb +1 -1
- data/lib/rakuten_web_service/books/total.rb +1 -1
- data/lib/rakuten_web_service/client.rb +9 -9
- data/lib/rakuten_web_service/error.rb +5 -0
- data/lib/rakuten_web_service/genre.rb +1 -1
- data/lib/rakuten_web_service/gora/course.rb +1 -1
- data/lib/rakuten_web_service/gora/course_detail.rb +1 -1
- data/lib/rakuten_web_service/gora/plan.rb +1 -1
- data/lib/rakuten_web_service/ichiba/item.rb +1 -1
- data/lib/rakuten_web_service/ichiba/product.rb +1 -1
- data/lib/rakuten_web_service/ichiba/ranking.rb +1 -1
- data/lib/rakuten_web_service/ichiba/tag.rb +5 -0
- data/lib/rakuten_web_service/ichiba/tag_group.rb +2 -6
- data/lib/rakuten_web_service/kobo/ebook.rb +1 -1
- data/lib/rakuten_web_service/kobo/genre.rb +1 -1
- data/lib/rakuten_web_service/recipe.rb +1 -1
- data/lib/rakuten_web_service/recipe/category.rb +3 -1
- data/lib/rakuten_web_service/resource.rb +29 -20
- data/lib/rakuten_web_service/response.rb +5 -4
- data/lib/rakuten_web_service/search_result.rb +14 -15
- data/lib/rakuten_web_service/travel/area_class.rb +28 -22
- data/lib/rakuten_web_service/travel/hotel.rb +3 -1
- data/lib/rakuten_web_service/travel/search_result.rb +1 -1
- data/lib/rakuten_web_service/version.rb +1 -1
- data/rakuten_web_service.gemspec +6 -4
- data/spec/rakuten_web_service/genre_spec.rb +1 -1
- data/spec/rakuten_web_service/ichiba/tag_spec.rb +17 -0
- data/spec/rakuten_web_service/resource_spec.rb +2 -2
- data/spec/rakuten_web_service/response_spec.rb +7 -7
- data/spec/rakuten_web_service/travel/search_result_spec.rb +4 -4
- metadata +43 -15
- data/spec/integration/integration_spec.rb +0 -81
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rakuten_web_service/travel/resource'
|
2
4
|
|
3
5
|
module RakutenWebService
|
@@ -5,7 +7,7 @@ module RakutenWebService
|
|
5
7
|
class Hotel < RakutenWebService::Travel::Resource
|
6
8
|
endpoint 'https://app.rakuten.co.jp/services/api/Travel/SimpleHotelSearch/20170426'
|
7
9
|
|
8
|
-
|
10
|
+
parser do |response|
|
9
11
|
response['hotels'].map do |hotel_info|
|
10
12
|
Hotel.new(hotel_info)
|
11
13
|
end
|
data/rakuten_web_service.gemspec
CHANGED
@@ -15,12 +15,14 @@ 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.
|
18
|
+
spec.required_ruby_version = '>= 2.5.0'
|
19
19
|
|
20
|
+
spec.add_dependency 'json', '~> 2.3'
|
20
21
|
spec.add_development_dependency 'bundler'
|
21
|
-
spec.add_development_dependency 'rake', '~>
|
22
|
-
spec.add_development_dependency '
|
22
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
23
|
+
spec.add_development_dependency 'rexml', '~> 3.2'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
23
25
|
spec.add_development_dependency 'tapp', '~> 1.5.1'
|
24
26
|
spec.add_development_dependency 'terminal-table', '~> 1.8.0'
|
25
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
27
|
+
spec.add_development_dependency 'webmock', '~> 3.9'
|
26
28
|
end
|
@@ -42,7 +42,7 @@ describe RakutenWebService::BaseGenre do
|
|
42
42
|
|
43
43
|
Class.new(RakutenWebService::BaseGenre) do
|
44
44
|
endpoint "https://api.example.com/dummy_genre"
|
45
|
-
|
45
|
+
self.resource_name = 'dummy_genre'
|
46
46
|
root_id 0
|
47
47
|
attribute :dummyGenreId, :dummyGenreName, :genreLevel
|
48
48
|
end
|
@@ -15,4 +15,21 @@ describe RakutenWebService::Ichiba::Tag do
|
|
15
15
|
expect(tag['parentTagId']).to eq(1)
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
describe '#search' do
|
20
|
+
context 'When no given additional parameters' do
|
21
|
+
specify 'it calls Ichiba::Item.search with its tag id' do
|
22
|
+
expect(RWS::Ichiba::Item).to receive(:search).with({tagId: params['tagId']}).and_return([])
|
23
|
+
|
24
|
+
tag.search
|
25
|
+
end
|
26
|
+
end
|
27
|
+
context 'When given required parameter' do
|
28
|
+
specify 'it calls Ichiba::Item.search with the given parameters and its tag id' do
|
29
|
+
expect(RWS::Ichiba::Item).to receive(:search).with({keyword: 'Ruby', tagId: params['tagId']}).and_return([])
|
30
|
+
|
31
|
+
tag.search(keyword: 'Ruby')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
18
35
|
end
|
@@ -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
|
-
|
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
|
-
|
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
|
17
|
+
it { is_expected.to be_next_page }
|
18
18
|
it { is_expected.to_not be_last_page }
|
19
|
-
it { is_expected.to_not
|
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
|
29
|
+
it { is_expected.to_not be_next_page }
|
30
30
|
it { is_expected.to be_last_page }
|
31
|
-
it { is_expected.to
|
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
|
41
|
+
it { is_expected.to be_next_page }
|
42
42
|
it { is_expected.to_not be_last_page }
|
43
|
-
it { is_expected.to
|
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 '#
|
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
|
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
|
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
|
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.
|
4
|
+
version: 1.13.0
|
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:
|
11
|
+
date: 2020-10-15 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:
|
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:
|
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.
|
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.
|
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.
|
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.
|
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,6 +130,7 @@ extensions: []
|
|
102
130
|
extra_rdoc_files: []
|
103
131
|
files:
|
104
132
|
- ".codeclimate.yml"
|
133
|
+
- ".github/FUNDING.yml"
|
105
134
|
- ".gitignore"
|
106
135
|
- ".travis.yml"
|
107
136
|
- ".vscode/launch.json"
|
@@ -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
|
@@ -191,7 +221,6 @@ files:
|
|
191
221
|
- spec/fixtures/recipe/ranking.json
|
192
222
|
- spec/fixtures/travel/area_class.json
|
193
223
|
- spec/fixtures/travel/simple_hotel_search.json
|
194
|
-
- spec/integration/integration_spec.rb
|
195
224
|
- spec/rakuten_web_service/books/book_spec.rb
|
196
225
|
- spec/rakuten_web_service/books/cd_spec.rb
|
197
226
|
- spec/rakuten_web_service/books/dvd_spec.rb
|
@@ -232,7 +261,7 @@ homepage: http://webservice.rakuten.co.jp/
|
|
232
261
|
licenses:
|
233
262
|
- MIT
|
234
263
|
metadata: {}
|
235
|
-
post_install_message:
|
264
|
+
post_install_message:
|
236
265
|
rdoc_options: []
|
237
266
|
require_paths:
|
238
267
|
- lib
|
@@ -240,15 +269,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
269
|
requirements:
|
241
270
|
- - ">="
|
242
271
|
- !ruby/object:Gem::Version
|
243
|
-
version: 2.
|
272
|
+
version: 2.5.0
|
244
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
274
|
requirements:
|
246
275
|
- - ">="
|
247
276
|
- !ruby/object:Gem::Version
|
248
277
|
version: '0'
|
249
278
|
requirements: []
|
250
|
-
rubygems_version: 3.
|
251
|
-
signing_key:
|
279
|
+
rubygems_version: 3.1.2
|
280
|
+
signing_key:
|
252
281
|
specification_version: 4
|
253
282
|
summary: Ruby Client for Rakuten Web Service
|
254
283
|
test_files:
|
@@ -276,7 +305,6 @@ test_files:
|
|
276
305
|
- spec/fixtures/recipe/ranking.json
|
277
306
|
- spec/fixtures/travel/area_class.json
|
278
307
|
- spec/fixtures/travel/simple_hotel_search.json
|
279
|
-
- spec/integration/integration_spec.rb
|
280
308
|
- spec/rakuten_web_service/books/book_spec.rb
|
281
309
|
- spec/rakuten_web_service/books/cd_spec.rb
|
282
310
|
- spec/rakuten_web_service/books/dvd_spec.rb
|
@@ -1,81 +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
|
-
it do
|
18
|
-
expect { RWS::Ichiba::TagGroup.search(tagId: 1000317).first.tags }.not_to raise_error
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe RakutenWebService::Books do
|
23
|
-
it do
|
24
|
-
expect { RWS::Books::Total.search(keyword: 'Ruby').first }.not_to raise_error
|
25
|
-
end
|
26
|
-
it do
|
27
|
-
expect { RWS::Books::Book.search(title: 'Ruby').first }.not_to raise_error
|
28
|
-
end
|
29
|
-
it do
|
30
|
-
expect { RWS::Books::CD.search(title: 'Ruby').first }.not_to raise_error
|
31
|
-
end
|
32
|
-
it do
|
33
|
-
expect { RWS::Books::DVD.search(title: 'Ruby').first }.not_to raise_error
|
34
|
-
end
|
35
|
-
it do
|
36
|
-
expect { RWS::Books::ForeignBook.search(title: 'Ruby').first }.not_to raise_error
|
37
|
-
end
|
38
|
-
it do
|
39
|
-
expect { RWS::Books::Magazine.search(title: 'Ruby').first }.not_to raise_error
|
40
|
-
end
|
41
|
-
it do
|
42
|
-
expect { RWS::Books::Game.search(title: 'Ruby').first }.not_to raise_error
|
43
|
-
end
|
44
|
-
it do
|
45
|
-
expect { RWS::Books::Software.search(title: 'Ruby').first }.not_to raise_error
|
46
|
-
end
|
47
|
-
it do
|
48
|
-
expect { RWS::Books::Genre.search(books_genre_id: '001005').first }.not_to raise_error
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe RakutenWebService::Recipe do
|
53
|
-
it do
|
54
|
-
expect { RWS::Recipe.categories('large') }.not_to raise_error
|
55
|
-
end
|
56
|
-
it do
|
57
|
-
expect { RWS::Recipe.categories('large').first.ranking.first }.not_to raise_error
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe RakutenWebService::Kobo do
|
62
|
-
it do
|
63
|
-
expect { RWS::Kobo::Ebook.search(keyword: 'Ruby').first }.not_to raise_error
|
64
|
-
end
|
65
|
-
it do
|
66
|
-
expect { RWS::Kobo::Genre.search(kobo_genre_id: 101).first }.not_to raise_error
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe RakutenWebService::Gora do
|
71
|
-
it do
|
72
|
-
expect { RWS::Gora::Course.search(keyword: 'セグウェイ').first }.not_to raise_error
|
73
|
-
end
|
74
|
-
it do
|
75
|
-
expect { RWS::Gora::CourseDetail.search(golf_course_id: 80004).first }.not_to raise_error
|
76
|
-
end
|
77
|
-
xit do
|
78
|
-
expect { RWS::Gora::Plan.search(playDate: '2017-01-11', areaCode: 0).first }.not_to raise_error
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|