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
- MzYxYzA3MmVkMzNiMjMxZDYzZmY1MDM1NmI2MTUzMmQxZDY2ZGJkNA==
4
+ NTVjZWM1MjZhMWRmZDZhMzZkYmZhZThjNjJiZGE1NzNkZjNmYTYyMw==
5
5
  data.tar.gz: !binary |-
6
- NDIzYTA0Njc1NTc4YjkwMzM0MjQwNzQ2MGJhYjRmZmQ1ZGY5NzMxMw==
6
+ YjUzZDE3YzY0NGQxYjVjOTdmOGQ1ODAzYzU5Yzc2ZGI3MjhiNzZiYQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjVlYmRiMGMxNTU1MzUxMTFhMGUwMjQ5ZTE5ZjQzYjU3MzVkZTNlZTg1Mjcw
10
- MDM0ZGE4NTIwYTM3ZDdkZTJkZWNkNTBlYmQ4YWU1NGU3NGYyMGUyZmRjYTNi
11
- M2E4MDlmZDlmMTc4NTYxOTQwMjIyYTZjMmE0Y2JmYjdkYWQzNTg=
9
+ MTY4NDM0OGQwZmEyYTc3MzE2YjJhZDA4MGRjYWQwYjQwNGY1MWQ0YzU2NGVm
10
+ MzgzODI3ZTRjZmY5NGQ2ZWEwNThmZjE0MzQ4YzM3MjczYTljYWFjMWNkODEz
11
+ NGEyNzk1NjgzNjgxZmYzNWNiMWM0MTg0YTk3ZGRjZGQxN2E1ZGQ=
12
12
  data.tar.gz: !binary |-
13
- YjJhN2NmZTg4NTUyOWNiZjkwNjZjMjE4ZThhZjUxNzA4ZTI3ZTQyOWUxODUz
14
- MTQwMjI2NDFlOTk5YWJkYmNlNmEzZDVjZjU0OWZhYTE0YTVlNGM0NDVkYWFh
15
- Mzk5YTMzMzE0N2FkMTY4YzhjZjFmYTViMjRkMDM4NGU1ZGI1MjU=
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
@@ -29,7 +29,7 @@ module RakutenWebService
29
29
  :genreId
30
30
 
31
31
  def genre
32
- Genre[self.genre_id]
32
+ Genre.new(self.genre_id)
33
33
  end
34
34
 
35
35
  def shop
@@ -1,3 +1,3 @@
1
1
  module RakutenWebService
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -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('[]').with(expected_item['genreId'])
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 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakuten_web_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuya Sato