google_maps_apis 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/ruby.yml +28 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.yardopts +11 -0
- data/CHANGELOG.md +47 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +26 -0
- data/LICENSE +202 -0
- data/README.md +379 -0
- data/Rakefile +15 -0
- data/bin/console +15 -0
- data/google_maps_apis.gemspec +23 -0
- data/lib/google_maps_apis/client.rb +294 -0
- data/lib/google_maps_apis/convert.rb +176 -0
- data/lib/google_maps_apis/errors.rb +82 -0
- data/lib/google_maps_apis/polyline.rb +90 -0
- data/lib/google_maps_apis/services/directions.rb +101 -0
- data/lib/google_maps_apis/services/distance_matrix.rb +85 -0
- data/lib/google_maps_apis/services/elevation.rb +58 -0
- data/lib/google_maps_apis/services/geocoding.rb +85 -0
- data/lib/google_maps_apis/services/places.rb +20 -0
- data/lib/google_maps_apis/services/roads.rb +187 -0
- data/lib/google_maps_apis/services/time_zone.rb +41 -0
- data/lib/google_maps_apis/services.rb +6 -0
- data/lib/google_maps_apis/url.rb +64 -0
- data/lib/google_maps_apis/validator.rb +39 -0
- data/lib/google_maps_apis/version.rb +23 -0
- data/lib/google_maps_apis.rb +56 -0
- metadata +117 -0
data/README.md
ADDED
@@ -0,0 +1,379 @@
|
|
1
|
+
# Ruby gem for Google Maps APIs
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/google_maps_apis.svg)](http://badge.fury.io/rb/google_maps_apis) [![Build Status](https://travis-ci.org/edwardsamuel/google-maps-services-ruby.svg?branch=master)](https://travis-ci.org/edwardsamuel/google-maps-services-ruby) [![Dependency Status](https://gemnasium.com/edwardsamuel/google-maps-services-ruby.svg)](https://gemnasium.com/edwardsamuel/google-maps-services-ruby) [![Code Climate](https://codeclimate.com/github/edwardsamuel/google-maps-services-ruby/badges/gpa.svg)](https://codeclimate.com/github/edwardsamuel/google-maps-services-ruby) [![Coverage Status](https://coveralls.io/repos/edwardsamuel/google-maps-services-ruby/badge.svg?branch=master&service=github)](https://coveralls.io/github/edwardsamuel/google-maps-services-ruby?branch=master) [![Inch CI](https://inch-ci.org/github/edwardsamuel/google-maps-services-ruby.svg?branch=master)](https://inch-ci.org/github/edwardsamuel/google-maps-services-ruby?branch=master)
|
4
|
+
|
5
|
+
![Analytics](https://ga-beacon.appspot.com/UA-66926725-1/google-maps-services-ruby/readme?pixel)
|
6
|
+
|
7
|
+
*This gem is ported from [Python Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-python).*
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
Use Ruby? Want to [geocode][Geocoding API] something? Looking for [directions][Directions API]?
|
12
|
+
Maybe [matrices of directions][Distance Matrix API]? This gem brings the [Google Maps API Web
|
13
|
+
Services] to your Ruby application.
|
14
|
+
|
15
|
+
The Ruby gem for Google Maps Web Service APIs is a gem for the following Google Maps APIs:
|
16
|
+
|
17
|
+
- [Google Maps Directions API][Directions API]
|
18
|
+
- [Google Maps Distance Matrix API][Distance Matrix API]
|
19
|
+
- [Google Maps Elevation API][Elevation API]
|
20
|
+
- [Google Maps Geocoding API][Geocoding API]
|
21
|
+
- [Google Maps Time Zone API][Time Zone API]
|
22
|
+
- [Google Maps Roads API][Roads API]
|
23
|
+
- [Google Maps Places API][Places API - AutoComplete]
|
24
|
+
|
25
|
+
Keep in mind that the same [terms and conditions](https://developers.google.com/maps/terms) apply
|
26
|
+
to usage of the APIs when they're accessed through this gem.
|
27
|
+
|
28
|
+
|
29
|
+
## Features
|
30
|
+
|
31
|
+
### Rate Limiting
|
32
|
+
|
33
|
+
Never sleep between requests again! By default, requests are sent at the expected rate limits for
|
34
|
+
each web service, typically 10 queries per second for free users. If you want to speed up or slowdown requests, you can do that too, using `queries_per_second` options while initializing API client.
|
35
|
+
|
36
|
+
### Retry on Failure
|
37
|
+
|
38
|
+
Automatically retry when intermittent failures occur. That is, when any of the retriable 5xx errors
|
39
|
+
are returned from the API.
|
40
|
+
|
41
|
+
### Keys *and* Client IDs
|
42
|
+
|
43
|
+
Maps API for Work customers can use their [client ID and secret][clientid] to authenticate. Free
|
44
|
+
customers can use their [API key][apikey], too.
|
45
|
+
|
46
|
+
Note: Currently, [Roads API] does not accept client ID. It requires API key to authenticate the request.
|
47
|
+
|
48
|
+
### Ruby Hash/Array as API Result
|
49
|
+
|
50
|
+
This gem return a Ruby Hash/Array object as the API result. The result format structure is same as in Google Maps API documentation.
|
51
|
+
|
52
|
+
## Requirements
|
53
|
+
|
54
|
+
- Ruby 2.0 or later.
|
55
|
+
- A Google Maps API credentials (API keys or client IDs)
|
56
|
+
|
57
|
+
### Obtain API keys
|
58
|
+
|
59
|
+
Each Google Maps Web Service requires an API key or Client ID. API keys are
|
60
|
+
freely available with a Google Account at https://developers.google.com/console.
|
61
|
+
To generate a server key for your project:
|
62
|
+
|
63
|
+
1. Visit https://developers.google.com/console and log in with
|
64
|
+
a Google Account.
|
65
|
+
1. Select an existing project, or create a new project.
|
66
|
+
1. Click **Enable an API**.
|
67
|
+
1. Browse for the API, and set its status to "On". The Python Client for Google Maps Services
|
68
|
+
accesses the following APIs:
|
69
|
+
* Directions API
|
70
|
+
* Distance Matrix API
|
71
|
+
* Elevation API
|
72
|
+
* Geocoding API
|
73
|
+
* Time Zone API
|
74
|
+
* Roads API
|
75
|
+
1. Once you've enabled the APIs, click **Credentials** from the left navigation of the Developer
|
76
|
+
Console.
|
77
|
+
1. In the "Public API access", click **Create new Key**.
|
78
|
+
1. Choose **Server Key**.
|
79
|
+
1. If you'd like to restrict requests to a specific IP address, do so now.
|
80
|
+
1. Click **Create**.
|
81
|
+
|
82
|
+
Your API key should be 40 characters long, and begin with `AIza`.
|
83
|
+
|
84
|
+
**Important:** This key should be kept secret on your server.
|
85
|
+
|
86
|
+
## Installation
|
87
|
+
|
88
|
+
Add this line to your application's Gemfile:
|
89
|
+
|
90
|
+
gem 'google_maps_apis'
|
91
|
+
|
92
|
+
And then execute:
|
93
|
+
|
94
|
+
bundle install
|
95
|
+
|
96
|
+
Or install it yourself as:
|
97
|
+
|
98
|
+
gem install google_maps_apis
|
99
|
+
|
100
|
+
In your Ruby code, add this line to load this gem:
|
101
|
+
|
102
|
+
require 'google_maps_apis'
|
103
|
+
|
104
|
+
## Usage
|
105
|
+
|
106
|
+
Before you request Google Maps API, you must configure the client.
|
107
|
+
|
108
|
+
You can view the [reference documentation](http://www.rubydoc.info/gems/google_maps_apis).
|
109
|
+
|
110
|
+
### Configure client
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
require 'google_maps_apis'
|
114
|
+
|
115
|
+
# Setup API keys
|
116
|
+
gmaps = GoogleMapsApis::Client.new(key: 'Add your key here')
|
117
|
+
|
118
|
+
# Setup client IDs
|
119
|
+
gmaps = GoogleMapsApis::Client.new(
|
120
|
+
client_id: 'Add your client id here',
|
121
|
+
client_secret: 'Add your client secret here'
|
122
|
+
)
|
123
|
+
|
124
|
+
# More complex setup
|
125
|
+
gmaps = GoogleMapsApis::Client.new(
|
126
|
+
key: 'Add your key here',
|
127
|
+
retry_timeout: 20, # Timeout for retrying failed request
|
128
|
+
queries_per_second: 10 # Limit total request per second
|
129
|
+
)
|
130
|
+
```
|
131
|
+
You can also set up the client globally.
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
require 'google_maps_apis'
|
135
|
+
|
136
|
+
# Setup global parameters
|
137
|
+
GoogleMapsApis.configure do |config|
|
138
|
+
config.key = 'Add your key here'
|
139
|
+
config.retry_timeout = 20
|
140
|
+
config.queries_per_second = 10
|
141
|
+
end
|
142
|
+
|
143
|
+
# Initialize client using global parameters
|
144
|
+
gmaps = GoogleMapsApis::Client.new
|
145
|
+
```
|
146
|
+
|
147
|
+
For more examples and detail (setup **proxy**, **timeout**, **caching**, etc.) while initializing the client, check out [Client documentation](http://www.rubydoc.info/gems/google_maps_apis/GoogleMapsApis/services/Client#initialize-instance_method).
|
148
|
+
|
149
|
+
### Latitude/longitude pairs format
|
150
|
+
|
151
|
+
Some APIs require latitude/longitude pair(s) as their parameter(s). This gem accept various format of latitude/longitude pairs:
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
# Array
|
155
|
+
latlng = [40.714224, -73.961452]
|
156
|
+
|
157
|
+
# Hash with symbolized keys
|
158
|
+
latlng = {lat: 40.714224, lng: -73.961452}
|
159
|
+
latlng = {latitude: 40.714224, longitude: -73.961452}
|
160
|
+
|
161
|
+
# Hash with string keys
|
162
|
+
latlng = {'lat' => 40.714224, 'lng' => -73.961452}
|
163
|
+
latlng = {'latitude' => 40.714224, 'longitude' => -73.961452}
|
164
|
+
```
|
165
|
+
|
166
|
+
### Directions API
|
167
|
+
|
168
|
+
```ruby
|
169
|
+
# Simple directions
|
170
|
+
routes = gmaps.directions(
|
171
|
+
'1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA',
|
172
|
+
'2400 Amphitheatre Parkway, Mountain View, CA 94043, USA',
|
173
|
+
mode: 'walking',
|
174
|
+
alternatives: false)
|
175
|
+
```
|
176
|
+
|
177
|
+
Sample result:
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
[{
|
181
|
+
:bounds=>{
|
182
|
+
:northeast=>{:lat=>37.4238004, :lng=>-122.084314},
|
183
|
+
:southwest=>{:lat=>37.42277989999999, :lng=>-122.0882019}
|
184
|
+
},
|
185
|
+
:copyrights=>"Map data ©2015 Google",
|
186
|
+
:legs=>[
|
187
|
+
{
|
188
|
+
:distance=>{:text=>"0.2 mi", :value=>393},
|
189
|
+
:duration=>{:text=>"5 mins", :value=>287},
|
190
|
+
:end_address=>"2400 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
|
191
|
+
:end_location=>{:lat=>37.4238004, :lng=>-122.0882019},
|
192
|
+
:start_address=>"1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
|
193
|
+
:start_location=>{:lat=>37.42277989999999, :lng=>-122.084314},
|
194
|
+
:steps=>[
|
195
|
+
{
|
196
|
+
:distance=>{:text=>"223 ft", :value=>68},
|
197
|
+
:duration=>{:text=>"1 min", :value=>49},
|
198
|
+
:end_location=>{:lat=>37.4228653, :lng=>-122.0850785},
|
199
|
+
:html_instructions=>"Head <b>west</b>",
|
200
|
+
:polyline=>{:points=>"kclcF|qchVEdAGx@ALAJ"},
|
201
|
+
:start_location=>{:lat=>37.42277989999999, :lng=>-122.084314},
|
202
|
+
:travel_mode=>"WALKING"
|
203
|
+
}, {
|
204
|
+
:distance=>{:text=>"108 ft", :value=>33},
|
205
|
+
:duration=>{:text=>"1 min", :value=>23},
|
206
|
+
:end_location=>{:lat=>37.423161, :lng=>-122.0850102},
|
207
|
+
:html_instructions=>"Turn <b>right</b> toward <b>Amphitheatre Pkwy</b>",
|
208
|
+
:maneuver=>"turn-right",
|
209
|
+
:polyline=>{:points=>"}clcFvvchVg@IQC"},
|
210
|
+
:start_location=>{:lat=>37.4228653, :lng=>-122.0850785},
|
211
|
+
:travel_mode=>"WALKING"
|
212
|
+
}, {
|
213
|
+
:distance=>{:text=>"407 ft", :value=>124},
|
214
|
+
:duration=>{:text=>"2 mins", :value=>90},
|
215
|
+
:end_location=>{:lat=>37.423396, :lng=>-122.0863768},
|
216
|
+
:html_instructions=>"Turn <b>left</b> onto <b>Amphitheatre Pkwy</b>",
|
217
|
+
:maneuver=>"turn-left",
|
218
|
+
:polyline=>{:points=>"welcFhvchVEf@Eb@C\\EZGp@Il@CRAJAJ"},
|
219
|
+
:start_location=>{:lat=>37.423161, :lng=>-122.0850102},
|
220
|
+
:travel_mode=>"WALKING"
|
221
|
+
}, {
|
222
|
+
:distance=>{:text=>"0.1 mi", :value=>168},
|
223
|
+
:duration=>{:text=>"2 mins", :value=>125},
|
224
|
+
:end_location=>{:lat=>37.4238004, :lng=>-122.0882019},
|
225
|
+
:html_instructions=>
|
226
|
+
"Slight <b>right</b> to stay on <b>Amphitheatre Pkwy</b><div style=\"font-size:0.9em\">Destination will be on the right</div>",
|
227
|
+
:maneuver=>"turn-slight-right",
|
228
|
+
:polyline=>{:points=>"gglcFz~chVGJADAD?DIh@MhAWhBOxACT"},
|
229
|
+
:start_location=>{:lat=>37.423396, :lng=>-122.0863768},
|
230
|
+
:travel_mode=>"WALKING"
|
231
|
+
}
|
232
|
+
],
|
233
|
+
:via_waypoint=>[]
|
234
|
+
}
|
235
|
+
],
|
236
|
+
:overview_polyline=>{:points=>"kclcF|qchVQxCy@MKjA[xCE^IVMz@y@bH"},
|
237
|
+
:summary=>"Amphitheatre Pkwy",
|
238
|
+
:warnings=>["Walking directions are in beta. Use caution – This route may be missing sidewalks or pedestrian paths."],
|
239
|
+
:waypoint_order=>[]
|
240
|
+
}]
|
241
|
+
```
|
242
|
+
|
243
|
+
For more usage examples and result format, check out [gem documentation](http://www.rubydoc.info/gems/google_maps_apis/GoogleMapsApis/services/Directions), [test script](https://github.com/go-illa/google-maps-services-ruby/tree/master/spec/google_maps_apis/services/directions_spec.rb), and [Google Maps Directions API documentation][Directions API].
|
244
|
+
|
245
|
+
### Distance Matrix API
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
# Multiple parameters distance matrix
|
249
|
+
origins = ["Bobcaygeon ON", [41.43206, -81.38992]]
|
250
|
+
destinations = [[43.012486, -83.6964149], {lat: 42.8863855, lng: -78.8781627}]
|
251
|
+
matrix = gmaps.distance_matrix(origins, destinations,
|
252
|
+
mode: 'driving',
|
253
|
+
language: 'en-AU',
|
254
|
+
avoid: 'tolls',
|
255
|
+
units: 'imperial')
|
256
|
+
```
|
257
|
+
|
258
|
+
For more usage examples and result format, check out [gem documentation](http://www.rubydoc.info/gems/google_maps_apis/GoogleMapsApis/services/DistanceMatrix), [test script](https://github.com/go-illa/google-maps-services-ruby/tree/master/spec/google_maps_apis/services/distance_matrix_spec.rb), and [Google Maps Distance Matrix API documentation][Distance Matrix API].
|
259
|
+
|
260
|
+
### Elevation API
|
261
|
+
|
262
|
+
```ruby
|
263
|
+
# Elevation of some locations
|
264
|
+
locations = [[40.714728, -73.998672], [-34.397, 150.644]]
|
265
|
+
results = gmaps.elevation(locations)
|
266
|
+
|
267
|
+
# Elevation along path
|
268
|
+
locations = [[40.714728, -73.998672], [-34.397, 150.644]]
|
269
|
+
results = gmaps.elevation_along_path(locations, 5)
|
270
|
+
```
|
271
|
+
|
272
|
+
For more usage examples and result format, check out [gem documentation](http://www.rubydoc.info/gems/google_maps_apis/GoogleMapsApis/services/Elevation), [test script](https://github.com/go-illa/google-maps-services-ruby/tree/master/spec/google_maps_apis/services/elevation_spec.rb), and [Google Maps Elevation API documentation][Elevation API].
|
273
|
+
|
274
|
+
### Geocoding API
|
275
|
+
|
276
|
+
```ruby
|
277
|
+
# Geocoding an address
|
278
|
+
results = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')
|
279
|
+
|
280
|
+
# Look up an address with reverse geocoding
|
281
|
+
results = gmaps.reverse_geocode([40.714224, -73.961452])
|
282
|
+
```
|
283
|
+
|
284
|
+
For more usage examples and result format, check out [gem documentation](http://www.rubydoc.info/gems/google_maps_apis/GoogleMapsApis/services/Geocoding), [test script](https://github.com/go-illa/google-maps-services-ruby/tree/master/spec/google_maps_apis/services/geocoding_spec.rb), and [Google Maps Geocoding API documentation][Geocoding API].
|
285
|
+
|
286
|
+
### Roads API
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
# Snap to roads
|
290
|
+
path = [
|
291
|
+
[-33.8671, 151.20714],
|
292
|
+
[-33.86708, 151.20683000000002],
|
293
|
+
[-33.867070000000005, 151.20674000000002],
|
294
|
+
[-33.86703, 151.20625]
|
295
|
+
]
|
296
|
+
results = gmaps.snap_to_roads(path, interpolate: true)
|
297
|
+
|
298
|
+
# Snapped speed limits
|
299
|
+
path = [
|
300
|
+
[-33.8671, 151.20714],
|
301
|
+
[-33.86708, 151.20683000000002],
|
302
|
+
[-33.867070000000005, 151.20674000000002],
|
303
|
+
[-33.86703, 151.20625]
|
304
|
+
]
|
305
|
+
results = gmaps.snapped_speed_limits(path)
|
306
|
+
|
307
|
+
# Speed limits
|
308
|
+
place_ids = [
|
309
|
+
'ChIJ0wawjUCuEmsRgfqC5Wd9ARM',
|
310
|
+
'ChIJ6cs2kkCuEmsRUfqC5Wd9ARM'
|
311
|
+
]
|
312
|
+
results = gmaps.speed_limits(place_ids)
|
313
|
+
```
|
314
|
+
|
315
|
+
For more usage examples and result format, check out [gem documentation](http://www.rubydoc.info/gems/google_maps_apis/GoogleMapsApis/services/Roads), [test script](https://github.com/go-illa/google-maps-services-ruby/tree/master/spec/google_maps_apis/services/roads_spec.rb), and [Google Maps Roads API documentation][Roads API].
|
316
|
+
|
317
|
+
### Time Zone API
|
318
|
+
|
319
|
+
```ruby
|
320
|
+
# Current time zone
|
321
|
+
timezone = gmaps.timezone([39.603481, -119.682251])
|
322
|
+
|
323
|
+
# Time zone at certain time
|
324
|
+
timezone = gmaps.timezone([39.603481, -119.682251], timestamp: Time.at(1608))
|
325
|
+
```
|
326
|
+
|
327
|
+
For more usage examples and result format, check out [gem documentation](http://www.rubydoc.info/gems/google_maps_apis/GoogleMapsApis/services/TimeZone), [test script](https://github.com/go-illa/google-maps-services-ruby/tree/master/spec/google_maps_apis/services/time_zone_spec.rb), and [Google Maps Time Zone API documentation][Time Zone API].
|
328
|
+
|
329
|
+
### Polyline encoder/decoder
|
330
|
+
|
331
|
+
[Google Encoded Polyline] is a lossy compression algorithm that allows you to store a series of coordinates as a single string. This format is used in some APIs:
|
332
|
+
|
333
|
+
- [Directions API] encodes the result path.
|
334
|
+
- [Elevation API] also accepts the encoded polyline as request parameter.
|
335
|
+
|
336
|
+
To handle Google Encoded Polyline, this gem provides encoder/decoder:
|
337
|
+
|
338
|
+
```ruby
|
339
|
+
require 'google_maps_apis/polyline' # Or, require 'google_maps_apis' is enough
|
340
|
+
|
341
|
+
# Decode polyline
|
342
|
+
encoded_path = '_p~iF~ps|U_ulLnnqC_mqNvxq`@'
|
343
|
+
path = GoogleMapsApis::Polyline.decode(encoded_path)
|
344
|
+
#=> [{:lat=>38.5, :lng=>-120.2}, {:lat=>40.7, :lng=>-120.95}, {:lat=>43.252, :lng=>-126.45300000000002}]
|
345
|
+
|
346
|
+
# Encode polyline
|
347
|
+
path = [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]
|
348
|
+
encoded_path = GoogleMapsApis::Polyline.encode(path)
|
349
|
+
#=> "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
|
350
|
+
```
|
351
|
+
|
352
|
+
## Issues and feature suggestions
|
353
|
+
|
354
|
+
If you find a bug, or have a feature suggestion, please [log an issue][issues]. If you'd like to
|
355
|
+
contribute, please read [How to Contribute](#contributing).
|
356
|
+
|
357
|
+
## Contributing
|
358
|
+
|
359
|
+
1. Fork it (https://github.com/go-illa/google-maps-services-ruby/fork).
|
360
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
361
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
362
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
363
|
+
5. Create a new Pull Request.
|
364
|
+
|
365
|
+
[apikey]: https://developers.google.com/maps/faq#keysystem
|
366
|
+
[clientid]: https://developers.google.com/maps/documentation/business/webservices/auth
|
367
|
+
|
368
|
+
[Google Maps API Web Services]: https://developers.google.com/maps/web-services/overview/
|
369
|
+
[Directions API]: https://developers.google.com/maps/documentation/directions/
|
370
|
+
[Distance Matrix API]: https://developers.google.com/maps/documentation/distancematrix/
|
371
|
+
[Elevation API]: https://developers.google.com/maps/documentation/elevation/
|
372
|
+
[Geocoding API]: https://developers.google.com/maps/documentation/geocoding/
|
373
|
+
[Time Zone API]: https://developers.google.com/maps/documentation/timezone/
|
374
|
+
[Roads API]: https://developers.google.com/maps/documentation/roads/
|
375
|
+
[Places API - AutoComplete]: https://developers.google.com/maps/documentation/places
|
376
|
+
|
377
|
+
[Google Encoded Polyline]: https://developers.google.com/maps/documentation/utilities/polylinealgorithm
|
378
|
+
|
379
|
+
[issues]: https://github.com/go-illa/google-maps-services-ruby/issues
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
task :test => :spec
|
8
|
+
|
9
|
+
unless defined?(JRUBY_VERSION)
|
10
|
+
require 'yard'
|
11
|
+
|
12
|
+
YARD::Rake::YardocTask.new do |t|
|
13
|
+
t.files = ['lib/**/*.rb']
|
14
|
+
end
|
15
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "google_maps_apis"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'google_maps_apis/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'google_maps_apis'
|
8
|
+
spec.version = GoogleMapsApis::VERSION
|
9
|
+
spec.authors = ['Edward Samuel Pasaribu', 'Ahmed Abdelhamid']
|
10
|
+
spec.email = ['edwardsamuel92@gmail.com', 'eng.a.abdelhamid@outlook.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby gem for Google Maps Web Service APIs }
|
13
|
+
spec.homepage = %q{https://github.com/go-illa/google-maps-services-ruby/tree/stable}
|
14
|
+
spec.license = 'Apache-2.0'
|
15
|
+
spec.required_ruby_version = '>= 2.6.0'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_runtime_dependency 'multi_json', '~> 1.12'
|
21
|
+
spec.add_runtime_dependency 'faraday', '~> 2.0'
|
22
|
+
spec.add_runtime_dependency 'retriable', '~> 3.1'
|
23
|
+
end
|