google-distance-ruby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/google-distance-ruby.gemspec +2 -2
- data/lib/google-distance-ruby.rb +2 -1
- metadata +2 -2
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "google-distance-ruby"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.4"
|
4
4
|
s.date = "2014-06-20"
|
5
5
|
s.summary = "Google Distance Ruby"
|
6
|
-
s.description = "A gem to get the distance between two
|
6
|
+
s.description = "A gem to get the distance between two points."
|
7
7
|
s.authors = ["Alexei Telles"]
|
8
8
|
s.email = "alexeitsb@gmail.com"
|
9
9
|
s.files = `git ls-files`.split($/)
|
data/lib/google-distance-ruby.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "httparty"
|
2
|
+
require "cgi"
|
2
3
|
|
3
4
|
class GoogleDistanceRuby
|
4
5
|
def initialize(key)
|
@@ -6,7 +7,7 @@ class GoogleDistanceRuby
|
|
6
7
|
end
|
7
8
|
|
8
9
|
def distance(origin, destination)
|
9
|
-
result = HTTParty.get("https://maps.googleapis.com/maps/api/distancematrix/json?origins=" + origin + "&destinations=" + destination + "&key=" + @key)
|
10
|
+
result = HTTParty.get("https://maps.googleapis.com/maps/api/distancematrix/json?origins=" + CGI.escape(origin) + "&destinations=" + CGI.escape(destination) + "&key=" + @key)
|
10
11
|
if result.code == 200
|
11
12
|
return {
|
12
13
|
origin: result["origin_addresses"][0],
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-distance-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2014-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: A gem to get the distance between two
|
14
|
+
description: A gem to get the distance between two points.
|
15
15
|
email: alexeitsb@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|