lita-onewheel-halfstaff 0.1.2 → 0.2.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9502983a107c4791eb493f93759410db6d9ecc41
|
4
|
+
data.tar.gz: cf82b16c85cc73962a3d6d4f52c1abd8095491ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2fff00158cb85df20de12fbc50a67cdf9ca96d7592b07e1b33c8e8053d67c27a9d6c47a1df84bfffe852b28fc0da8cc5263bf192d2edfc86d941528894bd806
|
7
|
+
data.tar.gz: 96612331d3be0450592afbc8dc4a33feeea76595db89fe8ceee287d7126daaa4d2c9d0110feff6e0e83d595ddac3a033b1b5d52f5e07ebacecd26575846e125e
|
@@ -67,6 +67,12 @@ module Lita
|
|
67
67
|
end_month = date_matches[3]
|
68
68
|
end_day = date_matches[4]
|
69
69
|
half_staff = does_today_match_date_range(start_month, start_day, end_month, end_day, current_year)
|
70
|
+
elsif date_matches = pieces[0].match(/(\w+)\s+(\d+) until the (\d+)\w+, (\d+)/i) # March 7 until the 11th, 2016
|
71
|
+
# Lita.logger.info 'until sunset'
|
72
|
+
start_month = date_matches[1]
|
73
|
+
start_day = date_matches[2]
|
74
|
+
end_day = date_matches[3]
|
75
|
+
half_staff = does_today_match_date_range(start_month, start_day, start_month, end_day, current_year)
|
70
76
|
else
|
71
77
|
Lita.logger.info "Couldn't match #{pieces[0]}"
|
72
78
|
end
|
@@ -75,10 +81,10 @@ module Lita
|
|
75
81
|
half_staff
|
76
82
|
end
|
77
83
|
|
78
|
-
def does_today_match_date_range(
|
79
|
-
start_time = DateTime::parse("#{
|
80
|
-
end_time = DateTime::parse("#{
|
81
|
-
return (start_time..end_time).
|
84
|
+
def does_today_match_date_range(start_month, start_day, end_month, end_day, current_year)
|
85
|
+
start_time = DateTime::parse("#{start_month} #{start_day} #{current_year} 00:00")
|
86
|
+
end_time = DateTime::parse("#{end_month} #{end_day} #{current_year} 23:59:59")
|
87
|
+
return (start_time..end_time).cover? DateTime.now
|
82
88
|
end
|
83
89
|
|
84
90
|
def get_history(response)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-onewheel-halfstaff'
|
3
|
-
spec.version = '0.
|
3
|
+
spec.version = '0.2.0'
|
4
4
|
spec.authors = ['Andrew Kreps']
|
5
5
|
spec.email = ['andrew.kreps@gmail.com']
|
6
6
|
spec.description = %q{View the current US flag half-staff status.}
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
15
|
spec.require_paths = ['lib']
|
16
16
|
|
17
|
-
spec.add_runtime_dependency 'lita', '~> 4'
|
17
|
+
spec.add_runtime_dependency 'lita', '~> 4.7'
|
18
18
|
spec.add_runtime_dependency 'rest-client', '~> 1.8'
|
19
19
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
20
20
|
|
@@ -303,6 +303,12 @@ Production: 7 2013
|
|
303
303
|
</div>
|
304
304
|
<b><br/>
|
305
305
|
<inline style="font-size: 25px;"><center>Click on the appropriate link below</center></inline></b><hr/><br/>
|
306
|
+
<a href="http://www.flagsexpress.com/Articles.asp?ID=552"><b><inline style="color: rgb(192, 80, 77);">March 9-10, 2016 - COLORADO ONLY - Honoring Las Animas County Deputy Sheriff Travis Russell </inline></b></a><br/><hr/><br/>
|
307
|
+
<a href="http://www.flagsexpress.com/Articles.asp?ID=551">March 7, 2016 - OKLAHOMA ONLY - Honoring Former Representative Steve Boeckman </a><br/><hr/><br/>
|
308
|
+
<a href="http://www.flagsexpress.com/Articles.asp?ID=550"><b><inline style="color: rgb(192, 80, 77);">March 7 until the 11th, 2016 - ENTIRE UNITED STATES - Honoring Nancy Reagan </inline></b></a><br/><hr/><br/>
|
309
|
+
<a href="http://www.flagsexpress.com/Articles.asp?ID=549">March 4, 2016 - LOUISIANA ONLY - Honoring State Representative Ronnie Edwards </a><br/><hr/><br/>
|
310
|
+
<a href="http://www.flagsexpress.com/Articles.asp?ID=548">March 2, 2016 - MASSACHUSETTS ONLY - Honoring Major Glenn G. Milliken, Massachusetts Air National Guard, of Wilbraham, MA </a><br/><hr/><br/>
|
311
|
+
<a href="http://www.flagsexpress.com/Articles.asp?ID=547">March 1, 2016 - VIRGINIA ONLY - Honoring Prince William County Police Department Officer Ashley Guindon</a><br/><hr/><br/>
|
306
312
|
<a href="http://www.flagsexpress.com/Articles.asp?ID=546"><b><inline style="color: rgb(192, 80, 77);">February 26, 2016 - KANSAS ONLY - Honoring the victims of the Hesston shootings</inline></b></a><br/><hr/><br/>
|
307
313
|
<a href="http://www.flagsexpress.com/Articles.asp?ID=545"><b><inline style="color: rgb(192, 80, 77);">February 26, 2016 - MINNESOTA ONLY - Honoring Marine Corps Sergeant and Delano, Minnesota resident Dillion J. Semolina</inline></b></a><br/><hr/><br/>
|
308
314
|
<a href="http://www.flagsexpress.com/Articles.asp?ID=544">February 25, 2016 - WASHINGTON ONLY - Honoring National Guard SSG Matthew McClintock</a><br/><hr/><br/>
|
@@ -14,8 +14,10 @@ describe Lita::Handlers::OnewheelHalfstaff, lita_handler: true do
|
|
14
14
|
it { is_expected.to route_command('halfmast history') }
|
15
15
|
|
16
16
|
it 'gives half-staff status' do
|
17
|
-
|
18
|
-
|
17
|
+
Timecop.freeze(Time.local(2016, 2, 2, 10, 5, 0)) do
|
18
|
+
send_command 'halfstaff'
|
19
|
+
expect(["Everything's cool, yo.", "No half staff known."].include? replies.last).to be true
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
it 'gives half-staff affirmative' do
|
@@ -27,6 +29,15 @@ describe Lita::Handlers::OnewheelHalfstaff, lita_handler: true do
|
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
32
|
+
it 'checks some edge cases for multi-day half staffs.' do
|
33
|
+
Timecop.freeze(Time.local(2016, 3, 9, 10, 5, 0)) do
|
34
|
+
send_command 'halfstaff'
|
35
|
+
expect(replies.count).to eq(2)
|
36
|
+
expect(replies[0]).to eq('COLORADO ONLY - Honoring Las Animas County Deputy Sheriff Travis Russell - http://www.flagsexpress.com/Articles.asp?ID=552')
|
37
|
+
expect(replies[1]).to eq('ENTIRE UNITED STATES - Honoring Nancy Reagan - http://www.flagsexpress.com/Articles.asp?ID=550')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
30
41
|
it 'will return history link' do
|
31
42
|
send_command 'halfstaff history'
|
32
43
|
expect(replies.last).to eq('https://en.wikipedia.org/wiki/Half-mast')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-onewheel-halfstaff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kreps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4'
|
19
|
+
version: '4.7'
|
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
|
-
version: '4'
|
26
|
+
version: '4.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rest-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|