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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d14a585cc3df387b9605bd2a99339ba52e79bae4
4
- data.tar.gz: 1ad22d8244bdb6c359fd04e6036988f6e08bfca4
3
+ metadata.gz: 27602df60f8785484a1e6fb79b7ec4bf0e5617e7
4
+ data.tar.gz: 3e23d6d15a05b2ddc6f922694b3397599b117ff8
5
5
  SHA512:
6
- metadata.gz: 7d4f9ef11149796f451409b249b4fbe31fd66beb5c4cf3d9c9d18c6d4b22efcfff1f0a84dd77afbd5fb45c0e6d8038c69d78a8dc21559311d799de09f083d6f1
7
- data.tar.gz: ab8c35813b016cec8ab59716ff17e3d78c8d41778e2b051d7014ce4d73cabc0938430122e55b56082b3e3f3882790f2eaa795e4e4c87b6a275489332e4d2ae4b
6
+ metadata.gz: d3dee1818a67de71adf0d6b5a2e264e89733d7abdaa905cc8bf069f271e2df6b91c35763b27642237f4723a2095570db4abcfa9d023c467b3903ebb5ed1a1ff6
7
+ data.tar.gz: 4795735dfbdd9de0e181640c332540277e168fca4af281a99ab09eaaccd12fbc612f454c556825eeda90aaf83b62a48687d626621aab9d3a5184488f019b84f4
@@ -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.0"
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
@@ -8,3 +8,4 @@ en:
8
8
  response:
9
9
  success: "The current time for the %{type} of %{query} is %{time}"
10
10
  failure: "Sorry, couldn't find %{location}"
11
+ json_failure: "Error parsing API response for %{location}"
@@ -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.0
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: 2015-04-25 00:00:00.000000000 Z
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.4.1
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: