lita-garfield 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7490702ec77f0f040e85757a2e9172f8ea50e58b
4
- data.tar.gz: 2abf12c7c96322330414a67a91ad7823f470418b
3
+ metadata.gz: 1b0e991cac33fbb85cdcb0cab2df78cf001dafb7
4
+ data.tar.gz: 815a937b11a23d189359a850aa0548cdc1408ca4
5
5
  SHA512:
6
- metadata.gz: 8735b88b1fa85d776077a5f2487bfe5cf6e4936a40db0738b17cacfe63847f02d18c26e38921c466dbf7a06080000c40f6c53de1c3794b11e27a43d5855ae8ed
7
- data.tar.gz: aac7f2dfeb98bd20247f3f161001d831a243b62d89fdc36f10843276488c9e4e69c58a1c7e10338ce16860e66bd75e4eedeb14088440d355e473592b15c5f199
6
+ metadata.gz: 75dc8cc838cda255ac34cbad7a288fbe3628080ce1d923b4cea36f64eb17ed2b80d646c46b984d4ded7c459e9328359626b0a88415ede87464842ed6aee512ec
7
+ data.tar.gz: d783dea5c42136e8b6190a4f052c9f0b25ac7210958770a2c1dc147c16cf43e7c018db560e4a60286bad7e8f74a10bdc14b6971dbe6765be3924b2cd9e08542d
data/README.md CHANGED
@@ -17,14 +17,23 @@ gem 'lita-garfield'
17
17
  ## Usage
18
18
 
19
19
  !garfield random - Get a random garfield comic.
20
+
20
21
  !garfield - Get today's garfield, or a random one if you've already seen today's.*
22
+
21
23
  !garfield 1/1/1980 - Get a garfield for a m/d/y date.
24
+
22
25
  !garfield 1980-1-1 - Get a garfield for a y-m-d date.
26
+
23
27
  !garfield 1-1-1980 - Get a garfield for a m-d-y date.
28
+
24
29
  !garfield first - Get the first garfield comic.
30
+
25
31
  !garfield last - Get the last garfield comic.
32
+
26
33
  !garfield today - Get today's garfield comic.
34
+
27
35
  !garfield prev - Get the previous day's comic based on the last one you displayed.
36
+
28
37
  !garfield next - Get the next day's comic based on the last on you displayed.
29
38
 
30
- * Coming soon to a Lita handler near you.
39
+ \* Coming soon to a Lita handler near you.
@@ -1,26 +1,26 @@
1
1
  module Lita
2
2
  module Handlers
3
3
  class Garfield < Handler
4
- route(/^!garfield random$/i, :handle_random_garfield,
5
- help: { '!garfield random' => 'Get a random garfield comic.'})
6
- route(/^!garfield$/i, :handle_default_garfield,
7
- help: { '!garfield' => 'Get today\'s garfield, or a random one if you\'ve already seen today\'s.'})
8
- route(/^!garfield (\d{1,2})-(\d{1,2})-(\d{2,4})$/i, :handle_mdy_garfield,
9
- help: { '!garfield' => 'Get a garfield for a m/d/y date.'})
10
- route(/^!garfield (\d{2,4})-(\d{1,2})-(\d{1,2})$/i, :handle_ymd_garfield,
11
- help: { '!garfield' => 'Get a garfield for a y-m-d date.'})
12
- route(/^!garfield (\d{1,2})\/(\d{1,2})\/(\d{2,4})$/i, :handle_mdy_garfield,
13
- help: { '!garfield' => 'Get a garfield for a m-d-y date.'})
14
- route(/^!garfield first$/i, :handle_first_garfield,
15
- help: { '!garfield first' => 'Get the first garfield comic.'})
16
- route(/^!garfield last$/i, :handle_today_garfield,
17
- help: { '!garfield last' => 'Get the last garfield comic.'})
18
- route(/^!garfield today$/i, :handle_today_garfield,
19
- help: { '!garfield today' => 'Get today\'s garfield comic.'})
20
- route(/^!garfield prev$/i, :handle_prev_garfield,
21
- help: { '!garfield prev' => 'Get the previous garfield comic.'})
22
- route(/^!garfield next$/i, :handle_next_garfield,
23
- help: { '!garfield next' => 'Get next garfield comic.'})
4
+ route(/^garfield random$/i, :handle_random_garfield,
5
+ help: { 'garfield random' => 'Get a random garfield comic.'})
6
+ route(/^garfield$/i, :handle_default_garfield,
7
+ help: { 'garfield' => 'Get today\'s garfield, or a random one if you\'ve already seen today\'s.'})
8
+ route(/^garfield (\d{1,2})-(\d{1,2})-(\d{2,4})$/i, :handle_mdy_garfield,
9
+ help: { 'garfield' => 'Get a garfield for a m/d/y date.'})
10
+ route(/^garfield (\d{2,4})-(\d{1,2})-(\d{1,2})$/i, :handle_ymd_garfield,
11
+ help: { 'garfield' => 'Get a garfield for a y-m-d date.'})
12
+ route(/^garfield (\d{1,2})\/(\d{1,2})\/(\d{2,4})$/i, :handle_mdy_garfield,
13
+ help: { 'garfield' => 'Get a garfield for a m-d-y date.'})
14
+ route(/^garfield first$/i, :handle_first_garfield,
15
+ help: { 'garfield first' => 'Get the first garfield comic.'})
16
+ route(/^garfield last$/i, :handle_today_garfield,
17
+ help: { 'garfield last' => 'Get the last garfield comic.'})
18
+ route(/^garfield today$/i, :handle_today_garfield,
19
+ help: { 'garfield today' => 'Get today\'s garfield comic.'})
20
+ route(/^garfield prev$/i, :handle_prev_garfield,
21
+ help: { 'garfield prev' => 'Get the previous garfield comic.'})
22
+ route(/^garfield next$/i, :handle_next_garfield,
23
+ help: { 'garfield next' => 'Get next garfield comic.'})
24
24
 
25
25
  def get_garfield_for_today(username)
26
26
  date = Date.today
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-garfield'
3
- spec.version = '0.0.0'
3
+ spec.version = '0.0.1'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'Tosses links to Garfield comics into chat.'
@@ -1,17 +1,17 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Lita::Handlers::Garfield, lita_handler: true do
4
4
 
5
- it { is_expected.to route('!garfield') }
6
- it { is_expected.to route('!garfield random') }
7
- it { is_expected.to route('!garfield first') }
8
- it { is_expected.to route('!garfield last') }
9
- it { is_expected.to route('!garfield today') }
10
- it { is_expected.to route('!garfield 5/5/1998') }
11
- it { is_expected.to route('!garfield 5-5-1998') }
12
- it { is_expected.to route('!garfield 1998-5-5') }
13
- it { is_expected.to route('!garfield prev') }
14
- it { is_expected.to route('!garfield next') }
5
+ it { is_expected.to route('garfield') }
6
+ it { is_expected.to route('garfield random') }
7
+ it { is_expected.to route('garfield first') }
8
+ it { is_expected.to route('garfield last') }
9
+ it { is_expected.to route('garfield today') }
10
+ it { is_expected.to route('garfield 5/5/1998') }
11
+ it { is_expected.to route('garfield 5-5-1998') }
12
+ it { is_expected.to route('garfield 1998-5-5') }
13
+ it { is_expected.to route('garfield prev') }
14
+ it { is_expected.to route('garfield next') }
15
15
 
16
16
  def zero_prefix(dat)
17
17
  if dat.to_i < 10
@@ -27,54 +27,54 @@ describe Lita::Handlers::Garfield, lita_handler: true do
27
27
  end
28
28
 
29
29
  it 'will return a random garfield comic' do
30
- send_message '!garfield random'
30
+ send_message 'garfield random'
31
31
  expect(replies.last).to include('https://garfield.com/uploads/strips/')
32
32
  end
33
33
 
34
34
  it 'will return a today\'s then a random garfield comic' do
35
- send_message '!garfield'
35
+ send_message 'garfield'
36
36
  expect(replies.last).to include("https://garfield.com/uploads/strips/#{get_todays_image_filename}.jpg")
37
- send_message '!garfield'
37
+ send_message 'garfield'
38
38
  expect(replies.last).to include('https://garfield.com/uploads/strips/')
39
39
  end
40
40
 
41
41
  it 'will return today\'s garfield comic' do
42
- send_message '!garfield today'
42
+ send_message 'garfield today'
43
43
  expect(replies.last).to include("https://garfield.com/uploads/strips/#{get_todays_image_filename}.jpg")
44
44
  end
45
45
 
46
46
  it 'will return today\'s garfield comic' do
47
- send_message '!garfield last'
47
+ send_message 'garfield last'
48
48
  expect(replies.last).to include("https://garfield.com/uploads/strips/#{get_todays_image_filename}.jpg")
49
49
  end
50
50
 
51
51
  it 'will return the first garfield comic' do
52
- send_message '!garfield first'
52
+ send_message 'garfield first'
53
53
  expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-19.jpg')
54
54
  end
55
55
 
56
56
  it 'will return a garfield comic for a specific y-m-d date' do
57
- send_message '!garfield 1998-5-5'
57
+ send_message 'garfield 1998-5-5'
58
58
  expect(replies.last).to include('https://garfield.com/uploads/strips/1998-05-05.jpg')
59
59
  end
60
60
 
61
61
  it 'will return a garfield comic for a specific m-d-y date' do
62
- send_message '!garfield 5-5-1998'
62
+ send_message 'garfield 5-5-1998'
63
63
  expect(replies.last).to include('https://garfield.com/uploads/strips/1998-05-05.jpg')
64
64
  end
65
65
 
66
66
  it 'will return a garfield comic for a specific / date' do
67
- send_message '!garfield 5/5/1998'
67
+ send_message 'garfield 5/5/1998'
68
68
  expect(replies.last).to include('https://garfield.com/uploads/strips/1998-05-05.jpg')
69
69
  end
70
70
 
71
71
  # Test the saved state of the last comic you requested.
72
72
  it 'will return the first and then the next and then the previous garfield comic' do
73
- send_message '!garfield first'
73
+ send_message 'garfield first'
74
74
  expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-19.jpg')
75
- send_message '!garfield next'
75
+ send_message 'garfield next'
76
76
  expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-20.jpg')
77
- send_message '!garfield prev'
77
+ send_message 'garfield prev'
78
78
  expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-19.jpg')
79
79
  end
80
80
 
@@ -84,13 +84,13 @@ describe Lita::Handlers::Garfield, lita_handler: true do
84
84
  first = 'https://garfield.com/uploads/strips/1978-06-19.jpg'
85
85
  last = "https://garfield.com/uploads/strips/#{today.year}-#{zero_prefix today.month}-#{zero_prefix today.day}.jpg"
86
86
 
87
- send_message '!garfield first'
87
+ send_message 'garfield first'
88
88
  expect(replies.last).to include(first)
89
- send_message '!garfield prev'
89
+ send_message 'garfield prev'
90
90
  expect(replies.last).to include(first)
91
- send_message '!garfield last'
91
+ send_message 'garfield last'
92
92
  expect(replies.last).to include(last)
93
- send_message '!garfield next'
93
+ send_message 'garfield next'
94
94
  expect(replies.last).to include(last)
95
95
  end
96
96
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-garfield
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita