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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f76f40fb0e7318f5eea1cc1998e2b2fad81ec35e1c6f178d23f25db3a89518d
4
- data.tar.gz: a0da8fc2fff5b8dad165077d5252ade5b7fa4369db26a3f5a0720d2b4789dc5b
3
+ metadata.gz: 685b96ce95e7d692b6aed4a650b43027a0343fabef97b8d7afc45f3285e651d6
4
+ data.tar.gz: dce253ce1c9757e992625e494fa2fcbf0cd8a99ccd8470f6cae949c08b30aa4e
5
5
  SHA512:
6
- metadata.gz: fada7eb2c1824982a25257e31c2a888eac4e55d888e68e5201206f73532fd1310d313b9e97f859f46a8db11a395b16a42748310b33c9d7aac5dc1090db9678da
7
- data.tar.gz: ac41447daa164c3ba231ae4f1ecc6c382d83b2c5c19ee77ea5273b070f6f615e44845c41fb44879eacf3a0250cf1f3cec3996a2bdfb8ab6427c8f38a92d53c75
6
+ metadata.gz: 88b42fc5a8285965a85c701594ad4821053cacadd8fb2677399cd0ae8f20bdc7e8ea1230c804cf052012779c31f9c3c3725170ecca9d268e1251ccb1d7c19648
7
+ data.tar.gz: 2753e71f3e281e9b2f08c2d670a1758ae1cf67f5f9f1fe6f4393a33c576b092f14b74c053cc805c5442945b551683c98ea64d209b37f84dd9b3bb86120f77939
data/.env.example ADDED
@@ -0,0 +1 @@
1
+ GOOGLE_DIRECTIONS_API_KEY=
data/.gitignore CHANGED
@@ -10,3 +10,6 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ *.gem
15
+ .env
data/Gemfile CHANGED
@@ -2,5 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
- # Specify your gem's dependencies in google_directions_api.gemspec
5
+ group :test do
6
+ gem 'rspec'
7
+ end
8
+
6
9
  gemspec
@@ -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
@@ -1,3 +1,3 @@
1
1
  module GoogleDirectionsApi
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  end
@@ -1,4 +1,6 @@
1
- require 'google_directions_api/version'
1
+ require 'dotenv/load'
2
+ require_relative 'google_directions_api/version'
3
+ require_relative 'google_directions_api/client'
2
4
 
3
5
  # Root module
4
6
  module GoogleDirectionsApi
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.1.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: