lita-directions 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 473f1cd0c55976f5e1126d337afc5eb1687c624c
4
- data.tar.gz: a2cb67bf7ce7a920bfc14776f675fdd8f6e18c2c
3
+ metadata.gz: 95a02679515fbb2e1ddd29d085252ddbc295d958
4
+ data.tar.gz: 410b70b78e6989df89c722fcf6e0a9140f427d93
5
5
  SHA512:
6
- metadata.gz: 8323f92c5b95b0ac255697c8f1a2a9b261b0ec4dc0c97415c7758f986f82446c2d56c40fe2bb4cf8213a6ae4c6a7f9b966d2105aea8bf931a5057c3d0f5fdeae
7
- data.tar.gz: 73d02f6faa622fb54384319c74ce9e694fb30090a59df6b8977103fc27e26cf1f900036aa58d45f34149743b70a102463941156fc08c360703cc3d3b31201425
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')}.")
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-directions"
3
- spec.version = "1.0.1"
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.1
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-21 00:00:00.000000000 Z
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.3
110
+ rubygems_version: 2.4.5
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: See Description