rakuten_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +14 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +151 -0
- data/Rakefile +1 -0
- data/examples/show_ranking.rb +20 -0
- data/lib/rakuten_api/base/client.rb +41 -0
- data/lib/rakuten_api/base/item.rb +55 -0
- data/lib/rakuten_api/base/model.rb +41 -0
- data/lib/rakuten_api/base/params.rb +72 -0
- data/lib/rakuten_api/base/response.rb +39 -0
- data/lib/rakuten_api/configuration.rb +27 -0
- data/lib/rakuten_api/dummy_module.rb +6 -0
- data/lib/rakuten_api/error.rb +14 -0
- data/lib/rakuten_api/genre_search/client.rb +41 -0
- data/lib/rakuten_api/genre_search/model.rb +22 -0
- data/lib/rakuten_api/genre_search/response.rb +43 -0
- data/lib/rakuten_api/item_ranking/client.rb +29 -0
- data/lib/rakuten_api/item_ranking/model.rb +17 -0
- data/lib/rakuten_api/item_ranking/response.rb +57 -0
- data/lib/rakuten_api/item_search/client.rb +34 -0
- data/lib/rakuten_api/item_search/model.rb +15 -0
- data/lib/rakuten_api/item_search/response.rb +71 -0
- data/lib/rakuten_api/version.rb +3 -0
- data/lib/rakuten_api.rb +45 -0
- data/rakuten_api.gemspec +24 -0
- data/spec/fixtures/vcr_cassettes/genre_search_response.yml +75 -0
- data/spec/fixtures/vcr_cassettes/genre_search_response_0.yml +75 -0
- data/spec/fixtures/vcr_cassettes/genre_search_response_551169.yml +62 -0
- data/spec/fixtures/vcr_cassettes/genre_search_response_551172.yml +62 -0
- data/spec/fixtures/vcr_cassettes/item_ranking_error_response.yml +56 -0
- data/spec/fixtures/vcr_cassettes/item_ranking_response.yml +853 -0
- data/spec/fixtures/vcr_cassettes/item_ranking_response_next_ranking.yml +789 -0
- data/spec/fixtures/vcr_cassettes/item_ranking_response_prev_ranking.yml +853 -0
- data/spec/fixtures/vcr_cassettes/item_search_response.yml +116 -0
- data/spec/fixtures/vcr_cassettes/item_search_response_next_page.yml +89 -0
- data/spec/fixtures/vcr_cassettes/item_search_response_prev_page.yml +107 -0
- data/spec/rakuten_api/base/params_spec.rb +42 -0
- data/spec/rakuten_api/genre_search/client_spec.rb +37 -0
- data/spec/rakuten_api/genre_search/model_spec.rb +32 -0
- data/spec/rakuten_api/genre_search/response_spec.rb +47 -0
- data/spec/rakuten_api/item_ranking/client_spec.rb +19 -0
- data/spec/rakuten_api/item_ranking/model_spec.rb +19 -0
- data/spec/rakuten_api/item_ranking/response_spec.rb +64 -0
- data/spec/rakuten_api/item_search/client_spec.rb +35 -0
- data/spec/rakuten_api/item_search/model_spec.rb +33 -0
- data/spec/rakuten_api/item_search/response_spec.rb +73 -0
- data/spec/spec_helper.rb +34 -0
- metadata +181 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://app.rakuten.co.jp/services/api/IchibaItem/Search/20120723?applicationId=16d8dfe13fde99ac5479d789764d2f7a&hits=2&keyword=%E3%82%8A%E3%82%93%E3%81%94
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- ! '*/*'
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: !binary |-
|
20
|
+
T0s=
|
21
|
+
headers:
|
22
|
+
!binary "RGF0ZQ==":
|
23
|
+
- !binary |-
|
24
|
+
TW9uLCAxOCBGZWIgMjAxMyAxMjo1MzoxNiBHTVQ=
|
25
|
+
!binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
|
26
|
+
- !binary |-
|
27
|
+
Kg==
|
28
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
29
|
+
- !binary |-
|
30
|
+
bm8tc3RvcmU=
|
31
|
+
!binary "Q29udGVudC1UeXBl":
|
32
|
+
- !binary |-
|
33
|
+
YXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04
|
34
|
+
!binary "Q29udGVudC1MYW5ndWFnZQ==":
|
35
|
+
- !binary |-
|
36
|
+
amEtSlA=
|
37
|
+
!binary "VmFyeQ==":
|
38
|
+
- !binary |-
|
39
|
+
QWNjZXB0LUVuY29kaW5n
|
40
|
+
!binary "Q29udGVudC1FbmNvZGluZw==":
|
41
|
+
- !binary |-
|
42
|
+
Z3ppcA==
|
43
|
+
!binary "Q29udGVudC1MZW5ndGg=":
|
44
|
+
- !binary |-
|
45
|
+
Mjc4MQ==
|
46
|
+
!binary "Q29ubmVjdGlvbg==":
|
47
|
+
- !binary |-
|
48
|
+
Y2xvc2U=
|
49
|
+
body:
|
50
|
+
encoding: ASCII-8BIT
|
51
|
+
string: !binary |-
|
52
|
+
H4sIAAAAAAAAA+VZW08bSRb+K5afZrVZ8I0QIq12R9GulJed0czsw2qUjBxi
|
53
|
+
wBPAyJhJRlGkvhiDL2BIjM3FhGvAmNjmlsEYx/wXiuq2n/gLe86ptt3GjhJp
|
54
|
+
JtmHlYB0V1edy3dOnfpO5bm13zcxGrDe7XH22PpuWcfcgx7rXfst64DXPx6g
|
55
|
+
p2E3PjhuWYe8gXF66Hf7/V6P33rXJhbcEyLsNni/H/CMwKwfn9OT9e5zqxf+
|
56
|
+
/Zd7BMRamXLA1H2mbvDt3erxa4fNbrPUVl9qW3k9HdMTWxamRJjyiskJeHrH
|
57
|
+
1GMmv2PyooVJc9X5MJMzTIG/y2K058kgkySmLjBlg6llpq4zaR5m1iRZSy7p
|
58
|
+
wQ34SyNSU6qhjDQ15dOUTaaqTE2BfRamLjOlwFQZZsBLFicqJxbtdUrLzlp+
|
59
|
+
vJTOQQJPH+grJ6CMyXkmrzFF5nMxbfPwqjjD44UHYMh3974F/VbEK9A/1O8b
|
60
|
+
+xUhaDfwI9ZZ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AZM/ZKWwUlSjQWD43Y7SgpssRkKYn
|
107
|
+
FnGjyhmkwagOCtIcU/cIiTNsfYJZFAL1A/A4BPhj1cMIL8RIQsYIOGySmyVC
|
108
|
+
adaQxgPUhVyBtK/h/ZGi1HKTPLKiLwcNNMwtV+iUuLu4FDE5K64c2prnlgYb
|
109
|
+
DCNppCiO8UE3gw0XSMIWXY3lUFdJrcuptOHcLP4i/rDLoFnU0mu1pTlAXlw6
|
110
|
+
8OkDfVXCSzTQdRJ01KRDqA3NrtskBYzWwpB1WdFJaMkz7XiBepr6pu5crnLN
|
111
|
+
Svkxmi9KaHe9hH5pkm+or3Myb2B8QPC/XkdP7x17O+/9HQzwQ7p6gQb2OL6Q
|
112
|
+
LuQhjp7Pzec/FdbfT6s/FdTPqOkGpP/n1N3udLo6UPce5x/F3e0t3P0GPbzx
|
113
|
+
H1NUz3fFK1BcKKGtzF7E9NN4vRH/zqz+wYv/ApHbaPcYHAAA
|
114
|
+
http_version:
|
115
|
+
recorded_at: Mon, 18 Feb 2013 12:53:16 GMT
|
116
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://app.rakuten.co.jp/services/api/IchibaItem/Search/20120723?applicationId=16d8dfe13fde99ac5479d789764d2f7a&hits=2&keyword=%E3%82%8A%E3%82%93%E3%81%94&page=2
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- ! '*/*'
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: !binary |-
|
20
|
+
T0s=
|
21
|
+
headers:
|
22
|
+
!binary "RGF0ZQ==":
|
23
|
+
- !binary |-
|
24
|
+
TW9uLCAxOCBGZWIgMjAxMyAxMzo1NDo0NSBHTVQ=
|
25
|
+
!binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
|
26
|
+
- !binary |-
|
27
|
+
Kg==
|
28
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
29
|
+
- !binary |-
|
30
|
+
bm8tc3RvcmU=
|
31
|
+
!binary "Q29udGVudC1UeXBl":
|
32
|
+
- !binary |-
|
33
|
+
YXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04
|
34
|
+
!binary "Q29udGVudC1MYW5ndWFnZQ==":
|
35
|
+
- !binary |-
|
36
|
+
amEtSlA=
|
37
|
+
!binary "VmFyeQ==":
|
38
|
+
- !binary |-
|
39
|
+
QWNjZXB0LUVuY29kaW5n
|
40
|
+
!binary "Q29udGVudC1FbmNvZGluZw==":
|
41
|
+
- !binary |-
|
42
|
+
Z3ppcA==
|
43
|
+
!binary "Q29udGVudC1MZW5ndGg=":
|
44
|
+
- !binary |-
|
45
|
+
MTU3NA==
|
46
|
+
!binary "Q29ubmVjdGlvbg==":
|
47
|
+
- !binary |-
|
48
|
+
Y2xvc2U=
|
49
|
+
body:
|
50
|
+
encoding: ASCII-8BIT
|
51
|
+
string: !binary |-
|
52
|
+
H4sIAAAAAAAAA+1WXU8TWRj+K5u5cpMG+glKstk1ZDfxZt3s6sVmI2YsA8za
|
53
|
+
r0wHwRiTOTNtpVClaKGiRXABKa1tYVvWAhX+i4cz0175F/Y9Z9ppC5i9UdeY
|
54
|
+
knSYc8573o/n/ZjnHucNTgZkbsjj8jjtNi7EjwvckNPGjYlSGLZdNs7H0xe3
|
55
|
+
jZsQ5TA78/KSJAoSN9S8MGyqcNhhfUUW/CD1xz32xg3d40T4/zPvB7UcVpKk
|
56
|
+
WtWr2w0F6UvLRuQlPLGyYJSXyMErhwseJ8cr9WwNq3tYK2O0h9HTb0jxH3JQ
|
57
|
+
MFJZhx2rBawVsDqL1ScYpTAq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
@@ -0,0 +1,107 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://app.rakuten.co.jp/services/api/IchibaItem/Search/20120723?applicationId=16d8dfe13fde99ac5479d789764d2f7a&hits=2&keyword=%E3%82%8A%E3%82%93%E3%81%94&page=1
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- ! '*/*'
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: !binary |-
|
20
|
+
T0s=
|
21
|
+
headers:
|
22
|
+
!binary "RGF0ZQ==":
|
23
|
+
- !binary |-
|
24
|
+
TW9uLCAxOCBGZWIgMjAxMyAxMzo1OTo0MCBHTVQ=
|
25
|
+
!binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
|
26
|
+
- !binary |-
|
27
|
+
Kg==
|
28
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
29
|
+
- !binary |-
|
30
|
+
bm8tc3RvcmU=
|
31
|
+
!binary "Q29udGVudC1UeXBl":
|
32
|
+
- !binary |-
|
33
|
+
YXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04
|
34
|
+
!binary "Q29udGVudC1MYW5ndWFnZQ==":
|
35
|
+
- !binary |-
|
36
|
+
amEtSlA=
|
37
|
+
!binary "VmFyeQ==":
|
38
|
+
- !binary |-
|
39
|
+
QWNjZXB0LUVuY29kaW5n
|
40
|
+
!binary "Q29udGVudC1FbmNvZGluZw==":
|
41
|
+
- !binary |-
|
42
|
+
Z3ppcA==
|
43
|
+
!binary "Q29udGVudC1MZW5ndGg=":
|
44
|
+
- !binary |-
|
45
|
+
MjM2Nw==
|
46
|
+
!binary "Q29ubm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z4hNAh8chjW+BOHiscCbEbQqGIyN2b3KyXn5cgnbNjuH9mSsseZL
|
98
|
+
cxFs5LBCHlm5HN6FrgR99qS+4tRXSxBxe2UfH1IC0jeKNKb4+NYuiu23t3bR
|
99
|
+
0ync3drBVwAHhxYdp/ALEgzzP4/Q8AQ2zKozQT+Aw1XkKzLdPKNzU3yjBf9X
|
100
|
+
Mkv2jYIWYkZ6lfucs2LdeHqdD0X2FZmos3dvgSwVJ8n7n5Ahfo2B9MrkWX3u
|
101
|
+
suH5+C0Y8EIHdGLK3thhLGqoiZTlyz26m2TDCXh1Wa9pnccBLFUbkWYawxFj
|
102
|
+
EvmdA4LNU20BqET+x4Lra88Idgz1uu4WOwWv6OZ9xNvV1dXp/qwdu7lQwdsB
|
103
|
+
PYQLbfe6BK9wX+jnbdp/WPn/von+YdX/z/uoKHYJTfqo0P5lGqmZvaAbs6zY
|
104
|
+
r6dvt1Cb435fF7V7unkjffTqP6HK1yiLFwAA
|
105
|
+
http_version:
|
106
|
+
recorded_at: Mon, 18 Feb 2013 13:59:40 GMT
|
107
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RakutenApi::Base::Params do
|
6
|
+
describe '#normalize' do
|
7
|
+
shared_examples "should normalize" do |value, expect|
|
8
|
+
it { described_class.new.normalize(value).should eql expect }
|
9
|
+
end
|
10
|
+
context "String" do
|
11
|
+
it_behaves_like "should normalize", 'foo', 'foo'
|
12
|
+
it_behaves_like "should normalize", 'foo_bar', 'fooBar'
|
13
|
+
it_behaves_like "should normalize", 'foo_bar_baz', 'fooBarBaz'
|
14
|
+
end
|
15
|
+
|
16
|
+
context "Symbol" do
|
17
|
+
it_behaves_like "should normalize", :foo, 'foo'
|
18
|
+
it_behaves_like "should normalize", :foo_bar, 'fooBar'
|
19
|
+
it_behaves_like "should normalize", :foo_bar_baz, 'fooBarBaz'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#add_param' do
|
24
|
+
let(:obj) { described_class.new }
|
25
|
+
context "valid param" do
|
26
|
+
before {
|
27
|
+
obj.add_param(:application_id, 'foo')
|
28
|
+
}
|
29
|
+
it { obj[:application_id].should eql 'foo' }
|
30
|
+
it { obj['applicationId'].should eql 'foo' }
|
31
|
+
it { obj.to_hash.should be_include 'applicationId' }
|
32
|
+
it { obj.to_hash.should_not be_include 'application_id' }
|
33
|
+
end
|
34
|
+
|
35
|
+
context "invalid param" do
|
36
|
+
before {
|
37
|
+
obj.invalid_params_action = :raise
|
38
|
+
}
|
39
|
+
it { lambda { obj.add_param(:app_id, 'foo') }.should raise_error(RakutenApi::Error) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RakutenApi::GenreSearch::Client do
|
6
|
+
let(:client) {
|
7
|
+
described_class.new do |params|
|
8
|
+
params.add_param :genre_id, 0
|
9
|
+
end
|
10
|
+
}
|
11
|
+
|
12
|
+
describe '#request' do
|
13
|
+
let(:response) {
|
14
|
+
VCR.use_cassette('genre_search_response') do
|
15
|
+
client.request
|
16
|
+
end
|
17
|
+
}
|
18
|
+
it { response.should be_kind_of RakutenApi::GenreSearch::Response }
|
19
|
+
context :current do
|
20
|
+
subject { response.current }
|
21
|
+
it { should be_kind_of RakutenApi::GenreSearch::Model }
|
22
|
+
its(:genre_id) { should eql 0 }
|
23
|
+
its(:genre_name) { should eql '' }
|
24
|
+
its(:genre_level) { should eql 0 }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.root_categories' do
|
29
|
+
let(:response) {
|
30
|
+
VCR.use_cassette('genre_search_response') do
|
31
|
+
described_class.root_categories
|
32
|
+
end
|
33
|
+
}
|
34
|
+
it { response.should be_kind_of Array }
|
35
|
+
it { response.first.should be_kind_of RakutenApi::GenreSearch::Model }
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RakutenApi::GenreSearch::Model do
|
6
|
+
describe ".from_hash" do
|
7
|
+
let(:data) {
|
8
|
+
{
|
9
|
+
'genreId' => '1000',
|
10
|
+
'genreName' => 'foo',
|
11
|
+
'genreLevel' => '1'
|
12
|
+
}
|
13
|
+
}
|
14
|
+
subject { described_class.from_hash(data) }
|
15
|
+
its(:genre_id) { should eql 1000 }
|
16
|
+
its(:genre_name) { should eql 'foo' }
|
17
|
+
its(:genre_level) { should eql 1 }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#to_hash" do
|
21
|
+
subject {
|
22
|
+
described_class.new.tap do |o|
|
23
|
+
o.genre_id = 1
|
24
|
+
o.genre_name = 'foo'
|
25
|
+
o.genre_level = 20
|
26
|
+
end.to_hash
|
27
|
+
}
|
28
|
+
its([:genre_id]) { should eql 1 }
|
29
|
+
its([:genre_name]) { should eql 'foo' }
|
30
|
+
its([:genre_level]) { should eql 20 }
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RakutenApi::GenreSearch::Response do
|
6
|
+
let(:client) {
|
7
|
+
RakutenApi::GenreSearch::Client.new do |params|
|
8
|
+
params.add_param :genre_id, genre_id
|
9
|
+
end
|
10
|
+
}
|
11
|
+
|
12
|
+
let(:response) {
|
13
|
+
VCR.use_cassette('genre_search_response_' + genre_id.to_s) do
|
14
|
+
client.get
|
15
|
+
end
|
16
|
+
}
|
17
|
+
|
18
|
+
context 'root_category' do
|
19
|
+
let(:genre_id) { 0 }
|
20
|
+
subject { described_class.new(response) }
|
21
|
+
its(:status) { should eql 200 }
|
22
|
+
its(:body) { should be }
|
23
|
+
its(:children) { should be_kind_of Array }
|
24
|
+
its('children.first') { should be_kind_of RakutenApi::GenreSearch::Model }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'level 1 category' do
|
28
|
+
let(:genre_id) { 551169 }
|
29
|
+
let(:obj) { described_class.new(response) }
|
30
|
+
it { obj.parents.should eql [] }
|
31
|
+
it { obj.children.should be_kind_of Array }
|
32
|
+
it { obj.current.genre_level.should eql 1 }
|
33
|
+
end
|
34
|
+
|
35
|
+
context "level 2 category" do
|
36
|
+
let(:genre_id) { 551172 }
|
37
|
+
let(:obj) { described_class.new(response) }
|
38
|
+
context '#parents' do
|
39
|
+
subject { obj.parents }
|
40
|
+
it { should be_kind_of Array }
|
41
|
+
context "first" do
|
42
|
+
subject { obj.parents.first }
|
43
|
+
its(:genre_level) { should eql 1 }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
describe RakutenApi::ItemRanking::Client do
|
7
|
+
let(:client) {
|
8
|
+
described_class.new
|
9
|
+
}
|
10
|
+
describe '#get' do
|
11
|
+
let(:response) {
|
12
|
+
VCR.use_cassette('item_ranking_response') do
|
13
|
+
client.get
|
14
|
+
end
|
15
|
+
}
|
16
|
+
it { response.should be_kind_of ::Faraday::Response }
|
17
|
+
it { JSON.parse(response.body)['title'].should eql "【楽天市場】ランキング市場 【総合】" }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RakutenApi::ItemRanking::Model do
|
6
|
+
describe '.from_hash' do
|
7
|
+
context "ItemRankingData" do
|
8
|
+
let(:hash_data) {
|
9
|
+
{
|
10
|
+
"rank" => 10,
|
11
|
+
"carrier" => 1,
|
12
|
+
}
|
13
|
+
}
|
14
|
+
subject { described_class.from_hash(hash_data) }
|
15
|
+
its(:rank) { should eql 10 }
|
16
|
+
its(:carrier) { should eql 1 }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RakutenApi::ItemRanking::Response do
|
6
|
+
let(:client) { RakutenApi::ItemRanking::Client.new }
|
7
|
+
let(:response) {
|
8
|
+
VCR.use_cassette('item_ranking_response') do
|
9
|
+
client.get
|
10
|
+
end
|
11
|
+
}
|
12
|
+
|
13
|
+
describe '#initialize' do
|
14
|
+
let(:obj) { described_class.new(response) }
|
15
|
+
it { obj.title.should == '【楽天市場】ランキング市場 【総合】' }
|
16
|
+
it { obj.last_build_date.should be_kind_of DateTime }
|
17
|
+
it { obj.page.should eql 1 }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#simple_mapping' do
|
21
|
+
let(:obj) { described_class.new(response).simple_mapping }
|
22
|
+
it { obj.should be_kind_of Array }
|
23
|
+
it { obj.first.should be_kind_of ::RakutenApi::ItemRanking::Model }
|
24
|
+
# 基本30件だが、出てこない場合がある様子
|
25
|
+
# xit {
|
26
|
+
# obj.each_with_index do |o, i|
|
27
|
+
# o.rank.should == i + 1
|
28
|
+
# end
|
29
|
+
# }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#next_ranking' do
|
33
|
+
let(:obj) { described_class.new(response, client.params) }
|
34
|
+
let(:next_ranking) {
|
35
|
+
VCR.use_cassette('item_ranking_response_next_ranking') do
|
36
|
+
obj.next_ranking
|
37
|
+
end
|
38
|
+
}
|
39
|
+
it { next_ranking.should be_kind_of ::RakutenApi::ItemRanking::Response }
|
40
|
+
it { next_ranking.page.should eql 2 }
|
41
|
+
|
42
|
+
describe '#prev_ranking' do
|
43
|
+
let(:prev_ranking) {
|
44
|
+
VCR.use_cassette('item_ranking_response_prev_ranking') do
|
45
|
+
next_ranking.prev_ranking
|
46
|
+
end
|
47
|
+
}
|
48
|
+
it { prev_ranking.should be_kind_of ::RakutenApi::ItemRanking::Response }
|
49
|
+
it { prev_ranking.page.should eql 1 }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'error_response' do
|
54
|
+
let(:error_response) {
|
55
|
+
client.add_param :page, 0
|
56
|
+
VCR.use_cassette('item_ranking_error_response') do
|
57
|
+
client.request
|
58
|
+
end
|
59
|
+
}
|
60
|
+
it { error_response.should be_kind_of ::RakutenApi::ItemRanking::Response }
|
61
|
+
it { error_response.should be_error }
|
62
|
+
it { error_response.error_message.should == 'wrong_parameter: page must be over 1' }
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
describe RakutenApi::ItemSearch::Client do
|
7
|
+
let(:client) {
|
8
|
+
described_class.new do |params|
|
9
|
+
params.add_param :keyword, 'りんご'
|
10
|
+
params.add_param :hits, 2
|
11
|
+
end
|
12
|
+
}
|
13
|
+
describe '#get' do
|
14
|
+
let(:response) {
|
15
|
+
VCR.use_cassette('item_search_response') do
|
16
|
+
client.get
|
17
|
+
end
|
18
|
+
}
|
19
|
+
it { response.should be_kind_of ::Faraday::Response }
|
20
|
+
it { JSON.parse(response.body)['hits'].should eql 2 }
|
21
|
+
|
22
|
+
it "bad request" do
|
23
|
+
described_class.new.get.status.should eql 400
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#request' do
|
28
|
+
let(:response) {
|
29
|
+
VCR.use_cassette('item_search_response') do
|
30
|
+
client.request
|
31
|
+
end
|
32
|
+
}
|
33
|
+
it { response.should be_kind_of ::RakutenApi::ItemSearch::Response }
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RakutenApi::ItemSearch::Model do
|
6
|
+
describe '.from_hash' do
|
7
|
+
context "BooleanData" do
|
8
|
+
let(:hash_data) {
|
9
|
+
{
|
10
|
+
"imageFlag" => 1,
|
11
|
+
"availability" => 1,
|
12
|
+
"taxFlag" => 0,
|
13
|
+
"postageFlag" => 1,
|
14
|
+
"creditCardFlag" => 1,
|
15
|
+
"shopOfTheYearFlag"=> 0,
|
16
|
+
"shipOverseasFlag"=> 0,
|
17
|
+
"asurakuFlag"=> 0,
|
18
|
+
"giftFlag" => 0,
|
19
|
+
}
|
20
|
+
}
|
21
|
+
subject { described_class.from_hash(hash_data) }
|
22
|
+
its(:image_flag) { should be_true }
|
23
|
+
its(:availability) { should be_true }
|
24
|
+
its(:tax_flag) { should be_false }
|
25
|
+
its(:postage_flag) { should be_true }
|
26
|
+
its(:credit_card_flag) { should be_true }
|
27
|
+
its(:shop_of_the_year_flag) { should be_false }
|
28
|
+
its(:ship_overseas_flag) { should be_false }
|
29
|
+
its(:asuraku_flag) { should be_false }
|
30
|
+
its(:gift_flag) { should be_false }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|