lita-time 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/time.rb +3 -2
- data/lita-time.gemspec +1 -1
- data/locales/en.yml +1 -0
- data/spec/lita/handlers/time_spec.rb +9 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27602df60f8785484a1e6fb79b7ec4bf0e5617e7
|
4
|
+
data.tar.gz: 3e23d6d15a05b2ddc6f922694b3397599b117ff8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3dee1818a67de71adf0d6b5a2e264e89733d7abdaa905cc8bf069f271e2df6b91c35763b27642237f4723a2095570db4abcfa9d023c467b3903ebb5ed1a1ff6
|
7
|
+
data.tar.gz: 4795735dfbdd9de0e181640c332540277e168fca4af281a99ab09eaaccd12fbc612f454c556825eeda90aaf83b62a48687d626621aab9d3a5184488f019b84f4
|
data/lib/lita/handlers/time.rb
CHANGED
@@ -23,13 +23,14 @@ module Lita
|
|
23
23
|
format: 'json'
|
24
24
|
)
|
25
25
|
|
26
|
-
data = MultiJson.load(http_response.body)["data"]
|
27
|
-
|
28
26
|
begin
|
27
|
+
data = MultiJson.load(http_response.body)["data"]
|
29
28
|
type = data['request'][0]['type']
|
30
29
|
query = data['request'][0]['query']
|
31
30
|
time = data['time_zone'][0]['localtime'].split(/ /)[1]
|
32
31
|
response.reply t("response.success", :type => type, :query => query, :time => time)
|
32
|
+
rescue MultiJson::ParseError
|
33
|
+
response.reply t("response.json_failure", :location => location)
|
33
34
|
rescue
|
34
35
|
response.reply t("response.failure", :location => location)
|
35
36
|
end
|
data/lita-time.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-time"
|
3
|
-
spec.version = "0.1.
|
3
|
+
spec.version = "0.1.1"
|
4
4
|
spec.authors = ["Harlan Barnes"]
|
5
5
|
spec.email = ["hbarnes@pobox.com"]
|
6
6
|
spec.description = %q{A Lita handler for getting the curent time for a given location}
|
data/locales/en.yml
CHANGED
@@ -64,5 +64,14 @@ JSON
|
|
64
64
|
"Sorry, couldn't find not a real place"
|
65
65
|
)
|
66
66
|
end
|
67
|
+
|
68
|
+
it "replies with a helpful message when the API returns non-JSON" do
|
69
|
+
allow(response).to receive(:body).and_return("")
|
70
|
+
|
71
|
+
send_command("time Mableton, GA")
|
72
|
+
expect(replies.last).to eq(
|
73
|
+
"Error parsing API response for Mableton, GA"
|
74
|
+
)
|
75
|
+
end
|
67
76
|
end
|
68
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harlan Barnes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -134,11 +134,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.1
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: A Lita handler for getting the curent time for a given location
|
141
141
|
test_files:
|
142
142
|
- spec/lita/handlers/time_spec.rb
|
143
143
|
- spec/spec_helper.rb
|
144
|
-
has_rdoc:
|