lita-directions 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 95a02679515fbb2e1ddd29d085252ddbc295d958
4
- data.tar.gz: 410b70b78e6989df89c722fcf6e0a9140f427d93
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWNjNmFhNTUyNmJkZTBlM2E1MjBkNDZiNTAzNTBlZmM4NDE2NmUyNg==
5
+ data.tar.gz: !binary |-
6
+ NzE4Mjc0ZjlkYmNiZDI3OGJhMzRiMjJlMTcxNTQ5YzgyNzlhY2Y5Mg==
5
7
  SHA512:
6
- metadata.gz: 2b18fa4265a5896786e8c4b0d453b3b0aafd57802d580a6196fe93409c4ab760b7ccbb41e256c62482ecdf7e1a9903e916075a28ad2e6987337cf584db7789c8
7
- data.tar.gz: bcea552396ca31937ab8dde1148ec2b34a3d49f25a07bc2b1a182654a36e99d3cb16dd40d94d3027b2ada359ad8f1bf74f1cee9571431e97727305faa2e0a1d2
8
+ metadata.gz: !binary |-
9
+ YjBjZWE2NmIyOTI3OWJhMDgzNDBkOTEzOGJmMmMzMDc0MzZjNDNjMmM2MWVh
10
+ NDAwMmViMWU0MjgxM2Q0YjY1MGNmZmNjMzIwNjViNmMxYzkzZWE3OWFmMGYx
11
+ YWU2NzIwNzlmNGJiYWRmYWY4NjkyNmUyZTZkMmIzYTZmNTcwYjk=
12
+ data.tar.gz: !binary |-
13
+ YjBhMGI3MzlhNTM0MGU1MmFmODk3NzcwYWI1Yjc4MjYwNmZmODEzYTE4MGRk
14
+ NDNmODkwMTVjMTA4ZjFiYmQ4YzRkNjg5NjYyMmM3YmFlY2Q5NDJjZThiYjRl
15
+ MjE5OTZmZjFlZmU0M2M5MjJmNjdlZmExNDJhN2I3Y2NiZTgxMzQ=
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea/
data/.travis.yml CHANGED
@@ -1,8 +1,19 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
3
+ - 2.0.0
4
4
  script: bundle exec rake
5
5
  before_install:
6
- - gem update --system
6
+ - gem update --system
7
7
  services:
8
- - redis-server
8
+ - redis-server
9
+ notifications:
10
+ slack:
11
+ secure: AQh7orZIDtRht4Ixs6Sl2GZ7iMadoHcERKm6bmjyDYxzW/5ozaaFyaBTg+hHqqex1j0TSYr0M8HIS40M32JCH2iSc6gltCpcnf5NtWLeKKvDMMgGfOatZH1y4y0AyKQt8H7zqZeMp9lcQJksFyWq74YOoj876LuUpkeN+mRnSphbsnwKqjhDpXEG3umnu0Bkeuuw90ZJS9H8tpHpzRhiQv6+OgdicbT7SyCSk5nLO4Ru2hqJK/nhtu167Dtz+afc1VWunVSl2ml4csxAuTvm3OHMpN5QoSxIp6t1xFg2qZVONEPipDmEeia9ArpyiyF9IKBkbb7fML4uappxWp1xR1MawEZeuTiQ8UATJRuNjP83IdTP9+QnhgFAp/w8h9HDHhqL+T7P01awF+ISQxfJuzxTWJiuxjgARn0Dm1OZS0AOIryVO2AJckR1wM98fDxFpJ1AsSS6eQpsklzRdoQPt7Najjns0x5ZjW3H/09LTiqOZHWz6u0hyvOZbuNeHWT2usS8RZwC6VEPjMdVj3gn5h/vWuOMr8hYg8mZnfxkMm2fSHP6UnlB2N1dOxBif77NrZX/CGxnXjF/+4RbIz/lKyG/rsMbrAav4ep9tG30KZD53Vj3oGpzIPhdrdotfa7wO3GE/IA0drDYzDQZ2ppPjHHfJe/6brXsx22nVOEm7pI=
12
+ deploy:
13
+ provider: rubygems
14
+ api_key:
15
+ secure: iyrMMWzVTvi+2+KYBK69vSuqxul1KYEJIHg0RGUhXjTJjFuUfO6oKA81iHdFVeijGVnqBm4huLYbqb5Xq8tF5SbfGI5peezyZudPMcPHGyPoMFBvu5IZHjA5QNvPXmIdc3L2D5GET9oCuTZGcG+VlxSF60QrPfyn9cxyLwE3pVy4wAQdysPv0Eb9h6kxhwK4VrlzLT7ckZIVhxIm82gyZWpd0tQZdKm2KfaYIK6euqCBYM8me7u5AW7kOFmLnF5I7Ovh98X8xsTBUMEMIXxS0HgxP1mvgbdwQVyrAG/98lT/8CGfUIGAMSdf9yT99NS8Qx5/SmAY2VMqIvmTN8xkTy+0yhdbxX7S8wxdLCWHz2sLhieu0rfMqd8rWp0/kwHaolVjpSPOTgKMYGzPwP7m6UlGSUK2NPlPKW7Bvj1QgXS28/Wga0KLIaoMQLvS85zixCbm60ylhvguiO2Yh/R5QcyUMqxxvveRVWt+gAsFU3+6wUqgR0NRUMSCX2G5vBy/7iM5S4Sa0HpKlWMDgJithuB0rZX0MHomDIUYSqzz3Q93xgrr7KBNYS2v99pu6pv5rGf6tspQN+EtD/LtdBDX/Pv/dSTPX5O8oW5MwhWq+A8Q7Z5bzLBGf0bvxs5OLt+47D0JF3+o4XnTVQ7MovYRBW+yDN7KUPf8Qj8G31kaZZA=
16
+ gem: lita-directions
17
+ on:
18
+ tags: true
19
+ repo: cashman04/lita-directions
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ gem 'simplecov', :require => false, :group => :test
4
+ gem 'coveralls'
5
+ gem 'rake'
6
+
3
7
  gemspec
data/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # lita-directions
2
2
 
3
+ [![Build Status](https://travis-ci.org/cashman04/lita-directions.png?branch=master)](https://travis-ci.org/cashman04/lita-directions)
4
+ [![Coverage Status](https://coveralls.io/repos/cashman04/lita-directions/badge.svg?branch=master&service=github)](https://coveralls.io/github/cashman04/lita-directions?branch=master)
5
+
6
+ ## Installation
7
+
8
+ Add lita-directions to your Lita instance's Gemfile:
9
+ =======
3
10
  A handler for [Lita](http://lita.io/) that returns the distance and time between two locations via the google directions api and also returns a link to the directions via google maps.
4
11
 
5
12
  ## Installation
@@ -12,6 +19,9 @@ gem "lita-directions"
12
19
 
13
20
  ## Configuration
14
21
 
22
+
23
+ ## Usage
24
+
15
25
  This plugin requires a api key from The Google Directions api.
16
26
 
17
27
  ``` ruby
@@ -33,4 +43,3 @@ Lita: LGA to SFO
33
43
  [MIT](http://opensource.org/licenses/MIT)
34
44
 
35
45
 
36
-
@@ -4,4 +4,4 @@ Lita.load_locales Dir[File.expand_path(
4
4
  File.join("..", "..", "locales", "*.yml"), __FILE__
5
5
  )]
6
6
 
7
- require "lita/handlers/directions"
7
+ require "lita/handlers/directions"
@@ -5,7 +5,9 @@ module Lita
5
5
  require 'uri'
6
6
  config :google_api_key
7
7
 
8
- route(/^(?:(?:how|do|I|you|get|far|is|it|from)\s+)*(.+)\s+to\s+(.+)/i, :get_directions, command: true)
8
+ route(/(?:(?:how|do|I|you|get|far|is|it)\s+)from\s+(.+)\s+to\s+(.+)/i, :get_directions, command: true)
9
+
10
+
9
11
  def get_directions(response)
10
12
  if Lita.config.handlers.directions.google_api_key.nil?
11
13
  response.reply("Please get an API key from https://console.developers.google.com, and follow the instructions on https://github.com/cashman04/lita-directions to configure.")
@@ -15,8 +17,13 @@ module Lita
15
17
  to = response.matches[0][1]
16
18
  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
19
  results = JSON.parse(RestClient.get(json_ip_url))
20
+ if Lita.config.robot.log_level == :debug
21
+ puts "from: #{from}"
22
+ puts "to: #{to}"
23
+ puts results
24
+ end
18
25
  if results['routes'].any?
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')}.")
26
+ response.reply("It is a #{results['routes'][0]['legs'][0]['distance']['text'].gsub('mi', 'mile')} 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')}.")
20
27
  response.reply(URI.encode("https://www.google.com/maps/dir/#{from}/#{to}/"))
21
28
  else
22
29
  response.reply(["Umm, you might want to double-check that.", "I think you did it wrong.", "There was an error, I think it was your fault.", "I'm pretty sure you messed up.", "Are you sure you read the directions?"].sample)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-directions"
3
- spec.version = "1.0.2"
3
+ spec.version = "1.0.3"
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}
@@ -1,4 +1,13 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Lita::Handlers::Directions, lita_handler: true do
4
+
5
+
6
+ it { is_expected.to route("Lita, how far is it from San Francisco to New York").to(:get_directions) }
7
+ it { is_expected.to route("Lita how far from Chicago to 10001").to(:get_directions) }
8
+ it { is_expected.to route("Lita, how do I get from Los Angeles to Vegas").to(:get_directions) }
9
+ it { is_expected.to route("Lita how do you get from Kansas City to Denver").to(:get_directions) }
10
+
11
+
12
+
4
13
  end
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,8 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
6
  ]
7
7
  SimpleCov.start { add_filter "/spec/" }
8
8
 
9
+
10
+
9
11
  require "lita-directions"
10
12
  require "lita/rspec"
11
13
  # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
File without changes
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-directions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
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-22 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 3.0.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.0
69
69
  description: A Lita handler to get time/distance calculations and provide directions
@@ -74,8 +74,8 @@ executables: []
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - ".gitignore"
78
- - ".travis.yml"
77
+ - .gitignore
78
+ - .travis.yml
79
79
  - Gemfile
80
80
  - LICENSE
81
81
  - README.md
@@ -86,6 +86,7 @@ files:
86
86
  - locales/en.yml
87
87
  - spec/lita/handlers/directions_spec.rb
88
88
  - spec/spec_helper.rb
89
+ - templates/.gitkeep
89
90
  homepage: https://github.com/cashman04/lita-directions/
90
91
  licenses:
91
92
  - MIT
@@ -97,12 +98,12 @@ require_paths:
97
98
  - lib
98
99
  required_ruby_version: !ruby/object:Gem::Requirement
99
100
  requirements:
100
- - - ">="
101
+ - - ! '>='
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  required_rubygems_version: !ruby/object:Gem::Requirement
104
105
  requirements:
105
- - - ">="
106
+ - - ! '>='
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  requirements: []