google_directions_api 0.1.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +1 -0
- data/.gitignore +3 -0
- data/Gemfile +4 -1
- data/google_directions_api.gemspec +1 -0
- data/lib/google_directions_api/client/request.rb +18 -0
- data/lib/google_directions_api/client.rb +12 -0
- data/lib/google_directions_api/version.rb +1 -1
- data/lib/google_directions_api.rb +3 -1
- metadata +18 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685b96ce95e7d692b6aed4a650b43027a0343fabef97b8d7afc45f3285e651d6
|
4
|
+
data.tar.gz: dce253ce1c9757e992625e494fa2fcbf0cd8a99ccd8470f6cae949c08b30aa4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b42fc5a8285965a85c701594ad4821053cacadd8fb2677399cd0ae8f20bdc7e8ea1230c804cf052012779c31f9c3c3725170ecca9d268e1251ccb1d7c19648
|
7
|
+
data.tar.gz: 2753e71f3e281e9b2f08c2d670a1758ae1cf67f5f9f1fe6f4393a33c576b092f14b74c053cc805c5442945b551683c98ea64d209b37f84dd9b3bb86120f77939
|
data/.env.example
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
GOOGLE_DIRECTIONS_API_KEY=
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.required_ruby_version = '>= 2.5.1'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.15'
|
26
|
+
spec.add_development_dependency 'dotenv', '~> 2.5'
|
26
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
28
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
29
|
spec.add_development_dependency 'rubocop', '~> 0.57.2'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module GoogleDirectionsApi
|
2
|
+
class Client
|
3
|
+
# methods for request
|
4
|
+
module Request
|
5
|
+
# make request to API
|
6
|
+
def call(args = {})
|
7
|
+
body = { origin: args[:origin], destination: args[:destination], mode: 'driving', key: ENV['GOOGLE_DIRECTIONS_API_KEY'] }
|
8
|
+
self.class.get(url(args[:output_format]), query: body).parsed_response
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def url(format)
|
14
|
+
"/#{format}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require_relative 'client/request'
|
3
|
+
|
4
|
+
module GoogleDirectionsApi
|
5
|
+
# Client requests
|
6
|
+
class Client
|
7
|
+
include HTTParty
|
8
|
+
include GoogleDirectionsApi::Client::Request
|
9
|
+
|
10
|
+
base_uri 'https://maps.googleapis.com/maps/api/directions'.freeze
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_directions_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JungleCoders
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.15'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: dotenv
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2.5'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '2.5'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: rake
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +102,7 @@ executables: []
|
|
88
102
|
extensions: []
|
89
103
|
extra_rdoc_files: []
|
90
104
|
files:
|
105
|
+
- ".env.example"
|
91
106
|
- ".gitignore"
|
92
107
|
- ".rspec"
|
93
108
|
- ".rubocop.yml"
|
@@ -102,6 +117,8 @@ files:
|
|
102
117
|
- bin/setup
|
103
118
|
- google_directions_api.gemspec
|
104
119
|
- lib/google_directions_api.rb
|
120
|
+
- lib/google_directions_api/client.rb
|
121
|
+
- lib/google_directions_api/client/request.rb
|
105
122
|
- lib/google_directions_api/version.rb
|
106
123
|
homepage: https://github.com/WebGents/google_directions_api
|
107
124
|
licenses:
|