lita-onewheel-forecast-io 1.3.7 → 1.3.8

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: 09990bb66324ca9f2931ae20a237d0ae5d408714
4
- data.tar.gz: 7272ae4c2e85e67de2bd2560702fd20f92a49a7d
3
+ metadata.gz: 35a5283b84b36ad962b9a0537486ff0b1056c1d6
4
+ data.tar.gz: 6ca1e7906fa126062041d0dbb5375f0f9bff64b0
5
5
  SHA512:
6
- metadata.gz: 677beff74cebd5a8c7b7b41e2d7ff2b1591e78ae0cbed61f19c6397e7b223b23dfaad273f102f46897f9ed1889421ee779926ebdf65ac0bb3d515e49f49df5d0
7
- data.tar.gz: 3bcc7ef0db7b7914b828a6f36ecba91df5ac3394f49ff744c51f38638a09214870c5c9bc89c2a66463475db2e054d9536595777c86b0bc5443f670e3990d3e71
6
+ metadata.gz: 99f07dc8324c928428c9228ceb3a4ccdeaf2259565f53c93377559a835aecb82cef7c89ebc0ee5607ab1d7ffeef70bf14c917554ac03582bb81a924b4612eb7b
7
+ data.tar.gz: a204cbfb03fbc8e22d87f097eea9f85112090275f40cd87e19bc227105d0fb9877194b08c221ed0e399fe0025b1a67ccb9b9304d2f24bc61872782ee48adbb93
@@ -463,26 +463,44 @@ module ForecastIo
463
463
  # Check for the time of day when it will hit 72F.
464
464
  def do_the_windows_thing(forecast)
465
465
  time_to_close_the_windows = nil
466
+ time_to_open_the_windows = nil
467
+ window_close_temp = 0
468
+ high_temp = 0
469
+
466
470
  forecast['hourly']['data'].each_with_index do |hour, index|
467
471
  tm = Time.at(hour['time']).to_datetime.strftime('%k:%M')
468
472
  puts "#{hour['time']} - #{tm} - #{hour['temperature']}"
473
+
474
+ if hour['temperature'].to_i > high_temp
475
+ high_temp = hour['temperature'].to_i
476
+ end
477
+
469
478
  if hour['temperature'].to_i >= 71
470
479
  puts "Setting close time to #{hour['time']}"
471
480
  time_to_close_the_windows = hour['time']
481
+ window_close_temp = hour['temperature']
472
482
  break
473
483
  end
484
+ if time_to_close_the_windows and hour['temperature'].to_i < 71
485
+ time_to_open_the_windows = hour['time']
486
+ end
474
487
  break if index > 12
475
488
  end
476
489
 
477
490
  # Return some meta here and let the caller decide the text.
478
491
  if time_to_close_the_windows.nil?
479
- "Leave 'em open, no excess heat today."
492
+ "Leave 'em open, no excess heat today(#{high_temp}°F)."
480
493
  else
481
494
  timezone = TZInfo::Timezone.get('America/Los_Angeles')
482
495
  time_at = Time.at(time_to_close_the_windows).to_datetime
483
496
  local_time = timezone.utc_to_local(time_at)
484
497
 
485
- "Close the windows at #{local_time.strftime('%k:%M')}."
498
+ output = "Close the windows at #{local_time.strftime('%k:%M')}, it will be #{window_close_temp}°F. "
499
+ if time_to_open_the_windows
500
+ open_time = timezone.utc_to_local(Time.at(time_to_close_the_windows).to_datetime)
501
+ output += "Open them back up at #{open_time.strftime('%k:%M')}. "
502
+ end
503
+ output += "The high today will be #{high_temp}°F."
486
504
  end
487
505
  end
488
506
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-forecast-io'
3
- spec.version = '1.3.7'
3
+ spec.version = '1.3.8'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = <<-EOS
@@ -513,7 +513,7 @@ describe Lita::Handlers::OnewheelForecastIo, lita_handler: true do
513
513
  it '!windows' do
514
514
  mock_up 'windows'
515
515
  send_command 'windows'
516
- expect(replies.last).to eq('Close the windows at 16:00.')
516
+ expect(replies.last).to eq('Close the windows at 16:00, it will be 72°F. The high today will be 72°F.')
517
517
  end
518
518
 
519
519
  # it 'colors strings' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-forecast-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.8
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-07-03 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita