rakuten_web_service 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vscode/launch.json +30 -0
- data/.vscode/tasks.json +70 -0
- data/CHANGELOG.md +6 -0
- data/bin/rake +17 -0
- data/bin/rspec +17 -0
- data/lib/rakuten_web_service/books/resource.rb +1 -1
- data/lib/rakuten_web_service/books/total.rb +2 -2
- data/lib/rakuten_web_service/configuration.rb +1 -1
- data/lib/rakuten_web_service/genre.rb +13 -11
- data/lib/rakuten_web_service/gora/course.rb +1 -1
- data/lib/rakuten_web_service/gora/course_detail.rb +2 -2
- 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/kobo/ebook.rb +1 -1
- data/lib/rakuten_web_service/resource.rb +1 -1
- data/lib/rakuten_web_service/search_result.rb +5 -5
- data/lib/rakuten_web_service/version.rb +1 -1
- data/rakuten_web_service.gemspec +2 -0
- data/spec/fixtures/books/book_search_with_keyword_Ruby.json +1002 -1112
- data/spec/fixtures/books/cd_search_with_keyword_Ruby.json +949 -1
- data/spec/fixtures/books/dvd_search_with_keyword_Ruby.json +719 -1
- data/spec/fixtures/books/foreign_book_search_with_keyword_Ruby.json +865 -1
- data/spec/fixtures/books/game_search_with_keyword_Ruby.json +128 -1
- data/spec/fixtures/books/genre_search.json +45 -1
- data/spec/fixtures/books/magazine_search_with_keyword_Ruby.json +938 -1
- data/spec/fixtures/books/software_search_with_keyword_Ruby.json +591 -1
- data/spec/fixtures/books/total_search_with_keyword_Ruby.json +931 -1
- data/spec/fixtures/gora/course_detail_search.json +150 -1
- data/spec/fixtures/gora/course_search_with_Karuizawa.json +459 -1
- data/spec/fixtures/gora/plan_search_with_area_code.json +219 -1
- data/spec/fixtures/ichiba/genre_search.json +192 -1
- data/spec/fixtures/ichiba/item_search_with_keyword_Ruby.json +1468 -1805
- data/spec/fixtures/ichiba/parents_genre_search.json +385 -1
- data/spec/fixtures/ichiba/product_search.json +1774 -1
- data/spec/fixtures/ichiba/ranking_search.json +1290 -1
- data/spec/fixtures/kobo/ebook_search_with_Ruby.json +709 -807
- data/spec/fixtures/kobo/genre_search.json +105 -1
- data/spec/fixtures/recipe/category.json +11769 -1
- data/spec/fixtures/recipe/ranking.json +107 -1
- data/spec/rakuten_web_service/books/book_spec.rb +5 -4
- data/spec/rakuten_web_service/books/cd_spec.rb +3 -2
- data/spec/rakuten_web_service/books/dvd_spec.rb +3 -2
- data/spec/rakuten_web_service/books/foreign_book_spec.rb +3 -2
- data/spec/rakuten_web_service/books/game_spec.rb +3 -2
- data/spec/rakuten_web_service/books/genre_spec.rb +2 -1
- data/spec/rakuten_web_service/books/magazine_spec.rb +3 -2
- data/spec/rakuten_web_service/books/software_spec.rb +3 -2
- data/spec/rakuten_web_service/books/total_spec.rb +2 -1
- data/spec/rakuten_web_service/client_spec.rb +2 -1
- data/spec/rakuten_web_service/gora/course_detail_spec.rb +3 -2
- data/spec/rakuten_web_service/gora/course_spec.rb +3 -1
- data/spec/rakuten_web_service/gora/plan_spec.rb +2 -1
- data/spec/rakuten_web_service/ichiba/genre_spec.rb +40 -15
- data/spec/rakuten_web_service/ichiba/item_spec.rb +4 -3
- data/spec/rakuten_web_service/ichiba/product_search_spec.rb +2 -1
- data/spec/rakuten_web_service/ichiba/ranking_spec.rb +4 -2
- data/spec/rakuten_web_service/ichiba/shop_spec.rb +1 -0
- data/spec/rakuten_web_service/kobo/ebook_spec.rb +2 -2
- data/spec/rakuten_web_service/kobo/genre_spec.rb +1 -0
- data/spec/rakuten_web_service/recipe/category_spec.rb +1 -0
- data/spec/rakuten_web_service/recipe_spec.rb +3 -1
- metadata +34 -2
@@ -1 +1,107 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"result": [
|
3
|
+
{
|
4
|
+
"recipeId": 1720001297,
|
5
|
+
"recipeTitle": "マヨった時は、フライパン1つの「マヨチキン」",
|
6
|
+
"recipeUrl": "http://recipe.rakuten.co.jp/recipe/1720001297/",
|
7
|
+
"foodImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/2ffb60f5f4165b3d60025e2be58ae9c4022aac7a.33.2.3.2.jpg",
|
8
|
+
"mediumImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/2ffb60f5f4165b3d60025e2be58ae9c4022aac7a.33.2.3.2.jpg?thum=54",
|
9
|
+
"smallImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/2ffb60f5f4165b3d60025e2be58ae9c4022aac7a.33.2.3.2.jpg?thum=55",
|
10
|
+
"pickup": 1,
|
11
|
+
"shop": 0,
|
12
|
+
"nickname": "k5b4",
|
13
|
+
"recipeDescription": "下味付けて、フライパンですぐ調理。\n洗いものもなく簡単おいしく。お子様も大好きですよ。",
|
14
|
+
"recipeMaterial": [
|
15
|
+
"鶏むね肉",
|
16
|
+
"マヨネーズ",
|
17
|
+
"片栗粉",
|
18
|
+
"醤油(下味用)",
|
19
|
+
"砂糖(下味用)",
|
20
|
+
"すりおろしニンニク(下味用)",
|
21
|
+
"チリパウダー(カレー粉等)"
|
22
|
+
],
|
23
|
+
"recipeIndication": "約10分",
|
24
|
+
"recipeCost": "100円以下",
|
25
|
+
"recipePublishday": "2011/02/27 14:40:56",
|
26
|
+
"rank": "1"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"recipeId": 1290001623,
|
30
|
+
"recipeTitle": "主人が、いくらでも食べれると絶賛のナス・ピーマン",
|
31
|
+
"recipeUrl": "http://recipe.rakuten.co.jp/recipe/1290001623/",
|
32
|
+
"foodImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/eb2f27f434436225566c034083f98ddf2aaa0a50.50.2.3.2.jpg",
|
33
|
+
"mediumImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/eb2f27f434436225566c034083f98ddf2aaa0a50.50.2.3.2.jpg?thum=54",
|
34
|
+
"smallImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/eb2f27f434436225566c034083f98ddf2aaa0a50.50.2.3.2.jpg?thum=55",
|
35
|
+
"pickup": 1,
|
36
|
+
"shop": 0,
|
37
|
+
"nickname": "ライム2141",
|
38
|
+
"recipeDescription": "お弁当のおかずにと思って作ったら、主人が、お弁当箱の半分のスペースは、これでいいよと言うぐらい絶賛してくれたので、我が家の定番おかずになりました(^^♪",
|
39
|
+
"recipeMaterial": [
|
40
|
+
"長ナス",
|
41
|
+
"ピーマン",
|
42
|
+
"砂糖",
|
43
|
+
"醤油",
|
44
|
+
"ゴマ油orサラダ油",
|
45
|
+
"だしの素",
|
46
|
+
"白いりゴマ"
|
47
|
+
],
|
48
|
+
"recipeIndication": "約10分",
|
49
|
+
"recipeCost": "100円以下",
|
50
|
+
"recipePublishday": "2011/04/01 14:52:17",
|
51
|
+
"rank": "2"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"recipeId": 1390015585,
|
55
|
+
"recipeTitle": "ご飯がすすむ♪ 豚肉となすの味噌炒め☆",
|
56
|
+
"recipeUrl": "http://recipe.rakuten.co.jp/recipe/1390015585/",
|
57
|
+
"foodImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/b9439a7c2fd591879279d91e61d4fb6b09388f27.92.2.3.2.jpg",
|
58
|
+
"mediumImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/b9439a7c2fd591879279d91e61d4fb6b09388f27.92.2.3.2.jpg?thum=54",
|
59
|
+
"smallImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/b9439a7c2fd591879279d91e61d4fb6b09388f27.92.2.3.2.jpg?thum=55",
|
60
|
+
"pickup": 1,
|
61
|
+
"shop": 0,
|
62
|
+
"nickname": "はなまる子♪",
|
63
|
+
"recipeDescription": "ささっと簡単、豚バラ肉と夏野菜の味噌味の炒めものです。 ご飯のおかずに、おつまみにお箸が進みます。",
|
64
|
+
"recipeMaterial": [
|
65
|
+
"豚バラ肉",
|
66
|
+
"なす",
|
67
|
+
"ピーマン",
|
68
|
+
"オリーブオイル",
|
69
|
+
"・・調味料",
|
70
|
+
"A・・",
|
71
|
+
"味噌、酒",
|
72
|
+
"砂糖",
|
73
|
+
"しょうゆ"
|
74
|
+
],
|
75
|
+
"recipeIndication": "約10分",
|
76
|
+
"recipeCost": "300円前後",
|
77
|
+
"recipePublishday": "2013/03/26 16:31:30",
|
78
|
+
"rank": "3"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"recipeId": 1400014946,
|
82
|
+
"recipeTitle": "鶏胸肉で簡単♪手羽風揚げない甘辛照焼チキンお弁当に",
|
83
|
+
"recipeUrl": "http://recipe.rakuten.co.jp/recipe/1400014946/",
|
84
|
+
"foodImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/3e5906a3607b2f1321cda1158b251c4223204420.40.2.3.2.jpg",
|
85
|
+
"mediumImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/3e5906a3607b2f1321cda1158b251c4223204420.40.2.3.2.jpg?thum=54",
|
86
|
+
"smallImageUrl": "http://image.space.rakuten.co.jp/d/strg/ctrl/3/3e5906a3607b2f1321cda1158b251c4223204420.40.2.3.2.jpg?thum=55",
|
87
|
+
"pickup": 1,
|
88
|
+
"shop": 0,
|
89
|
+
"nickname": "*ももら*",
|
90
|
+
"recipeDescription": "鶏胸肉なのにウイング風♬骨が無いので食べ易くお弁当にもピッタリ♡油で揚げないのでヘルシーです♪",
|
91
|
+
"recipeMaterial": [
|
92
|
+
"鶏むね肉",
|
93
|
+
"片栗粉",
|
94
|
+
"塩コショウ",
|
95
|
+
"炒め用サラダ油",
|
96
|
+
"A醤油",
|
97
|
+
"Aみりん",
|
98
|
+
"Aお酒",
|
99
|
+
"A砂糖"
|
100
|
+
],
|
101
|
+
"recipeIndication": "約10分",
|
102
|
+
"recipeCost": "300円前後",
|
103
|
+
"recipePublishday": "2015/09/30 14:28:09",
|
104
|
+
"rank": "4"
|
105
|
+
}
|
106
|
+
]
|
107
|
+
}
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::Book do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
title: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -61,7 +62,7 @@ describe RakutenWebService::Books::Book do
|
|
61
62
|
|
62
63
|
it "have current genre" do
|
63
64
|
expect(subject.current).to be_a(RakutenWebService::Books::Genre)
|
64
|
-
expect(subject.current.item_count).to eq('
|
65
|
+
expect(subject.current.item_count).to eq('119')
|
65
66
|
end
|
66
67
|
end
|
67
68
|
end
|
@@ -82,7 +83,7 @@ describe RakutenWebService::Books::Book do
|
|
82
83
|
specify 'genretes RWS::Books::Genre object' do
|
83
84
|
book = RWS::Books::Book.search(title: 'Ruby').first
|
84
85
|
|
85
|
-
expect(RWS::Books::Genre).to receive(:new).with(response['Items'][0]['
|
86
|
+
expect(RWS::Books::Genre).to receive(:new).with(response['Items'][0]['booksGenreId'])
|
86
87
|
expect(book.genre).to be_a(Array)
|
87
88
|
end
|
88
89
|
|
@@ -104,8 +105,8 @@ describe RakutenWebService::Books::Book do
|
|
104
105
|
|
105
106
|
before do
|
106
107
|
@expected_request = stub_request(:get, endpoint).
|
107
|
-
with(query: { affiliateId: affiliate_id, applicationId: application_id, isbn: '12345' }).
|
108
|
-
to_return(body: { Items: [ {
|
108
|
+
with(query: { affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2', isbn: '12345' }).
|
109
|
+
to_return(body: { Items: [ { title: 'foo' } ] }.to_json)
|
109
110
|
end
|
110
111
|
|
111
112
|
specify 'retrieves automatically if accessing the value of lack attribute' do
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::CD do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -50,8 +51,8 @@ describe RakutenWebService::Books::CD do
|
|
50
51
|
|
51
52
|
before do
|
52
53
|
@expected_request = stub_request(:get, endpoint).
|
53
|
-
with(query: { affiliateId: affiliate_id, applicationId: application_id, jan: '12345' }).
|
54
|
-
to_return(body: { Items: [ {
|
54
|
+
with(query: { affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2', jan: '12345' }).
|
55
|
+
to_return(body: { Items: [ { title: 'foo' } ] }.to_json)
|
55
56
|
end
|
56
57
|
|
57
58
|
specify 'retrieves automatically if accessing the value of lack attribute' do
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::DVD do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -50,8 +51,8 @@ describe RakutenWebService::Books::DVD do
|
|
50
51
|
|
51
52
|
before do
|
52
53
|
@expected_request = stub_request(:get, endpoint).
|
53
|
-
with(query: { affiliateId: affiliate_id, applicationId: application_id, jan: '12345' }).
|
54
|
-
to_return(body: { Items: [ {
|
54
|
+
with(query: { affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2', jan: '12345' }).
|
55
|
+
to_return(body: { Items: [ { title: 'foo' } ] }.to_json)
|
55
56
|
end
|
56
57
|
|
57
58
|
specify 'retrieves automatically if accessing the value of lack attribute' do
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::ForeignBook do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -49,8 +50,8 @@ describe RakutenWebService::Books::ForeignBook do
|
|
49
50
|
|
50
51
|
before do
|
51
52
|
@expected_request = stub_request(:get, endpoint).
|
52
|
-
with(query: { affiliateId: affiliate_id, applicationId: application_id, isbn: '12345' }).
|
53
|
-
to_return(body: { Items: [ {
|
53
|
+
with(query: { affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2', isbn: '12345' }).
|
54
|
+
to_return(body: { Items: [ { title: 'foo' } ] }.to_json)
|
54
55
|
end
|
55
56
|
|
56
57
|
specify 'retrieves automatically if accessing the value of lack attribute' do
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::Game do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -43,8 +44,8 @@ describe RakutenWebService::Books::Game do
|
|
43
44
|
|
44
45
|
before do
|
45
46
|
@expected_request = stub_request(:get, endpoint).
|
46
|
-
with(query: { affiliateId: affiliate_id, applicationId: application_id, jan: '12345' }).
|
47
|
-
to_return(body: { Items: [ {
|
47
|
+
with(query: { affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2', jan: '12345' }).
|
48
|
+
to_return(body: { Items: [ { title: 'foo' } ] }.to_json)
|
48
49
|
end
|
49
50
|
|
50
51
|
specify 'retrieves automatically if accessing the value of lack attribute' do
|
@@ -9,6 +9,7 @@ describe RWS::Books::Genre do
|
|
9
9
|
{
|
10
10
|
affiliateId: affiliate_id,
|
11
11
|
applicationId: application_id,
|
12
|
+
formatVersion: '2',
|
12
13
|
booksGenreId: genre_id
|
13
14
|
}
|
14
15
|
end
|
@@ -97,7 +98,7 @@ describe RWS::Books::Genre do
|
|
97
98
|
specify 'are Books::Genre objects' do
|
98
99
|
expect(@genre.children).to be_all { |child| child.is_a? RWS::Books::Genre }
|
99
100
|
expect(@genre.children).to be_all do |child|
|
100
|
-
expected_json['children'].any? { |c| c['
|
101
|
+
expected_json['children'].any? { |c| c['booksGenreId'] == child['booksGenreId'] }
|
101
102
|
end
|
102
103
|
end
|
103
104
|
end
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::Magazine do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -43,8 +44,8 @@ describe RakutenWebService::Books::Magazine do
|
|
43
44
|
|
44
45
|
before do
|
45
46
|
@expected_request = stub_request(:get, endpoint).
|
46
|
-
with(query: { affiliateId: affiliate_id, applicationId: application_id, jan: '12345' }).
|
47
|
-
to_return(body: { Items: [ {
|
47
|
+
with(query: { affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2', jan: '12345' }).
|
48
|
+
to_return(body: { Items: [ { title: 'foo' } ] }.to_json)
|
48
49
|
end
|
49
50
|
|
50
51
|
specify 'retrieves automatically if accessing the value of lack attribute' do
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::Software do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -43,8 +44,8 @@ describe RakutenWebService::Books::Software do
|
|
43
44
|
|
44
45
|
before do
|
45
46
|
@expected_request = stub_request(:get, endpoint).
|
46
|
-
with(query: { affiliateId: affiliate_id, applicationId: application_id, jan: '12345' }).
|
47
|
-
to_return(body: { Items: [ {
|
47
|
+
with(query: { affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2', jan: '12345' }).
|
48
|
+
to_return(body: { Items: [ { title: 'foo' } ] }.to_json)
|
48
49
|
end
|
49
50
|
|
50
51
|
specify 'retrieves automatically if accessing the value of lack attribute' do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe RakutenWebService::Books::Total do
|
4
4
|
let(:endpoint) { 'https://app.rakuten.co.jp/services/api/BooksTotal/Search/20130522' }
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Books::Total do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: 'Ruby'
|
12
13
|
}
|
13
14
|
end
|
@@ -9,7 +9,7 @@ describe RakutenWebService::Client do
|
|
9
9
|
let(:application_id) { 'default_application_id' }
|
10
10
|
let(:affiliate_id) { 'default_affiliate_id' }
|
11
11
|
let(:expected_query) do
|
12
|
-
{ affiliateId: affiliate_id, applicationId: application_id }
|
12
|
+
{ affiliateId: affiliate_id, applicationId: application_id, formatVersion: '2' }
|
13
13
|
end
|
14
14
|
let(:expected_response) do
|
15
15
|
{ body: '{"status":"ok"}' }
|
@@ -57,6 +57,7 @@ describe RakutenWebService::Client do
|
|
57
57
|
{
|
58
58
|
applicationId: application_id,
|
59
59
|
affiliateId: affiliate_id,
|
60
|
+
formatVersion: '2',
|
60
61
|
sort: sort_option
|
61
62
|
}
|
62
63
|
end
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Gora::CourseDetail do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
golfCourseId: 120092
|
12
13
|
}
|
13
14
|
end
|
@@ -49,12 +50,12 @@ describe RakutenWebService::Gora::CourseDetail do
|
|
49
50
|
|
50
51
|
specify 'should be accessed to ratings' do
|
51
52
|
expect(subject.ratings.size).to eq(expected_json['ratings'].size)
|
52
|
-
expect(subject.ratings.first.nick_name).to eq(expected_json['ratings'].first['
|
53
|
+
expect(subject.ratings.first.nick_name).to eq(expected_json['ratings'].first['nickName'])
|
53
54
|
end
|
54
55
|
|
55
56
|
specify 'should be accessed to new_plans' do
|
56
57
|
expect(subject.new_plans.size).to eq(expected_json['newPlans'].size)
|
57
|
-
expect(subject.new_plans.first.name).to eq(expected_json['newPlans'].first['
|
58
|
+
expect(subject.new_plans.first.name).to eq(expected_json['newPlans'].first['planName'])
|
58
59
|
end
|
59
60
|
end
|
60
61
|
end
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Gora::Course do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
keyword: '軽井沢'
|
12
13
|
}
|
13
14
|
end
|
@@ -22,6 +23,7 @@ describe RakutenWebService::Gora::Course do
|
|
22
23
|
describe '.search' do
|
23
24
|
before do
|
24
25
|
response = JSON.parse(fixture('gora/course_search_with_Karuizawa.json'))
|
26
|
+
response['pageCount'] = 2
|
25
27
|
@expected_request = stub_request(:get, endpoint).
|
26
28
|
with(query: expected_query).to_return(body: response.to_json)
|
27
29
|
|
@@ -45,7 +47,7 @@ describe RakutenWebService::Gora::Course do
|
|
45
47
|
describe 'a respond object' do
|
46
48
|
let(:expected_json) do
|
47
49
|
response = JSON.parse(fixture('gora/course_search_with_Karuizawa.json'))
|
48
|
-
response['Items'][0]
|
50
|
+
response['Items'][0]
|
49
51
|
end
|
50
52
|
|
51
53
|
subject { @courses.first }
|
@@ -8,6 +8,7 @@ describe RakutenWebService::Gora::Plan do
|
|
8
8
|
{
|
9
9
|
affiliateId: affiliate_id,
|
10
10
|
applicationId: application_id,
|
11
|
+
formatVersion: '2',
|
11
12
|
areaCode: '12,14',
|
12
13
|
playDate: '2016-04-24',
|
13
14
|
}
|
@@ -43,7 +44,7 @@ describe RakutenWebService::Gora::Plan do
|
|
43
44
|
describe 'a respond object' do
|
44
45
|
let(:expected_json) do
|
45
46
|
response = JSON.parse(fixture('gora/plan_search_with_area_code.json'))
|
46
|
-
response['Items'][0]
|
47
|
+
response['Items'][0]
|
47
48
|
end
|
48
49
|
|
49
50
|
subject { @plans.first }
|
@@ -9,6 +9,7 @@ describe RakutenWebService::Ichiba::Genre do
|
|
9
9
|
{
|
10
10
|
affiliateId: affiliate_id,
|
11
11
|
applicationId: application_id,
|
12
|
+
formatVersion: '2',
|
12
13
|
genreId: genre_id
|
13
14
|
}
|
14
15
|
end
|
@@ -77,13 +78,17 @@ describe RakutenWebService::Ichiba::Genre do
|
|
77
78
|
before do
|
78
79
|
@expected_request = stub_request(:get, endpoint).
|
79
80
|
with(query: {
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
affiliateId: affiliate_id,
|
82
|
+
applicationId: application_id,
|
83
|
+
formatVersion: '2',
|
84
|
+
genreId: new_genre_id }).
|
85
|
+
to_return(body: {
|
86
|
+
current: {
|
87
|
+
genreId: new_genre_id,
|
88
|
+
genreName: 'DummyGenre',
|
89
|
+
genreLevel: 3
|
90
|
+
}
|
91
|
+
}.to_json)
|
87
92
|
|
88
93
|
@genre = RakutenWebService::Ichiba::Genre.new(new_genre_id)
|
89
94
|
end
|
@@ -116,18 +121,19 @@ describe RakutenWebService::Ichiba::Genre do
|
|
116
121
|
end
|
117
122
|
|
118
123
|
context 'when children of the genre have not been fetched' do
|
119
|
-
let(:target_genre) { expected_json['children'].first
|
124
|
+
let(:target_genre) { expected_json['children'].first }
|
120
125
|
|
121
126
|
before do
|
122
127
|
@additional_request = stub_request(:get, endpoint).
|
123
128
|
with(query: {
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
129
|
+
affiliateId: affiliate_id,
|
130
|
+
applicationId: application_id,
|
131
|
+
formatVersion: '2',
|
132
|
+
genreId: target_genre['genreId']
|
133
|
+
}).to_return(body: {
|
134
|
+
current: target_genre,
|
135
|
+
children: []
|
136
|
+
}.to_json)
|
131
137
|
end
|
132
138
|
|
133
139
|
subject { root_genre.children.first }
|
@@ -159,6 +165,25 @@ describe RakutenWebService::Ichiba::Genre do
|
|
159
165
|
end
|
160
166
|
end
|
161
167
|
|
168
|
+
describe "#brothers" do
|
169
|
+
let(:genre_id) { 559887 }
|
170
|
+
let(:genre) { RakutenWebService::Ichiba::Genre.new(genre_id) }
|
171
|
+
|
172
|
+
before do
|
173
|
+
stub_request(:get, endpoint).with(
|
174
|
+
query: {
|
175
|
+
affiliateId: affiliate_id,
|
176
|
+
aplicationId: application_id,
|
177
|
+
genreId: genre_id
|
178
|
+
}
|
179
|
+
).to_return(body: fixture('ichiba/parents_genre_search.json'))
|
180
|
+
end
|
181
|
+
|
182
|
+
specify "should respond an array of brother Genres" do
|
183
|
+
expect(genre.brothers).to be_a(Array)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
162
187
|
describe '#ranking' do
|
163
188
|
let(:genre) { RakutenWebService::Ichiba::Genre.new(genre_id) }
|
164
189
|
|