lita-onewheel-halfstaff 0.2.1 → 0.3.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
- SHA1:
3
- metadata.gz: 1b361551eab71f11e0f768d1e5dacd87de9bd9e5
4
- data.tar.gz: 77a945d8327bd0d3e2792242f3874d2f73b130fd
2
+ SHA256:
3
+ metadata.gz: b5f625450e4a8f8a6c0ac21fd733dedf6a9c5403a84a542ba26f9433e7e69a72
4
+ data.tar.gz: 5bb57a7cff04c203db3664ef974fa6b056abaab4ac49757a26bcd0c82ec27cf6
5
5
  SHA512:
6
- metadata.gz: 18226bc8110f37834c64b3f6481dec4fe1fff0e5cf53faa00e8e40ed62a1a456a1116824f8cbffc6201906c11dd6d98e2982e9bdc22028c694153ad6f5e97fb3
7
- data.tar.gz: f7e30d8f04550fd2263b8967cef5212b347608ae85f69e46faca29287f8ec3e1c326a773479f8dd00ccb55f149668020790f8638ef4e8a077aa6dfe4c423b3eb
6
+ metadata.gz: 8468d077a67945dc43c5f89953621960ec834b8fe182da64caf0cf9788feef26ccf5da85555efce78beb9620ef357a6edf8a2de9c4a02ebb77b80cbe96d27354
7
+ data.tar.gz: e7d12d4264996308905324190d35cf278d58864b7287e23c64c762a6bedf6efdfd95e062a8b96f377b4067664176de874057d321f1a5ae3bd4a213110345d9bb
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2016 Andrew Kreps
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -28,16 +28,28 @@ module Lita
28
28
  end
29
29
 
30
30
  def get_flag_data
31
- flag_html = RestClient.get 'http://www.flagsexpress.com/HalfStaff_s/1852.htm'
31
+ url = 'http://www.flagsexpress.com/HalfStaff_s/1852.htm'
32
+ Lita.logger.debug "Grabbing #{url}"
33
+ flag_html = RestClient.get url
32
34
  results = []
35
+
33
36
  noko_flag = Nokogiri::HTML flag_html
37
+
38
+ flag_count = 0
39
+
34
40
  noko_flag.css('a').each do |a_tag|
35
- if a_tag['href'].match /http\:\/\/www\.flagsexpress\.com\/Articles\.asp\?ID\=/i
41
+ if a_tag['href'].to_s.match /http\:\/\/www\.flagsexpress\.com\/Articles\.asp\?ID\=/i
36
42
  if is_at_half_staff(a_tag.text)
37
43
  pieces = a_tag.text.split(/ - /)
38
44
  Lita.logger.info 'Returning flag data'
39
45
  results.push build_result_tet(pieces[1], pieces[2], a_tag['href'])
40
46
  end
47
+
48
+ if flag_count > 10
49
+ break
50
+ end
51
+ flag_count += 1
52
+
41
53
  end
42
54
  end
43
55
  results
@@ -52,19 +64,24 @@ module Lita
52
64
  half_staff = false
53
65
  pieces = text.split(/ - /)
54
66
  current_year = Date::today.year
55
- if pieces[0].match(/#{current_year}/)
67
+
68
+ Lita.logger.debug "Parsing #{pieces[0]}"
69
+ if pieces[0].match(/#{current_year}/) or pieces[0].match(/immediately/i)
56
70
  Lita.logger.info "Checking for flag date match on #{text}"
71
+
57
72
  if date_matches = pieces[0].match(/(\w+\s+\d+,\s+\d+)/) # February 26, 2016
58
73
  # Lita.logger.info 'Standard'
59
74
  # Lita.logger.info date_matches[1]
60
75
  date = Date::parse(date_matches[1])
61
76
  half_staff = date == Date::today
77
+
62
78
  elsif date_matches = pieces[0].match(/(\w+)\s+(\d+)-(\d+)/) # March 5-11, 2016
63
79
  # Lita.logger.info 'Date range'
64
80
  month = date_matches[1]
65
81
  day_start = date_matches[2]
66
82
  day_end = date_matches[3]
67
83
  half_staff = does_today_match_date_range(month, day_start, month, day_end, current_year)
84
+
68
85
  elsif date_matches = pieces[0].match(/(\w+)\s+(\d+) until sunset \w+, (\w+)\s+(\d+)/i) # May 3 until sunset Sunday, December 12
69
86
  # Lita.logger.info 'until sunset'
70
87
  start_month = date_matches[1]
@@ -72,12 +89,22 @@ module Lita
72
89
  end_month = date_matches[3]
73
90
  end_day = date_matches[4]
74
91
  half_staff = does_today_match_date_range(start_month, start_day, end_month, end_day, current_year)
92
+
75
93
  elsif date_matches = pieces[0].match(/(\w+)\s+(\d+) until the (\d+)\w+, (\d+)/i) # March 7 until the 11th, 2016
76
94
  # Lita.logger.info 'until sunset'
77
95
  start_month = date_matches[1]
78
96
  start_day = date_matches[2]
79
97
  end_day = date_matches[3]
80
98
  half_staff = does_today_match_date_range(start_month, start_day, start_month, end_day, current_year)
99
+
100
+ elsif date_matches = pieces[0].match(/immediately until (\w+)\s+(\d+)/i) # May 3 until sunset Sunday, December 12
101
+ # Lita.logger.info 'until sunset'
102
+ start_month = 1
103
+ start_day = 1
104
+ end_month = date_matches[1]
105
+ end_day = date_matches[2]
106
+ half_staff = does_today_match_date_range(start_month, start_day, end_month, end_day, current_year)
107
+
81
108
  else
82
109
  Lita.logger.info "Couldn't match #{pieces[0]}"
83
110
  end
@@ -87,8 +114,8 @@ module Lita
87
114
  end
88
115
 
89
116
  def does_today_match_date_range(start_month, start_day, end_month, end_day, current_year)
90
- start_time = DateTime::parse("#{start_month} #{start_day} #{current_year} 00:00")
91
- end_time = DateTime::parse("#{end_month} #{end_day} #{current_year} 23:59:59")
117
+ start_time = DateTime::parse("#{start_month}-#{start_day}-#{current_year} 00:00")
118
+ end_time = DateTime::parse("#{end_month}-#{end_day}-#{current_year} 23:59:59")
92
119
  return (start_time..end_time).cover? DateTime.now
93
120
  end
94
121
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-halfstaff'
3
- spec.version = '0.2.1'
3
+ spec.version = '0.3.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.7'
17
+ spec.add_runtime_dependency 'lita', '~> 4'
18
18
  spec.add_runtime_dependency 'rest-client', '~> 1.8'
19
19
  spec.add_runtime_dependency 'nokogiri', '~> 1.6'
20
20
 
@@ -0,0 +1,510 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html class="no-js" lang="en">
4
+ <head>
5
+ <script type="text/javascript" src="/a/j/milonic/milonic_src.js"></script>
6
+ <script type="text/javascript">
7
+ if(ns4)_d.write("<scr"+"ipt src=/a/j/milonic/mmenuns4.js><\/scr"+"ipt>");
8
+ else _d.write("<scr"+"ipt src=/a/j/milonic/mmenudom.js><\/scr"+"ipt>");
9
+ </script>
10
+ <script type="text/javascript">
11
+ var Config_CDN_URL = '/'
12
+ </script>
13
+ <script type="text/javascript" src="/v/vspfiles/templates/americanflags/Menu_Popout_Styles.js"></script>
14
+ <script type="text/javascript" src="/v/vspfiles/templates/americanflags/Menu_Popout_Data.js"></script>
15
+
16
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
17
+ <title>Half-Staff Alerts</title>
18
+ <meta name="description" content="Buy high wind American Flags and Poles for less - Made in the USA!" />
19
+ <meta name="keywords" content="buy nylon american flags, american made flags, high quality flag, flags made in usa, large american flag for sale, buy flagpole, usa flag store, flagpole accessories, outdoor flagpoles, buy patriotic decorations, parade supplies, pennant strings, polymax american flag" />
20
+ <meta name="robots" content="index, follow" />
21
+ <meta name="GOOGLEBOT" content="INDEX, FOLLOW" />
22
+ <meta name="globalsign-domain-verification" content="q6Vs_ZcmACRhFXRJZnnvE-14pZ-LP1CgfyxWqm386P" />
23
+ <meta name="google-site-verification" content="tziNJYONG67Dm3cUzGKYiO7qwi1lII98_kqFk-P66ZQ"/>
24
+ <meta name="globalsign-domain-verification" content="TcLpzWkqw9Ft_MimLdQ1rSPoFkB6NP2Z626m2VEzZu" />
25
+
26
+ <link rel="canonical" href="https://www.FlagsExpress.com/HalfStaff_s/1994.htm" />
27
+
28
+ <link type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css" rel="stylesheet" />
29
+ <link type="text/css" href="/a/c/default.css" rel="stylesheet" />
30
+
31
+
32
+ <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
33
+ <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>
34
+
35
+
36
+
37
+ <script type="text/javascript">
38
+ var Config_VCompare_MaxProducts = '3';
39
+ var PageText_783 = "Compare";
40
+ var PageText_784 = "Change Selections";
41
+ var PageText_785 = "You've attempted to select more than {0} items. Click {1} to continue with your initial {0} items or {2} to change your selections.";
42
+ var PageText_819 = "Product Comparison";
43
+ var PageText_822 = "Compare";
44
+ var PageText_840 = "Create Password";
45
+ var PageText_841 = "Retype Password";
46
+ var PageText_842 = "Added to cart";
47
+ var PageText_843 = "Subtotal";
48
+ var PageText_844 = "items in cart";
49
+ </script>
50
+ <script type="text/javascript" src="/a/j/volusion.js?7.102.0.3687"></script>
51
+ <script type="text/javascript">
52
+ (function ($) {
53
+ volusion.ready(function () {
54
+ if (volusion.cart.isObservingCount()) {
55
+ var ts = new Date().getTime();
56
+ $.getJSON('/ajaxcart.asp?cachebust=' + ts, function (data) {
57
+ var quantityTotal = 0;
58
+ $.each(data.Products, function (key, val) {
59
+ if (val.IsProduct === 'Y') {
60
+ quantityTotal += parseInt(val.Quantity);
61
+ } else if (val.IsAccessory === 'Y') {
62
+ quantityTotal += parseInt(val.Quantity);
63
+ }
64
+ });
65
+ quantityTotal = quantityTotal || '0';
66
+ volusion.cart.itemCount(quantityTotal);
67
+ });
68
+ }
69
+ });
70
+ } (jQuery));
71
+ </script>
72
+ <link type="text/css" rel="stylesheet" href="/a/contentbuilder/assets/default/content.css" />
73
+ <script type="text/javascript" src="../../a/j/paypal-rest-default-buttons.js"></script>
74
+
75
+
76
+ <script type="text/javascript" src="/a/j/soft_add.js"></script>
77
+ <link type="text/css" rel="stylesheet" href="/a/c/soft_add.css" />
78
+ <script type="text/javascript">
79
+ var global_Config_EnableDisplayOptionProducts = 'False';
80
+ var global_Config_ForceSecureShoppingCartPage = false;
81
+ var global_PageText_OtherItemsAdded = '(All other items have been added to the cart)';
82
+ var Config_EnableSoftAddToCart = true;
83
+ </script>
84
+
85
+ <script type="text/javascript" src="/a/j/soft_add_mult.js"></script>
86
+ <script type="text/javascript" src="/a/j/javascripts.js?6_5_7.102.0.3687"></script>
87
+
88
+ <script type="text/javascript">
89
+ var Config_Search_Auto_Complete = false;
90
+ </script>
91
+
92
+ <script>
93
+ var reCaptchaPreloaded = false;
94
+ var reCaptchaInit;
95
+ </script>
96
+
97
+
98
+
99
+ <!--
100
+ DYNAMIC PAGE-SPECIFIC META TAGS WILL BE PLACED HERE
101
+ DO NOT ADD YOUR OWN META TAGS
102
+ ONLY PUT CSS/JAVSCRIPT INCLUDES IN YOUR HEAD TAG
103
+ -->
104
+
105
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
106
+ <meta name="viewport" content="width=device-width">
107
+ <meta name="google-site-verification" content="xVR3aOJHUDhBZ6pUF2F6N7lFvyrsAcrIlCDSnipmai8" />
108
+ <meta id="v65-layout-mode" data-cart="storedot" data-checkout="storedot" data-use-simplified-checkout="true">
109
+
110
+
111
+ <!--[if lt IE 9]>
112
+ <script src="dist/html5shiv.js"></script>
113
+ <![endif]-->
114
+
115
+ <link href='//fonts.googleapis.com/css?family=Lato:400,700,900,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
116
+ <link href='//fonts.googleapis.com/css?family=Great+Vibes' rel='stylesheet' type='text/css'>
117
+ <link href="/v/vspfiles/templates/americanflags/css/imports.css" rel="stylesheet">
118
+
119
+
120
+ <script src="/v/vspfiles/templates/americanflags/js/design-toolkit_min.js"></script>
121
+ <script>DTK.loadCSS("americanflags");</script> <!-- FOR CHECKOUT -->
122
+
123
+ <script>
124
+ if (PageName() != 'searchresults.asp' && PageName() != 'productdetails.asp') {
125
+ document.write('<' + 'link href="/v/vspfiles/templates/americanflags/css/onlysearchandproducts.css" type="text/css" rel="stylesheet" />');
126
+ }
127
+ </script>
128
+ <!-- Google Analytics -->
129
+ <script>
130
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
131
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
132
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
133
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
134
+
135
+ ga('create', 'UA-685244-1', 'auto');
136
+ ga('send', 'pageview');
137
+ </script>
138
+ </head>
139
+
140
+ <!-- ======================== FILE INFO ========================
141
+ Company: American Flags Express
142
+ Designer: CH
143
+ Developer: JMC
144
+ Production: 7 2013
145
+ ======================== END INFO ======================== -->
146
+
147
+ <body>
148
+ <noscript id="no-js-notice">
149
+ To take full advantage of this site, please enable your browser's JavaScript feature.
150
+ <a href="http://launchpad.volusion.com/kb_results.asp?ID=42" target="_blank">Learn how</a>
151
+ </noscript>
152
+
153
+
154
+ <!-- ======================== HEADER ======================== -->
155
+ <div id="header">
156
+
157
+ <!--if_homepage-->
158
+
159
+
160
+ <div id="display_homepage_title"><span class="vol-logo vol-logo--graphic" itemscope itemtype='http://schema.org/Store'><meta itemprop='name' content='www.FlagsExpress.com'><a class="vol-logo__link" href="https://www.FlagsExpress.com/default.asp" title="www.FlagsExpress.com">www.FlagsExpress.com</a></span></div>
161
+ <!--if_not_homepage-->
162
+
163
+ <div id="siteTools">
164
+ <a href="/employment.html" title="Employment">Employment</a> |
165
+ <a href="/PressRoom.html" title="Press Home">Press Room</a> |
166
+ <a href="/aboutus.asp" title="About American Flags Express">About Us</a> |
167
+ <a href="mailto:KT@flagsexpress.com?subject=Contact Us" title="Contact American Flags Express">Contact Us</a> |
168
+ <a href="/help.asp" title="Site Help">Help</a>
169
+ </div>
170
+
171
+ <span class="helpNumber"><b>Need help?</b> 262.783.4800</span>
172
+ <span class="hours">9am - 5:30pm, M - F CST</span>
173
+ <!--<a href="#" class="livechat"><img src="/v/vspfiles/templates/americanflags/images/template/live-chat.png" height="10" width="81" alt=""></a>-->
174
+
175
+ <div id="cartWrapper">
176
+ <a href="/shoppingcart.asp" class="cartLink">&nbsp;</a>
177
+ <div id="display_cart_summary"><div class="cartsummary_full">0&nbsp;<a href="/ShoppingCart.asp"></a></div></div> <!-- #display_cart_summary -->
178
+ </div>
179
+
180
+ <div id="displaySearch">
181
+ <form action="/SearchResults.asp" method="get" name="SearchBoxForm">
182
+ <input type="text" name="Search" class="searchInput transition" value="" placeholder="What can we help you find?" />
183
+ <input type="submit" name="Submit" class="searchSubmit" value=""/>
184
+ </form>
185
+ </div><!-- #displaySearch -->
186
+
187
+
188
+ </div><!-- #header -->
189
+ <div id="pageWrapper"> </div>
190
+ <!-- ==================== UL LAYOUT ==================== -->
191
+ <div id="topNav" class="clear">
192
+ <div id="display_menu_1" class="menu">
193
+ <script type="text/javascript">var breadCrumb="|1994|";</script>
194
+ <script type="text/javascript">display_menu_1();</script>
195
+ </div>
196
+ </div><!-- #top_nav -->
197
+ <div id="midNav">
198
+ <div id="display_menu_2" class="menu">
199
+ <script type="text/javascript">var breadCrumb="|1994|";</script>
200
+ <script type="text/javascript">
201
+ function mOvr2(src)
202
+ { if (src.className != 'nav nav_hover nav_selected') src.className = 'nav nav_hover'; }
203
+ function mOut2(src)
204
+ { if (src.className != 'nav nav_hover nav_selected') src.className = 'nav'; }
205
+ function mClk2(src, popup)
206
+ { if (!popup) {window.location=src.getElementsByTagName('A')[0].getAttribute('href');} else {window.open(src);} }
207
+ </script>
208
+ <ul>
209
+ <li class="nav nav_hover nav_selected" onmouseover="mOvr2(this);" onmouseout="mOut2(this);" onclick="mClk2(this);">
210
+ <a href="https://www.FlagsExpress.com/HalfStaff_s/1994.htm" title="HalfStaff">Half-Staff Alerts</a>
211
+ </li>
212
+ <li class="nav" onmouseover="mOvr2(this);" onmouseout="mOut2(this);" onclick="mClk2('http://www.flagsexpress.com/product_p/custom-flags.htm', true);">
213
+ <a href="javascript: void(0);" title="">CUSTOM FLAGS</a>
214
+ </li>
215
+ <li class="nav" onmouseover="mOvr2(this);" onmouseout="mOut2(this);" onclick="mClk2(this);">
216
+ <a href="https://www.flagsexpress.com/Articles.asp?ID=1073" title="">Important Cause: DONATE</a>
217
+ </li>
218
+ <li class="nav" onmouseover="mOvr2(this);" onmouseout="mOut2(this);" onclick="mClk2(this);">
219
+ <a href="/Articles.asp?ID=911" title="">Flag Repair</a>
220
+ </li>
221
+ <li class="nav" onmouseover="mOvr2(this);" onmouseout="mOut2(this);" onclick="mClk2(this);">
222
+ <a href="https://www.FlagsExpress.com/category_s/1631.htm" title="">Avenue of Flags</a>
223
+ </li>
224
+ <li class="nav" onmouseover="mOvr2(this);" onmouseout="mOut2(this);" onclick="mClk2(this);">
225
+ <a href="/Articles.asp?ID=276" title="">Flag Disposal</a>
226
+ </li>
227
+ <li class="nav" onmouseover="mOvr2(this);" onmouseout="mOut2(this);" onclick="mClk2(this);">
228
+ <a href="https://www.FlagsExpress.com/category_s/1891.htm" title="">Free Patriotic Stuff</a>
229
+ </li>
230
+ </ul>
231
+ </div><!-- #display_menu_2 -->
232
+ </div>
233
+
234
+
235
+ <!-- ======================== CONTENT ======================== -->
236
+ <div id="contentWrap" class="clear">
237
+ <div id="content" class="clear">
238
+
239
+ <!-- ==================== CONTENT AREA ==================== -->
240
+ <div id="content_area">
241
+ <script type="text/javascript">
242
+ var SearchParams = 'searching=Y&sort=13&cat=1994&show=25&page=1';
243
+ </script>
244
+
245
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
246
+ <tbody>
247
+
248
+ <tr>
249
+ <td>
250
+ <img class="category_image_img" src="//cdn3.volusion.com/jhqje.emawp/v/vspfiles/templates/americanflags/images/nophoto-0.gif" alt="" />
251
+ </td>
252
+ </tr>
253
+
254
+ </tbody>
255
+ </table>
256
+
257
+
258
+ <script type="text/javascript" src="/a/j/productlist.js"></script>
259
+ <div id='divWaitModal' class="a65chromeModal ui-dialog noniframe" style="width: 75px; height: 75px; display: none;">
260
+ <div style="height: 50px">
261
+ <img src="/a/i/ajax-loader.gif" alt="Waiting..." height="25px" width="25px;" style="padding: 12px" />
262
+ </div>
263
+ </div>
264
+
265
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
266
+ <tr>
267
+ <td>
268
+ <table width="100%" border="0" cellspacing="0" cellpadding="5">
269
+ <tr>
270
+ <td>
271
+
272
+
273
+
274
+ <b><!--You are here://--><a href="https://www.FlagsExpress.com/">Home</a> &gt; <a href="https://www.FlagsExpress.com/HalfStaff_s/1994.htm" title="HalfStaff">Half-Staff Alerts</a></b>
275
+
276
+ </td>
277
+ </tr>
278
+ </table>
279
+ </td>
280
+ </tr>
281
+
282
+
283
+ <tr>
284
+ <td>
285
+
286
+ </td>
287
+ </tr>
288
+
289
+
290
+ <tr>
291
+ <td class="colors_lines_light"><img src="/v/vspfiles/templates/americanflags/images/clear1x1.gif" width="1" height="1"></td>
292
+ </tr>
293
+
294
+
295
+
296
+ <tr>
297
+ <td valign="top" align="center">
298
+ <span id="listOfErrorsSpan">
299
+
300
+ </span>
301
+ </td>
302
+ </tr>
303
+ </table>
304
+
305
+
306
+ <table width="100%" cellpadding="0" cellspacing="0" border="0">
307
+ <tr>
308
+ <td>
309
+ <table width="100%" border=0 cellpadding=0 cellspacing=0>
310
+ <tr>
311
+ <td>
312
+ <table width="100%" border="0" cellspacing="10" cellpadding="10">
313
+ <tr>
314
+ <td>
315
+ <table>
316
+ <tbody>
317
+ <tr>
318
+ <td>
319
+ <img src="https://www.flagsexpress.com/v/vspfiles/assets/images/Half-Staff%20Alerts%20LogoV2.png" style="width: 136px;"/>
320
+ </td>
321
+ <td>
322
+ <div style="text-align: center;">
323
+ <inline style="font-size: 20px;"><br/><span style="font-weight: bold;">HALF-STAFF ALERTS</span> will provide you with an email alert when your American flag should be flown at half -staff in accordance to Presidential (country) and gubernatorial (state) proclamations. This free service is sponsored by <a href="http://https://www.FlagsExpress.com">www.FlagsExpress.com</a>. </inline>
324
+ </div>
325
+ </td>
326
+ </tr>
327
+ </tbody>
328
+ </table>
329
+ <div style="text-align: left;">
330
+ <br/>
331
+ </div>
332
+ <div style="text-align: center;">
333
+ <a href="http://visitor.r20.constantcontact.com/d.jsp?llr=dup76ccab&p=oi&m=1101757562499&sit=nqm5qoqcb" target="_blank"><img src="/v/vspfiles/assets/images/join-half-staff-list.png" alt="" align="" border="0px"/><br/><br/></a>
334
+ </div>
335
+ <inline style="font-size: 25px;"><center><a style="text-decoration:none;" name="anchor">Click on the appropriate link below</a></center></inline><inline style="color: rgb(0, 0, 0);">
336
+ <hr style="font-size: 16px;"/>
337
+ <br/>
338
+ <br/><a href="http://www.flagsexpress.com/Articles.asp?ID=1175"><br/><inline style="background-color: rgb(255, 255, 0);">Immediately until November 10 - ENTIRE UNITED STATES - Honoring the Victims of the Tragedy in Thousand Oaks, California</inline></a><hr/>
339
+ </td>
340
+ </tr>
341
+ </table>
342
+ </td>
343
+ </tr>
344
+ </table>
345
+
346
+ <table width="100%" border="0" cellspacing="0" cellpadding="10">
347
+ <tr>
348
+ <td>
349
+
350
+ </td>
351
+ </tr>
352
+ </table>
353
+
354
+ </td>
355
+ </tr>
356
+ </table>
357
+ </div><!-- #content -->
358
+ <div id="leftNav">
359
+ <!-- ========== MENU s ========== -->
360
+ <div id="categoryname" class="menu_title">Half-Staff Alerts</div>
361
+ <div id="display_menu_s" class="menu"></div><!-- #display_menu_s -->
362
+
363
+ <div id="display_promotions_999" class="clear"><BR><img src="/v/vspfiles/templates/americanflags/images/logos/paypal.gif" border=0><BR><BR><img src="/v/vspfiles/templates/americanflags/images/logos/cc_logo1.gif" border=0><BR><div id="VolusionVerified"></div>
364
+ <script type="text/javascript" src="https://verify.volusion.com/verification/www.USA-Flag-Store.com" defer="defer"></script><style type="text/css">#volusion_ssl_seal { behavior: url(/a/iepngfix.htc); }</style><br /><a href="javascript:void(0);" onclick="window.open('https://www.volusion.com/ssl.asp?url=www.flagsexpress.com', 'VolusionSSL', 'top=10,left=10,menubar=0,resizable=0,scrollbars=0,width=467,height=467')"><img id="volusion_ssl_seal" src="/a/i/seal_volusion2.png" border="0" height="58" width="137"></a><br /><a target="_blank" title="American Flags Express BBB Business Review" href="http://www.bbb.org/wisconsin/business-reviews/flags-and-banners/american-flags-express-in-butler-wi-25000560/#bbbonlineclick"><img alt="American Flags Express BBB Business Review" style="border: 0px none;" src="https://seal-wisconsin.bbb.org/seals/blue-seal-96-50-american-flags-express-25000560.png"/></a></div>
365
+
366
+ </div><!-- #leftNav -->
367
+ </div><!-- #contentWrap -->
368
+
369
+
370
+ <div id="newsBanner">
371
+ <div id="eList">
372
+
373
+ <div class="title"><a href="https://www.flagsexpress.com/Half-staff.html"><i>Should your American flag be at half-staff?</i></a></div>
374
+ <!-- <form name="MailingList" method="post" action="/MailingList_subscribe.asp">
375
+ <input type="text" class="elistInput transition" name="emailaddress" value="" placeholder="email address" />
376
+ <input type="submit" name="Submit" class="elistSubmit" value="" />
377
+ </form> -->
378
+ <a href="https://www.flagsexpress.com/Half-staff.html" class="btn">Sign up for Half-Staff Alerts</a>
379
+ </div>
380
+ </div>
381
+ </div><!-- #pageWrapper -->
382
+
383
+ <!-- ==================== FOOTER ==================== -->
384
+ <div id="footer" class="clear">
385
+ <div id="footerTop" class="clear">
386
+
387
+ <ul class="col-1">
388
+ <li class="title">Company Info</li>
389
+ <li><a href="/aboutus.asp" title="About American Flags Express">About Us</a></li>
390
+ <li><a href="mailto:KT@flagsexpress.com?subject=Contact Us" title="Contact American Flags Express">Contact Us</a></li>
391
+ <li><a href="/terms_privacy.asp" title="Privacy Policy">Privacy Policy</a></li>
392
+ <li><a href="/terms.asp" title="Terms and Conditions">Terms &amp; Conditions</a></li>
393
+ </ul>
394
+
395
+ <ul class="col-2">
396
+ <li class="title">My Account</li>
397
+ <li><a href="/login.asp" title="Login to Your Account">Login</a> / <a href="/register.asp" title="Register for an Account">Register</a></li>
398
+ <li><a href="/shoppingcart.asp" title="View My Shopping Cart">Shopping Cart</a></li>
399
+ <li><a href="/orders.asp" title="View the Status of My Order">Order Status</a></li>
400
+ <li><a href="/wishlist.asp" title="View your Wishlist">Wishlist</a></li>
401
+ </ul>
402
+
403
+ <ul class="col-3">
404
+ <li class="title" >Customer Care</li>
405
+ <li><a href="/help.asp" title="Site Help">Help/FAQ</a></li>
406
+ <li><a href="/articles.asp?ID=57" title="Shipping">Shipping &amp; Deliveries</a></li>
407
+ <li><a href="/returns.asp" title="Returns">Returns &amp; Exchanges</a></li>
408
+ </ul>
409
+
410
+ <ul class="col-4">
411
+ <li class="title">American Flags Express</li>
412
+ <li>12577 W. Custer Ave.</li>
413
+ <li>Butler, WI 53007</li>
414
+ <li>Hours: 9AM - 5:30PM, M - F CST</li>
415
+ </ul>
416
+
417
+ <a href="https://www.facebook.com/pages/American-Flags-Express/44001661285" target="_blank" class="connect">
418
+ <span class="icon">&nbsp;</span>
419
+ <span>Connect</span>
420
+ </a>
421
+
422
+ </div>
423
+
424
+ <!--
425
+ ==========================================================================================
426
+ VOLUSION LINK - BEGIN
427
+ ==========================================================================================
428
+ Customer has agreed per Volusion's Terms of Service (http://www.volusion.com/agreement_monthtomonth.asp)
429
+ to maintain a text hyperlink to "http://www.volusion.com" in the footer of the website. The link must be
430
+ standard html, contain no javascript, and be approved by Volusion. Removing this link breaches the Volusion agreement.
431
+ ==========================================================================================
432
+ -->
433
+ <div id="footerBottom" class="clear">
434
+ <div class="copyright">
435
+ <a href="/terms.asp" title="Terms">Copyright &copy; <span class="insertYear">2013</span>&nbsp;American Flags Express. All Rights Reserved.</a>
436
+ Built with <a href="http://www.volusion.com" target="_blank" rel="nofollow">Volusion</a><!-- #if_not_hompage -->
437
+ </div><!-- .copyright -->
438
+ <div class="icons">
439
+ <img src="/v/vspfiles/templates/americanflags/images/template/cc.png" height="20" width="183" alt="">
440
+ <a href="javascript:void(0);" onclick="window.open('https://www.volusion.com/ssl.asp?url=www.flagsexpress.com', 'VolusionSSL', 'top=10,left=10,menubar=0,resizable=0,scrollbars=0,width=467,height=467')"><img src="/v/vspfiles/templates/americanflags/images/template/vsecure.png" alt=""></a><a target="_blank" title="American Flags Express BBB Business Review" href="http://www.bbb.org/wisconsin/business-reviews/flags-and-banners/american-flags-express-in-butler-wi-25000560/#bbbonlineclick"><img alt="American Flags Express BBB Business Review" style="border: 0;" src="https://seal-wisconsin.bbb.org/seals/blue-seal-96-50-american-flags-express-25000560.png" /></a>
441
+ </div>
442
+ </div><!-- #footerBottom -->
443
+ </div><!-- #footer -->
444
+
445
+
446
+ <!-- begin Volusion Live Chat code -->
447
+ <script type="text/javascript">
448
+ (function() {
449
+ var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
450
+ se.src = '//commondatastorage.googleapis.com/volusionchat/js/82f79a72-a9d6-46c9-87b6-bbebc1055b3a.js';
451
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
452
+ })();
453
+ </script>
454
+ <!-- end Volusion Live Chat code -->
455
+ <meta name="google-site-verification" content="tziNJYONG67Dm3cUzGKYiO7qwi1lII98_kqFk-P66ZQ" />
456
+
457
+
458
+ <!-- Google Code for Remarketing tag -->
459
+ <!-- Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. For instructions on adding this tag and more information on the above requirements, read the setup guide: google.com/ads/remarketingsetup -->
460
+ <script type="text/javascript">
461
+ /* <![CDATA[ */
462
+ var google_conversion_id = 1072698969;
463
+ var google_conversion_label = "PZfKCOC3mgMQ2azA_wM";
464
+ var google_custom_params = window.google_tag_params;
465
+ var google_remarketing_only = true;
466
+ /* ]]> */
467
+ </script>
468
+ <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
469
+ </script>
470
+ <noscript>
471
+ <div style="display:inline;">
472
+ <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/1072698969/?value=0&amp;label=PZfKCOC3mgMQ2azA_wM&amp;guid=ON&amp;script=0"/>
473
+ </div>
474
+ </noscript>
475
+
476
+
477
+
478
+
479
+
480
+ <script type="text/javascript">function store_init(event){} AttachEvent(window, 'load', store_init);</script>
481
+
482
+ <script type="text/javascript">
483
+ if (!/\/shoppingcart\.asp/i.test(window.location.pathname)) {
484
+ jQuery(document).ready(function() {
485
+ jQuery('a').each(AddCartLink)
486
+ });
487
+ }
488
+ </script>
489
+
490
+ <script>
491
+ if (document.getElementsByName("MailingList")[0]) {
492
+ var emailSubscribeForm = document.getElementsByName("MailingList")[0];
493
+ disableSubscribeSubmit = function() {
494
+ emailSubscribeButton.removeAttribute("type");
495
+ }
496
+ forwardToMailingList = function(e) {
497
+ var subscribeEmail = emailSubscribeForm.querySelector("input").value;
498
+ sessionStorage.setItem("subEmailAddress", subscribeEmail);
499
+ emailSubscribeForm.submit();
500
+ }
501
+
502
+ if (emailSubscribeForm.querySelector("button")) {
503
+ var emailSubscribeButton = emailSubscribeForm.querySelector("button");
504
+ emailSubscribeButton.addEventListener("click", forwardToMailingList);
505
+ }
506
+ }
507
+ </script>
508
+
509
+ </body>
510
+ </html>
@@ -4,7 +4,10 @@ require 'timecop'
4
4
 
5
5
  describe Lita::Handlers::OnewheelHalfstaff, lita_handler: true do
6
6
  before do
7
- mock = File.open('spec/fixtures/halfstaff.html').read
7
+ end
8
+
9
+ def mock(file)
10
+ mock = File.open("spec/fixtures/#{file}.html").read
8
11
  allow(RestClient).to receive(:get) { mock }
9
12
  end
10
13
 
@@ -14,6 +17,7 @@ describe Lita::Handlers::OnewheelHalfstaff, lita_handler: true do
14
17
  it { is_expected.to route_command('halfmast history') }
15
18
 
16
19
  it 'gives half-staff status' do
20
+ mock('halfstaff')
17
21
  Timecop.freeze(Time.local(2016, 2, 2, 10, 5, 0)) do
18
22
  send_command 'halfstaff'
19
23
  expect(["Everything's cool, yo.", "No half staff known."].include? replies.last).to be true
@@ -21,6 +25,7 @@ describe Lita::Handlers::OnewheelHalfstaff, lita_handler: true do
21
25
  end
22
26
 
23
27
  it 'gives half-staff affirmative' do
28
+ mock('halfstaff')
24
29
  Timecop.freeze(Time.local(2016, 2, 26, 10, 5, 0)) do
25
30
  send_command 'halfstaff'
26
31
  expect(replies.count).to eq(2)
@@ -30,6 +35,7 @@ describe Lita::Handlers::OnewheelHalfstaff, lita_handler: true do
30
35
  end
31
36
 
32
37
  it 'checks some edge cases for multi-day half staffs.' do
38
+ mock('halfstaff')
33
39
  Timecop.freeze(Time.local(2016, 3, 9, 10, 5, 0)) do
34
40
  send_command 'halfstaff'
35
41
  expect(replies.count).to eq(2)
@@ -38,7 +44,17 @@ describe Lita::Handlers::OnewheelHalfstaff, lita_handler: true do
38
44
  end
39
45
  end
40
46
 
47
+ it 'immediately until' do
48
+ mock('immediately_until')
49
+ Timecop.freeze(Time.local(2018, 11, 9, 10, 5, 0)) do
50
+ send_command 'halfstaff'
51
+ expect(replies.count).to eq(1)
52
+ expect(replies[0]).to eq('ENTIRE UNITED STATES - Honoring the Victims of the Tragedy in Thousand Oaks, California - www.flagsexpress.com/Articles.asp?ID=1175')
53
+ end
54
+ end
55
+
41
56
  it 'will return history link' do
57
+ mock('halfstaff')
42
58
  send_command 'halfstaff history'
43
59
  expect(replies.last).to eq('https://en.wikipedia.org/wiki/Half-mast')
44
60
  end
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.2.1
4
+ version: 0.3.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-03-10 00:00:00.000000000 Z
11
+ date: 2018-11-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.7'
19
+ version: '4'
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.7'
26
+ version: '4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -160,12 +160,14 @@ files:
160
160
  - ".gitignore"
161
161
  - ".travis.yml"
162
162
  - Gemfile
163
+ - LICENSE
163
164
  - README.md
164
165
  - Rakefile
165
166
  - lib/lita-onewheel-halfstaff.rb
166
167
  - lib/lita/handlers/onewheel_halfstaff.rb
167
168
  - lita-onewheel-halfstaff.gemspec
168
169
  - spec/fixtures/halfstaff.html
170
+ - spec/fixtures/immediately_until.html
169
171
  - spec/lita/handlers/onewheel_halfstaff_spec.rb
170
172
  - spec/spec_helper.rb
171
173
  homepage: https://github.com/onewheelskyward/lita-onewheel-halfstaff
@@ -189,11 +191,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
191
  version: '0'
190
192
  requirements: []
191
193
  rubyforge_project:
192
- rubygems_version: 2.5.1
194
+ rubygems_version: 2.7.6
193
195
  signing_key:
194
196
  specification_version: 4
195
197
  summary: See above.
196
198
  test_files:
197
199
  - spec/fixtures/halfstaff.html
200
+ - spec/fixtures/immediately_until.html
198
201
  - spec/lita/handlers/onewheel_halfstaff_spec.rb
199
202
  - spec/spec_helper.rb