google_geocodings 0.1.0
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/google_geocodings +3 -0
- data/google_geocodings.gemspec +29 -0
- data/lib/google_geocodings.rb +20 -0
- data/lib/google_geocodings/client.rb +83 -0
- data/lib/google_geocodings/geocoding.rb +17 -0
- data/lib/google_geocodings/invalid_request_error.rb +10 -0
- data/lib/google_geocodings/location.rb +8 -0
- data/lib/google_geocodings/not_found_error.rb +4 -0
- data/lib/google_geocodings/over_query_limit_error.rb +4 -0
- data/lib/google_geocodings/rectangle.rb +19 -0
- data/lib/google_geocodings/request.rb +37 -0
- data/lib/google_geocodings/request_denied_error.rb +13 -0
- data/lib/google_geocodings/unknown_error.rb +4 -0
- data/lib/google_geocodings/version.rb +3 -0
- metadata +139 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: ed805fb97f1ac0e6317b13ded64272a3506b8349
|
|
4
|
+
data.tar.gz: b000e4b2b6ea4652f37cfe6fcbcd441637399b9e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b6a6c23b36656c2803aa21f4ca501fe03a3cea55f4b5562508372390e3383fd7f0182208c875075917233a6bdf174e8e6b1ebdc677541c168092aada3d017b2a
|
|
7
|
+
data.tar.gz: 3b61b7693985fb5806c859fa445f1796a65d46a2ce30922d9e856f64b1890d42c130f97424d53982f8b7f2ea56eec320d69bdeba8ccd2be4e6ad91a78bab2695
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at afujiwara2012@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 akichim21
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# GoogleGeocodings
|
|
2
|
+
|
|
3
|
+
This gem provides a Ruby wrapper around the Google Geocodings API, using HTTParty. At this moment the gem does not support OAuth authentication and will only work with an API key.
|
|
4
|
+
|
|
5
|
+
## Obtaining an API key
|
|
6
|
+
To be able to use this gem, you'll need a Google Places API key. To request an API key, point your browser to code.google.com/apis/console and follow the instructions there. You'll find your API key on the *API Access* tab under *Simple API Access*.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Add this line to your application's Gemfile:
|
|
11
|
+
|
|
12
|
+
```ruby
|
|
13
|
+
gem 'google_geocodings'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
And then execute:
|
|
17
|
+
|
|
18
|
+
$ bundle
|
|
19
|
+
|
|
20
|
+
Or install it yourself as:
|
|
21
|
+
|
|
22
|
+
$ gem install google_geocodings
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
### Request
|
|
26
|
+
|
|
27
|
+
First register a new Client:
|
|
28
|
+
```ruby
|
|
29
|
+
client = GoogleGeocodings::Client.new(API_KEY)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
retrieve geometry by address
|
|
33
|
+
```ruby
|
|
34
|
+
client.geocode("1600 Amphitheatre Parkway, Mountain View, CA")
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
retrieve address by geometry(latitude, longitude)
|
|
38
|
+
```ruby
|
|
39
|
+
client.reverse_geocode("37.4230474802915", "-122.0843128697085")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
change langauge (ex: ja), response ja data
|
|
43
|
+
```ruby
|
|
44
|
+
client.geocode("秋田県大館市御成町1丁目3−1", language: 'ja')
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Response
|
|
48
|
+
response
|
|
49
|
+
* GoogleGeocodings::Geocoding[]
|
|
50
|
+
|
|
51
|
+
GoogleGeocodings::Geocoding attribute
|
|
52
|
+
* types[], formatted_address, address_components[], postcode_localities[], geometry, partial_match, place_id
|
|
53
|
+
see: https://developers.google.com/maps/documentation/geocoding/intro#GeocodingResponses
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
58
|
+
|
|
59
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/akichim/google_geocodings. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "google_geocodings"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "google_geocodings/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "google_geocodings"
|
|
8
|
+
spec.version = GoogleGeocodings::VERSION
|
|
9
|
+
spec.authors = ["akichim21"]
|
|
10
|
+
spec.email = ["afujiwara2012@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{google geocodings api wrapper}
|
|
13
|
+
spec.description = %q{google geocodings api wrapper}
|
|
14
|
+
spec.homepage = "https://github.com/akichim21/google_geocodings"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
|
19
|
+
end
|
|
20
|
+
spec.bindir = "exe"
|
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
+
spec.require_paths = ["lib"]
|
|
23
|
+
|
|
24
|
+
spec.add_dependency 'httparty', '>= 0.13.1'
|
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
|
26
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.6.0"
|
|
28
|
+
spec.add_development_dependency "webmock", "~> 3.0"
|
|
29
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "google_geocodings/version"
|
|
2
|
+
require 'httparty'
|
|
3
|
+
|
|
4
|
+
%w(client geocoding invalid_request_error not_found_error over_query_limit_error request_denied_error request rectangle unknown_error location).each do |file|
|
|
5
|
+
require File.join(File.dirname(__FILE__), 'google_geocodings', file)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module GoogleGeocodings
|
|
9
|
+
class << self
|
|
10
|
+
attr_accessor :api_key
|
|
11
|
+
|
|
12
|
+
def root
|
|
13
|
+
File.dirname __dir__
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def configuration
|
|
17
|
+
yield self
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
module GoogleGeocodings
|
|
2
|
+
class Client
|
|
3
|
+
# @return [String] the provided api key
|
|
4
|
+
attr_reader :api_key
|
|
5
|
+
|
|
6
|
+
# Creates a new Client instance which proxies the requests to the certain classes
|
|
7
|
+
#
|
|
8
|
+
# @param [String] api_key The api key to use for the requests
|
|
9
|
+
def initialize(api_key = @api_key)
|
|
10
|
+
@api_key = api_key
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# geocode
|
|
14
|
+
#
|
|
15
|
+
# @return [Array<Geocoding>]
|
|
16
|
+
# @param [String] address
|
|
17
|
+
# @param [Hash] options
|
|
18
|
+
# @option bounds [Hash]
|
|
19
|
+
# @bounds start_latitude [Float]
|
|
20
|
+
# @bounds start_longitude [Float]
|
|
21
|
+
# @bounds end_latitude [Float]
|
|
22
|
+
# @bounds end_longitude [Float]
|
|
23
|
+
# @option language [String]
|
|
24
|
+
# @option region [String]
|
|
25
|
+
# see: https://developers.google.com/maps/documentation/geocoding/intro#geocoding
|
|
26
|
+
# NOTE: Not yet correspond to components param
|
|
27
|
+
def geocode(address, options = {})
|
|
28
|
+
language = options.delete(:language)
|
|
29
|
+
region = options.delete(:region)
|
|
30
|
+
rectangle = Rectangle.new(options.delete(:bounds))
|
|
31
|
+
|
|
32
|
+
options = {
|
|
33
|
+
key: api_key,
|
|
34
|
+
address: address,
|
|
35
|
+
language: language,
|
|
36
|
+
region: region,
|
|
37
|
+
bounds: rectangle.format,
|
|
38
|
+
}
|
|
39
|
+
request(:geocode, options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# reverse geocode
|
|
43
|
+
#
|
|
44
|
+
# @return [Array<Geocoding>]
|
|
45
|
+
# @param [String] address
|
|
46
|
+
# @param [Hash] options
|
|
47
|
+
# @option bounds [Hash]
|
|
48
|
+
# @bounds start_latitude [Float]
|
|
49
|
+
# @bounds start_longitude [Float]
|
|
50
|
+
# @bounds end_latitude [Float]
|
|
51
|
+
# @bounds end_longitude [Float]
|
|
52
|
+
# @option language [String]
|
|
53
|
+
# @option region [String]
|
|
54
|
+
# see: https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding
|
|
55
|
+
# NOTE: Not yet correspond to components param
|
|
56
|
+
def reverse_geocode(latitude, longitude, options = {})
|
|
57
|
+
language = options.delete(:language)
|
|
58
|
+
region = options.delete(:region)
|
|
59
|
+
rectangle = Rectangle.new(options.delete(:bounds))
|
|
60
|
+
|
|
61
|
+
options = {
|
|
62
|
+
key: api_key,
|
|
63
|
+
latlng: Location.new(latitude, longitude).format,
|
|
64
|
+
language: language,
|
|
65
|
+
region: region,
|
|
66
|
+
bounds: rectangle.format,
|
|
67
|
+
}
|
|
68
|
+
request(:geocode, options)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
private
|
|
72
|
+
def request(method, options)
|
|
73
|
+
results = []
|
|
74
|
+
|
|
75
|
+
response = Request.send(method, options)
|
|
76
|
+
response['results'].each do |result|
|
|
77
|
+
results << Geocoding.new(result, api_key)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
results
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module GoogleGeocodings
|
|
2
|
+
class Geocoding
|
|
3
|
+
attr_reader :address_components, :formatted_address, :geometry, :place_id, :types, :api_key
|
|
4
|
+
def initialize(json_result_object, api_key)
|
|
5
|
+
@address_components = json_result_object['address_components']
|
|
6
|
+
@formatted_address = json_result_object['formatted_address']
|
|
7
|
+
@geometry = json_result_object['geometry']
|
|
8
|
+
@place_id = json_result_object['place_id']
|
|
9
|
+
@types = json_result_object['types']
|
|
10
|
+
@api_key = api_key
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def [] (key)
|
|
14
|
+
send(key)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module GoogleGeocodings
|
|
2
|
+
# Thrown when a request was rejected as invalid by the server
|
|
3
|
+
#
|
|
4
|
+
# This can be the case when:
|
|
5
|
+
# - querying the SPOT_LIST_URL <b>without</b> the following parameters:
|
|
6
|
+
# - - location
|
|
7
|
+
# - - radius
|
|
8
|
+
class InvalidRequestError < HTTParty::ResponseError
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module GoogleGeocodings
|
|
2
|
+
class Rectangle
|
|
3
|
+
attr_reader :format
|
|
4
|
+
# @param bounds [Hash]
|
|
5
|
+
# @bounds start_latitude [Float]
|
|
6
|
+
# @bounds start_longitude [Float]
|
|
7
|
+
# @bounds end_latitude [Float]
|
|
8
|
+
# @bounds end_longitude [Float]
|
|
9
|
+
def initialize(bounds = {})
|
|
10
|
+
bounds ||= {}
|
|
11
|
+
start_latitude = bounds[:start_latitude]
|
|
12
|
+
start_longitude = bounds[:start_longitude]
|
|
13
|
+
end_latitude = bounds[:end_latitude]
|
|
14
|
+
end_longitude = bounds[:end_longitude]
|
|
15
|
+
return unless start_latitude && start_longitude && end_latitude && end_longitude
|
|
16
|
+
@format = [[("%.8f" % start_latitude), ("%.8f" % start_longitude)].join(','), [("%.8f" % end_latitude), ("%.8f" % end_longitude)].join(',')].join('|')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module GoogleGeocodings
|
|
2
|
+
class Request
|
|
3
|
+
attr_reader :response, :options
|
|
4
|
+
include ::HTTParty
|
|
5
|
+
default_options.update(verify: false)
|
|
6
|
+
format :json
|
|
7
|
+
|
|
8
|
+
GEOCODE_URL = "https://maps.googleapis.com/maps/api/geocode/json".freeze
|
|
9
|
+
|
|
10
|
+
def self.geocode(options = {})
|
|
11
|
+
request = new(GEOCODE_URL, options)
|
|
12
|
+
request.parsed_response
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def parsed_response
|
|
16
|
+
return @response.headers["location"] if @response.code >= 300 && @response.code < 400
|
|
17
|
+
case @response.parsed_response['status']
|
|
18
|
+
when 'OK', 'ZERO_RESULTS'
|
|
19
|
+
@response.parsed_response
|
|
20
|
+
when 'OVER_QUERY_LIMIT'
|
|
21
|
+
raise OverQueryLimitError.new(@response)
|
|
22
|
+
when 'REQUEST_DENIED'
|
|
23
|
+
raise RequestDeniedError.new(@response)
|
|
24
|
+
when 'INVALID_REQUEST'
|
|
25
|
+
raise InvalidRequestError.new(@response)
|
|
26
|
+
when 'UNKNOWN_ERROR'
|
|
27
|
+
raise UnknownError.new(@response)
|
|
28
|
+
when 'NOT_FOUND'
|
|
29
|
+
raise NotFoundError.new(@response)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def initialize(url, options, follow_redirects = true)
|
|
34
|
+
@response = self.class.get(url, query: options, follow_redirects: follow_redirects)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module GoogleGeocodings
|
|
2
|
+
# Thrown when a request was denied by the server
|
|
3
|
+
#
|
|
4
|
+
# This can be the case when:
|
|
5
|
+
# - API key is not authorized for the Geocodings API
|
|
6
|
+
# - querying the SPOT_LIST_URL <b>without</b> the following parameters:
|
|
7
|
+
# - - key
|
|
8
|
+
class RequestDeniedError < HTTParty::ResponseError
|
|
9
|
+
def to_s
|
|
10
|
+
response.parsed_response['error_message']
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: google_geocodings
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- akichim21
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-10-27 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: httparty
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.13.1
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.13.1
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.15'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.15'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '12.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '12.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 3.6.0
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 3.6.0
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: webmock
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '3.0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.0'
|
|
83
|
+
description: google geocodings api wrapper
|
|
84
|
+
email:
|
|
85
|
+
- afujiwara2012@gmail.com
|
|
86
|
+
executables:
|
|
87
|
+
- google_geocodings
|
|
88
|
+
extensions: []
|
|
89
|
+
extra_rdoc_files: []
|
|
90
|
+
files:
|
|
91
|
+
- ".gitignore"
|
|
92
|
+
- ".rspec"
|
|
93
|
+
- ".travis.yml"
|
|
94
|
+
- CODE_OF_CONDUCT.md
|
|
95
|
+
- Gemfile
|
|
96
|
+
- LICENSE.txt
|
|
97
|
+
- README.md
|
|
98
|
+
- Rakefile
|
|
99
|
+
- bin/console
|
|
100
|
+
- bin/setup
|
|
101
|
+
- exe/google_geocodings
|
|
102
|
+
- google_geocodings.gemspec
|
|
103
|
+
- lib/google_geocodings.rb
|
|
104
|
+
- lib/google_geocodings/client.rb
|
|
105
|
+
- lib/google_geocodings/geocoding.rb
|
|
106
|
+
- lib/google_geocodings/invalid_request_error.rb
|
|
107
|
+
- lib/google_geocodings/location.rb
|
|
108
|
+
- lib/google_geocodings/not_found_error.rb
|
|
109
|
+
- lib/google_geocodings/over_query_limit_error.rb
|
|
110
|
+
- lib/google_geocodings/rectangle.rb
|
|
111
|
+
- lib/google_geocodings/request.rb
|
|
112
|
+
- lib/google_geocodings/request_denied_error.rb
|
|
113
|
+
- lib/google_geocodings/unknown_error.rb
|
|
114
|
+
- lib/google_geocodings/version.rb
|
|
115
|
+
homepage: https://github.com/akichim21/google_geocodings
|
|
116
|
+
licenses:
|
|
117
|
+
- MIT
|
|
118
|
+
metadata: {}
|
|
119
|
+
post_install_message:
|
|
120
|
+
rdoc_options: []
|
|
121
|
+
require_paths:
|
|
122
|
+
- lib
|
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
|
+
requirements:
|
|
125
|
+
- - ">="
|
|
126
|
+
- !ruby/object:Gem::Version
|
|
127
|
+
version: '0'
|
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
|
+
requirements:
|
|
130
|
+
- - ">="
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
132
|
+
version: '0'
|
|
133
|
+
requirements: []
|
|
134
|
+
rubyforge_project:
|
|
135
|
+
rubygems_version: 2.5.2
|
|
136
|
+
signing_key:
|
|
137
|
+
specification_version: 4
|
|
138
|
+
summary: google geocodings api wrapper
|
|
139
|
+
test_files: []
|