mapquest-api 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mapquest/api/client.rb +2 -0
- data/lib/mapquest/api/client/reverse.rb +27 -0
- data/lib/mapquest/api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a99620a1d754bc8857b89d87779d72dc2ab4355febe02ab54abd70b54f45884b
|
4
|
+
data.tar.gz: 1a8143b2bb628138112c53e829f9e80c74f4a517bb960dfa91fd5083871efbbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12799e66e4f92fe22060fa02dc9d7bdbae639d3149334edda239aef0178b64c12d4aaefc0b8dba0eebf76a26f44e2af3f677eed5a679f299990a5ef5cd76b232
|
7
|
+
data.tar.gz: 03db5c65d7c28516b25079d65763ca09f8336a97732ab3417f023764943e6e94d787b68ef0a8aae7a59bd88ff962311cd5103d937e986ce2f582fea0d4a458fa
|
data/Gemfile.lock
CHANGED
data/lib/mapquest/api/client.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
require 'faraday'
|
3
|
+
|
4
|
+
module Mapquest
|
5
|
+
module API
|
6
|
+
class Client
|
7
|
+
module Reverse
|
8
|
+
MAPQUEST_NOMINATIM_ROOT_URL = "https://open.mapquestapi.com/nominatim/v1"
|
9
|
+
|
10
|
+
def reverse(args = {})
|
11
|
+
search_parameters = args.transform_keys(&:to_s).merge({ "key" => ENV['MAPQUEST_API_KEY'] })
|
12
|
+
|
13
|
+
uri = Addressable::URI.parse("#{MAPQUEST_NOMINATIM_ROOT_URL}/reverse.php")
|
14
|
+
uri.query_values = search_parameters
|
15
|
+
|
16
|
+
response = Faraday.get(uri)
|
17
|
+
if response.success?
|
18
|
+
%w(json jsonv2).include?(search_parameters["format"]) ? JSON.parse(response.body) : response.body
|
19
|
+
else
|
20
|
+
{ errors: response.body }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/mapquest/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mapquest-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chase Clettenberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- bin/setup
|
157
157
|
- lib/mapquest/api.rb
|
158
158
|
- lib/mapquest/api/client.rb
|
159
|
+
- lib/mapquest/api/client/reverse.rb
|
159
160
|
- lib/mapquest/api/client/search.rb
|
160
161
|
- lib/mapquest/api/version.rb
|
161
162
|
- mapquest-api.gemspec
|