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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53ab69ef8e4842f8091250c496909d954c657d33c7eb5ce2446ece902148d749
4
- data.tar.gz: 6afe39ea595e1fff419a32fe39a718bcbcf3575758dd440911336e1d0102d6fd
3
+ metadata.gz: a99620a1d754bc8857b89d87779d72dc2ab4355febe02ab54abd70b54f45884b
4
+ data.tar.gz: 1a8143b2bb628138112c53e829f9e80c74f4a517bb960dfa91fd5083871efbbf
5
5
  SHA512:
6
- metadata.gz: f2a12a9b419320c3b8b52898f1ad30fb3ab9ca96134621890304ae754d839ec1a8a4d933bfaa50d8fd55c7b1d25d6476daf784720661d16429ba8aa744b0fd5c
7
- data.tar.gz: 4542dc3c86cbbe91bc9f1e5914ea04db5b9bf406f0a3df4c6afcb44f943941f8ddd81c10a4c4462e6565fd82265c645a007a7a5af9e06c22409deaebcf2dd10c
6
+ metadata.gz: 12799e66e4f92fe22060fa02dc9d7bdbae639d3149334edda239aef0178b64c12d4aaefc0b8dba0eebf76a26f44e2af3f677eed5a679f299990a5ef5cd76b232
7
+ data.tar.gz: 03db5c65d7c28516b25079d65763ca09f8336a97732ab3417f023764943e6e94d787b68ef0a8aae7a59bd88ff962311cd5103d937e986ce2f582fea0d4a458fa
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mapquest-api (0.0.1)
4
+ mapquest-api (0.0.2)
5
5
  addressable (~> 2.5)
6
6
  faraday (~> 0.15)
7
7
 
@@ -1,9 +1,11 @@
1
1
  require_relative 'client/search'
2
+ require_relative 'client/reverse'
2
3
 
3
4
  module Mapquest
4
5
  module API
5
6
  class Client
6
7
  include Mapquest::API::Client::Search
8
+ include Mapquest::API::Client::Reverse
7
9
  end
8
10
  end
9
11
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Mapquest
2
2
  module API
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
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.2
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-24 00:00:00.000000000 Z
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