gurunavi 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/gurunavi.gemspec +3 -2
- data/lib/gurunavi/client.rb +2 -2
- data/test/fixtures/errors/600_error.json +9 -0
- data/test/test_rests.rb +16 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6157cc160f887a567fcba87e49ab4a3b8db3dc6a
|
4
|
+
data.tar.gz: 45608c71649ae0d18cde330d1dcbb5c7b179c1b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12eed5fa3c35f337d71d22529c7dbb23616acdf0100b59328e6eea55def3c65a07b9a3c58ddbc24b2bbaf63ade7469e6c0064ed7c249e165335ae9813c1b40f0
|
7
|
+
data.tar.gz: b85974ef0060f919eaf4845394b541987fcf3e884dc4c3525269f2e0d075e0a24a36678a6538a95cdffc7945c90d66251f46925647e8f222e95bdaea1955d949
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Ruby wrapper for the [gurunavi API](http://api.gnavi.co.jp/api/manual/).
|
|
14
14
|
|
15
15
|
### Examples
|
16
16
|
|
17
|
-
Note: format options
|
17
|
+
Note: The key and format options are automatically granted.
|
18
18
|
|
19
19
|
#### get infomation of restaurants from [RestSearchAPI](http://api.gnavi.co.jp/api/manual/restsearch/)
|
20
20
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/gurunavi.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: gurunavi 0.1.
|
5
|
+
# stub: gurunavi 0.1.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "gurunavi".freeze
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"test/fixtures/areas/area_search.json",
|
43
43
|
"test/fixtures/categories/category_large_search.json",
|
44
44
|
"test/fixtures/categories/category_small_search.json",
|
45
|
+
"test/fixtures/errors/600_error.json",
|
45
46
|
"test/fixtures/errors/601_error.json",
|
46
47
|
"test/fixtures/errors/601_error_gnavi.json",
|
47
48
|
"test/fixtures/photos/photo_search.json",
|
data/lib/gurunavi/client.rb
CHANGED
@@ -69,8 +69,8 @@ module Gurunavi
|
|
69
69
|
# Added just for convenience to avoid having to traverse farther down the response just to get to returned data.
|
70
70
|
def return_error_or_body(response, response_body)
|
71
71
|
error_status = nil
|
72
|
-
error_status =
|
73
|
-
error_status =
|
72
|
+
error_status = response.body["error"] if response.body["error"]
|
73
|
+
error_status = response.body["gnavi"]["error"] if response.body["gnavi"] && response.body["gnavi"]["error"]
|
74
74
|
|
75
75
|
if error_status
|
76
76
|
raise Gurunavi::APIErrorFactory.call_api_errors(error_status.code, error_status.message)
|
data/test/test_rests.rb
CHANGED
@@ -20,5 +20,21 @@ class TestGurunavi < Test::Unit::TestCase
|
|
20
20
|
rests.count.should == 10
|
21
21
|
end
|
22
22
|
|
23
|
+
should "raise Gurunavi::InvalidAccess with error.json status is 601" do
|
24
|
+
stub_get("https://api.gnavi.co.jp/RestSearchAPI/20150630?format=json&keyid=#{@client.keyid}", "errors/601_error.json")
|
25
|
+
|
26
|
+
assert_raises(Gurunavi::InvalidAccess) do
|
27
|
+
@client.rest_search
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
should "raise Gurunavi::NoShop with error.json status is 600" do
|
32
|
+
stub_get("https://api.gnavi.co.jp/RestSearchAPI/20150630?format=json&keyid=#{@client.keyid}", "errors/600_error.json")
|
33
|
+
|
34
|
+
assert_raises(Gurunavi::NoShop) do
|
35
|
+
@client.rest_search
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
23
39
|
end
|
24
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gurunavi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobayang
|
@@ -229,6 +229,7 @@ files:
|
|
229
229
|
- test/fixtures/areas/area_search.json
|
230
230
|
- test/fixtures/categories/category_large_search.json
|
231
231
|
- test/fixtures/categories/category_small_search.json
|
232
|
+
- test/fixtures/errors/600_error.json
|
232
233
|
- test/fixtures/errors/601_error.json
|
233
234
|
- test/fixtures/errors/601_error_gnavi.json
|
234
235
|
- test/fixtures/photos/photo_search.json
|