rakuten_web_service 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTVjZWM1MjZhMWRmZDZhMzZkYmZhZThjNjJiZGE1NzNkZjNmYTYyMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjUzZDE3YzY0NGQxYjVjOTdmOGQ1ODAzYzU5Yzc2ZGI3MjhiNzZiYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTY4NDM0OGQwZmEyYTc3MzE2YjJhZDA4MGRjYWQwYjQwNGY1MWQ0YzU2NGVm
|
10
|
+
MzgzODI3ZTRjZmY5NGQ2ZWEwNThmZjE0MzQ4YzM3MjczYTljYWFjMWNkODEz
|
11
|
+
NGEyNzk1NjgzNjgxZmYzNWNiMWM0MTg0YTk3ZGRjZGQxN2E1ZGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzM0NGQ2NmZmZWRiNjU2Y2QxYjgyNWM1NThjNWNlZmE3NDVlNDc1ZjM0MmVk
|
14
|
+
YjA0ODA1ZWJmOTM1YzA0MWMwZTQwZjM0YzI3MzcxZTc3MjUxOGM3NmE4NmFl
|
15
|
+
ZTM3MDY3NGI5MzZhNTNjYzYxYTk1MjViYjliNWU3ZTdmMjU0ZTQ=
|
@@ -3,6 +3,7 @@ require 'faraday_middleware'
|
|
3
3
|
|
4
4
|
module RakutenWebService
|
5
5
|
class WrongParameter < StandardError; end
|
6
|
+
class NotFound < StandardError; end
|
6
7
|
class TooManyRequests < StandardError; end
|
7
8
|
class SystemError < StandardError; end
|
8
9
|
class ServiceUnavailable < StandardError; end
|
@@ -25,6 +26,8 @@ module RakutenWebService
|
|
25
26
|
return response
|
26
27
|
when 400
|
27
28
|
raise WrongParameter, response.body['error_description']
|
29
|
+
when 404
|
30
|
+
raise NotFound, response.body['error_description']
|
28
31
|
when 429
|
29
32
|
raise TooManyRequests, response.body['error_description']
|
30
33
|
when 500
|
@@ -104,5 +104,18 @@ describe RakutenWebService::Client do
|
|
104
104
|
expect { client.get({}) }.to raise_error(RWS::ServiceUnavailable, 'XXX/XXX is under maintenance')
|
105
105
|
end
|
106
106
|
end
|
107
|
+
|
108
|
+
context 'The specified genre has no ranking data' do
|
109
|
+
let(:expected_response) do
|
110
|
+
{ :status => 404,
|
111
|
+
:body => '{ "error": "not_found",
|
112
|
+
"error_description": "This genre data does not exist"}'
|
113
|
+
}
|
114
|
+
end
|
115
|
+
|
116
|
+
specify 'raises NotFound exception' do
|
117
|
+
expect { client.get({}) }.to raise_error(RWS::NotFound, 'This genre data does not exist')
|
118
|
+
end
|
119
|
+
end
|
107
120
|
end
|
108
121
|
end
|
@@ -92,7 +92,7 @@ describe RakutenWebService::Ichiba::Item do
|
|
92
92
|
to_return(:body => response.to_json)
|
93
93
|
|
94
94
|
expected_item = response['Items'][0]['Item']
|
95
|
-
RakutenWebService::Ichiba::Genre.should_receive('
|
95
|
+
RakutenWebService::Ichiba::Genre.should_receive('new').with(expected_item['genreId'])
|
96
96
|
end
|
97
97
|
|
98
98
|
subject { RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby').first.genre }
|