google-distance-ruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+
3
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gem "httparty"
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ google-distance-ruby
2
+ ====================
3
+
4
+ Ruby client to get the distance between two cities from Google Distance Matrix API.
@@ -0,0 +1,12 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "google-distance-ruby"
3
+ s.version = "0.0.2"
4
+ s.date = "2014-06-20"
5
+ s.summary = "Google Distance Ruby"
6
+ s.description = "A gem to get the distance between two cities."
7
+ s.authors = ["Alexei Telles"]
8
+ s.email = "alexeitsb@gmail.com"
9
+ s.files = `git ls-files`.split($/)
10
+ s.homepage = "http://rubygems.org/gems/google-distance-ruby"
11
+ s.license = "MIT"
12
+ end
@@ -1,12 +1,11 @@
1
- # encoding: UTF-8
2
1
  require "httparty"
3
2
 
4
- class GetTheDistance
3
+ class GoogleDistanceRuby
5
4
  def initialize(key)
6
5
  @key = key
7
6
  end
8
7
 
9
- def calculate(origin, destination)
8
+ def distance(origin, destination)
10
9
  result = HTTParty.get("https://maps.googleapis.com/maps/api/distancematrix/json?origins=" + origin + "&destinations=" + destination + "&key=" + @key)
11
10
  if result.code == 200
12
11
  return {
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.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -17,6 +17,10 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - .gitignore
21
+ - Gemfile
22
+ - README.md
23
+ - google-distance-ruby.gemspec
20
24
  - lib/google-distance-ruby.rb
21
25
  homepage: http://rubygems.org/gems/google-distance-ruby
22
26
  licenses: