lita-your-weather 0.0.4 → 0.0.5

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: ac0924448f551a9a15954bdf9149c3e2e8967eaf
4
- data.tar.gz: 7f7197292d6e14cf367cbe1895192042d9d716ef
2
+ SHA256:
3
+ metadata.gz: 4e57dcc3d134994c806990317845e133b496ebeb489e55a17f2bae5e409612da
4
+ data.tar.gz: e64c837d034d8b965f3b871aad4cfdd44d45b54f9d9f9de6084cb9030fa205aa
5
5
  SHA512:
6
- metadata.gz: f0a3d581ad907eae85eb1e8577e22d7d651de2b9a8bd2633353052135fbcb4b78b226aaabe2e020b18237b34e4ca451b4e23bcf62f203d594405c89906790220
7
- data.tar.gz: 6c71461cbda2f26873fd54cc27560035dac4335c0cd9b0fdef621cfd358abc5db0adfb120df7bd4cfa9eaa3f90fb2eb4b03ab69facbced8aa9d5082ac0085e89
6
+ metadata.gz: 7fc95e02bbe0a390563043aaac24e0d29f3d65054a71770f4b8f1ff1f8a71245a3cbd1eaa44b583464f61698f9c813af1191ab7d05b4151ade2bdbb82f177fa7
7
+ data.tar.gz: 5bbfa9bb99dff03bf3b1ce1e364f44f79bd2fb980a3ff988195b7f858fedb7be1f29b79ff16749644176951cf6ff8ffa9089876dbc145d703fbbf30666eb6b54
@@ -0,0 +1 @@
1
+ 2.5.5
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ services:
5
+ - redis-server
@@ -0,0 +1,28 @@
1
+ ## [0.0.5] - Unreleased
2
+ ### Added
3
+ - Added weather icon for current weather
4
+
5
+ ### Changed
6
+ - Separated images to new command `lita weather i <location>`
7
+
8
+ ### Fixed
9
+ - Bug forecast broken in non default locations. Thx @ben-tinc
10
+
11
+ ## [0.0.4] - 2017-01-13
12
+ ### Fixed
13
+ - Bug calling multiple weather methods
14
+
15
+ ## [0.0.3] - 2017-01-13
16
+ ### Added
17
+ - `lita` command required
18
+
19
+ ## [0.0.2] - 2017-01-12
20
+ ### Added
21
+ - Images added of Edmonton, AB, Canada
22
+ - Added `weather <location>` command
23
+
24
+ ## 0.0.1 - 2016-11-21
25
+ ### Added
26
+ - Initial release
27
+ - Added `weather c <location> and weather f <location>` for current weather and 7-day forecast
28
+ - `lita` command not required
data/README.md CHANGED
@@ -7,9 +7,9 @@ lita-your-weather provides the ability to ask for the current weather conditions
7
7
  Add lita-your-weather to your Lita instance's Gemfile:
8
8
 
9
9
  ``` ruby
10
- gem "lita-your-weather"
10
+ gem 'lita-your-weather'
11
11
  ```
12
- $ bundle install
12
+ `$ bundle install`
13
13
 
14
14
  ## Configuration
15
15
 
@@ -25,12 +25,19 @@ config.handlers.your_weather.api_key = 'www.apixu.com Api Key'
25
25
 
26
26
  Commands include:
27
27
 
28
- <!-- For current weather of default location -->
29
- $ lita weather or $ lita weather c
30
- <!-- For current weather of specified location-->
31
- $ lita weather c Your_Location,Your_State,Your_Country
28
+ <!-- Current weather of default location -->
29
+ `$ lita weather`
32
30
 
33
- <!-- For weather forecast of default location-->
34
- $ lita weather f
35
- <!-- For weather forecast of specified location-->
36
- $ lita weather f Your_Location,Your_State,Your_Country
31
+ `$ lita weather c`
32
+ <!-- Current weather of specified location-->
33
+ `$ lita weather c <location>`
34
+
35
+ <!-- Weather forecast of default location-->
36
+ `$ lita weather f`
37
+ <!-- Weather forecast of specified location-->
38
+ `$ lita weather f <location>`
39
+
40
+ <!-- Weather images from default location-->
41
+ `$ lita weather i <location>`
42
+ <!-- Weather images-->
43
+ `$ lita weather i <location>`
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
@@ -1,12 +1,14 @@
1
- require "lita"
1
+ # frozen_string_literal: true
2
+
3
+ require 'lita'
2
4
 
3
5
  Lita.load_locales Dir[File.expand_path(
4
- File.join("..", "..", "locales", "*.yml"), __FILE__
6
+ File.join('..', '..', 'locales', '*.yml'), __FILE__
5
7
  )]
6
8
 
7
- require "lita/handlers/your_weather"
9
+ require 'lita/handlers/your_weather'
8
10
 
9
11
  Lita::Handlers::YourWeather.template_root File.expand_path(
10
- File.join("..", "..", "templates"),
11
- __FILE__
12
+ File.join('..', '..', 'templates'),
13
+ __FILE__
12
14
  )
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module Lita
@@ -11,49 +13,49 @@ module Lita
11
13
  config :api_key, type: String, required: true
12
14
 
13
15
  # Routes
14
- route(/^weather\s?[c?|f?]?\s?(.*)/, :weather, command: true, help: { "lita weather CITY,STATE,COUNTRY or lita weather CITY,STATE,COUNTRY or lita weather f CITY,STATE,COUNTRY" => "Responds with the specified city's current weather or forecast." })
16
+ route(/^weather\s?[c?|f?|i?]?\s?(.*)/, :weather, command: true, help: { 'lita weather CITY,STATE,COUNTRY or lita weather c CITY,STATE,COUNTRY or lita weather f CITY,STATE,COUNTRY' => "Responds with the specified city's current weather or 7-day forecast." })
15
17
 
16
18
  # Current Weather
17
19
  def weather(response)
18
- location = get_location(response.matches[0][0])
19
-
20
- if response.message.body.eql? 'weather f'
21
- data = request('/forecast.json?key=' + config.api_key + '&days=7', location)
22
- else
23
- data = request('/current.json?key=' + config.api_key , location)
20
+ location = get_location(response.matches[0][0])
21
+
22
+ if response.message.body.include? 'weather f'
23
+ data = request('/forecast.json?key=' + config.api_key + '&days=7', location)
24
+ elsif response.message.body.include? 'weather i'
25
+ if location.downcase.include? 'edmonton,alberta'
26
+ response.reply('https://ssl.eas.ualberta.ca/sitecore/camera/live/camera-ne.jpg')
27
+ response.reply('https://ssl.eas.ualberta.ca/sitecore/camera/live/camera-nw.jpg')
28
+ response.reply('https://ssl.eas.ualberta.ca/sitecore/camera/live/camera-w.jpg')
24
29
  end
30
+ else
31
+ data = request('/current.json?key=' + config.api_key, location)
32
+ end
25
33
 
26
- if data['error']
27
- response.reply('Error: ' + data['error']['message'])
28
- else
29
- if response.message.body.eql? 'weather f'
30
- response.reply('The forecast for ' + data['location']['name'] + ', ' + data['location']['region'] + ', ' + data['location']['country'] + ':')
31
- data['forecast']['forecastday'].each do |object|
32
- response.reply('On ' + object['date'] + ' forecasted is a high of ' + object['day']['maxtemp_c'].to_s + "\xC2\xB0" + 'C' + ' and a low of ' + object['day']['mintemp_c'].to_s + "\xC2\xB0" + 'C It is expected to be ' + object['day']['condition']['text'] )
33
- end
34
- else
35
- response.reply( data['location']['name'] + ', ' + data['location']['region'] + ', ' + data['location']['country'] + ' currently is ' + data['current']['condition']['text'] + ' and ' + data['current']['temp_c'].to_s + "\xC2\xB0" + 'C. It feels like ' + data['current']['feelslike_c'].to_s + "\xC2\xB0" + 'C' )
36
- if location.downcase.include? "edmonton"
37
- response.reply('https://ssl.eas.ualberta.ca/sitecore/camera/live/camera-ne.jpg')
38
- response.reply('https://ssl.eas.ualberta.ca/sitecore/camera/live/camera-nw.jpg')
39
- response.reply('https://ssl.eas.ualberta.ca/sitecore/camera/live/camera-w.jpg')
40
- end
34
+ unless data.nil?
35
+ return response.reply('Error: ' + data['error']['message']) if data['error']
36
+
37
+ if response.message.body.include? 'weather f'
38
+ response.reply('The forecast for ' + data['location']['name'] + ', ' + data['location']['region'] + ', ' + data['location']['country'] + ':')
39
+ data['forecast']['forecastday'].each do |object|
40
+ response.reply('On ' + object['date'] + ' forecasted is a high of ' + object['day']['maxtemp_c'].to_s + "\xC2\xB0" + 'C' + ' and a low of ' + object['day']['mintemp_c'].to_s + "\xC2\xB0" + 'C It is expected to be ' + object['day']['condition']['text'])
41
41
  end
42
+ else
43
+ response.reply('http:' + data['current']['condition']['icon'])
44
+ response.reply(data['location']['name'] + ', ' + data['location']['region'] + ', ' + data['location']['country'] + ' currently is ' + data['current']['condition']['text'] + ' and ' + data['current']['temp_c'].to_s + "\xC2\xB0" + 'C. It feels like ' + data['current']['feelslike_c'].to_s + "\xC2\xB0" + 'C')
42
45
  end
46
+ end
43
47
  end
44
48
 
45
49
  # Get location
46
50
  def get_location(location)
47
- if location.eql? ''
48
- location = config.default_location
49
- end
51
+ location = config.default_location if location.eql? ''
50
52
  location
51
53
  end
52
54
 
53
55
  # Request method
54
56
  def request(url, location)
55
- http_response = http.get( URL + url, q: location)
56
- return JSON.parse(http_response.body)
57
+ http_response = http.get(URL + url, q: location)
58
+ JSON.parse(http_response.body)
57
59
  end
58
60
  end
59
61
  end
@@ -1,24 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gem::Specification.new do |spec|
2
- spec.name = "lita-your-weather"
3
- spec.version = "0.0.4"
4
- spec.authors = ["Zoie Carnegie"]
5
- spec.email = ["zoie.carnegie@gmail.com"]
6
- spec.description = "lita-your-weather provides the ability to ask for the current weather conditions or for a 7 day forecast."
7
- spec.summary = "lita-your-weather provides the ability to ask for the current weather conditions or for a 7 day forecast."
8
- spec.homepage = "http://zoiecarnegie.com"
9
- spec.license = "MIT"
10
- spec.metadata = { "lita_plugin_type" => "handler" }
4
+ spec.name = 'lita-your-weather'
5
+ spec.version = '0.0.5'
6
+ spec.authors = ['Zoie Carnegie']
7
+ spec.email = ['zoie.carnegie@gmail.com']
8
+ spec.description = 'lita-your-weather provides the ability to ask for the current weather conditions or for a 7 day forecast.'
9
+ spec.summary = 'lita-your-weather provides the ability to ask for the current weather conditions or for a 7 day forecast.'
10
+ spec.homepage = 'http://zoiecarnegie.com'
11
+ spec.license = 'MIT'
12
+ spec.metadata = { 'lita_plugin_type' => 'handler' }
11
13
 
12
- spec.files = `git ls-files`.split($/)
14
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
13
15
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
- spec.require_paths = ["lib"]
17
+ spec.require_paths = ['lib']
16
18
 
17
- spec.add_runtime_dependency "lita", ">= 4.7"
19
+ spec.add_runtime_dependency 'lita', '>= 4.7'
18
20
 
19
- spec.add_development_dependency "bundler", "~> 1.3"
20
- spec.add_development_dependency "pry-byebug"
21
- spec.add_development_dependency "rake"
22
- spec.add_development_dependency "rack-test"
23
- spec.add_development_dependency "rspec", ">= 3.0.0"
21
+ spec.add_development_dependency 'bundler', '~> 1'
22
+ spec.add_development_dependency 'pry-byebug'
23
+ spec.add_development_dependency 'rack-test'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
24
26
  end
@@ -1,28 +1,33 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  describe Lita::Handlers::YourWeather, lita_handler: true do
6
+ it 'will route lita weather to the weather method' do
7
+ is_expected.to route('lita weather').to(:weather)
8
+ end
4
9
 
5
- it "will route lita weather to the weather method" do
6
- is_expected.to_not route("weather").to(:weather)
10
+ it 'will route lita weather c to the weather method' do
11
+ is_expected.to route('lita weather c').to(:weather)
7
12
  end
8
13
 
9
- it "will route lita weather c to the weather method" do
10
- is_expected.to_not route("weather c").to(:weather)
14
+ it 'will route lita weather f to the weather method' do
15
+ is_expected.to route('lita weather f').to(:weather)
11
16
  end
12
17
 
13
- it "will route lita weather f to the weather method" do
14
- is_expected.to_not route("weather f").to(:weather)
18
+ it 'will route lita weather i to the weather method' do
19
+ is_expected.to route('lita weather i').to(:weather)
15
20
  end
16
21
 
17
- it "will not route weather" do
18
- is_expected.to_not route("weather")
22
+ it 'will not route weather' do
23
+ is_expected.to_not route('weather')
19
24
  end
20
25
 
21
- it "will not route weather c" do
22
- is_expected.to_not route("weather c")
26
+ it 'will not route weather c' do
27
+ is_expected.to_not route('weather c')
23
28
  end
24
29
 
25
- it "will not route weather f" do
26
- is_expected.to_not route("weather f")
30
+ it 'will not route weather f' do
31
+ is_expected.to_not route('weather f')
27
32
  end
28
33
  end
@@ -1,5 +1,7 @@
1
- require "lita-your-weather"
2
- require "lita/rspec"
1
+ # frozen_string_literal: true
2
+
3
+ require 'lita-your-weather'
4
+ require 'lita/rspec'
3
5
 
4
6
  # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
5
7
  # was generated with Lita 4, the compatibility mode should be left disabled.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-your-weather
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoie Carnegie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-13 00:00:00.000000000 Z
11
+ date: 2019-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry-byebug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: rack-test
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rack-test
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -103,6 +103,9 @@ extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
105
  - ".gitignore"
106
+ - ".ruby-version"
107
+ - ".travis.yml"
108
+ - CHANGELOG.md
106
109
  - Gemfile
107
110
  - README.md
108
111
  - Rakefile
@@ -134,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
137
  version: '0'
135
138
  requirements: []
136
139
  rubyforge_project:
137
- rubygems_version: 2.6.7
140
+ rubygems_version: 2.7.6.2
138
141
  signing_key:
139
142
  specification_version: 4
140
143
  summary: lita-your-weather provides the ability to ask for the current weather conditions