lita-directions 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/directions.rb +2 -2
- data/lita-directions.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95a02679515fbb2e1ddd29d085252ddbc295d958
|
4
|
+
data.tar.gz: 410b70b78e6989df89c722fcf6e0a9140f427d93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b18fa4265a5896786e8c4b0d453b3b0aafd57802d580a6196fe93409c4ab760b7ccbb41e256c62482ecdf7e1a9903e916075a28ad2e6987337cf584db7789c8
|
7
|
+
data.tar.gz: bcea552396ca31937ab8dde1148ec2b34a3d49f25a07bc2b1a182654a36e99d3cb16dd40d94d3027b2ada359ad8f1bf74f1cee9571431e97727305faa2e0a1d2
|
@@ -2,7 +2,7 @@ module Lita
|
|
2
2
|
module Handlers
|
3
3
|
class Directions < Handler
|
4
4
|
require 'rest-client'
|
5
|
-
|
5
|
+
require 'uri'
|
6
6
|
config :google_api_key
|
7
7
|
|
8
8
|
route(/^(?:(?:how|do|I|you|get|far|is|it|from)\s+)*(.+)\s+to\s+(.+)/i, :get_directions, command: true)
|
@@ -13,7 +13,7 @@ module Lita
|
|
13
13
|
end
|
14
14
|
from = response.matches[0][0]
|
15
15
|
to = response.matches[0][1]
|
16
|
-
json_ip_url = "https://maps.googleapis.com/maps/api/directions/json?origin=#{from}&destination=#{to}&key=#{Lita.config.handlers.directions.google_api_key}"
|
16
|
+
json_ip_url = URI.escape("https://maps.googleapis.com/maps/api/directions/json?origin=#{from}&destination=#{to}&key=#{Lita.config.handlers.directions.google_api_key}")
|
17
17
|
results = JSON.parse(RestClient.get(json_ip_url))
|
18
18
|
if results['routes'].any?
|
19
19
|
response.reply("It is a #{results['routes'][0]['legs'][0]['distance']['text'].gsub('mi', 'miles')} drive from #{results['routes'][0]['legs'][0]['start_address'].gsub(', USA', '').gsub(/\d{5}/, '')} to #{results['routes'][0]['legs'][0]['end_address'].gsub(', USA', '').gsub(/\d{5}/, '')}. The approximate drive time is #{results['routes'][0]['legs'][0]['duration']['text'].gsub('mins', 'minutes')}.")
|
data/lita-directions.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-directions"
|
3
|
-
spec.version = "1.0.
|
3
|
+
spec.version = "1.0.2"
|
4
4
|
spec.authors = ["Dan Cash"]
|
5
5
|
spec.email = ["dancash04@gmail.com"]
|
6
6
|
spec.description = %q{A Lita handler to get time/distance calculations and provide directions from google maps}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-directions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Cash
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.4.
|
110
|
+
rubygems_version: 2.4.5
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: See Description
|