lita-google-images 1.0.1 → 1.0.2

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: 358bdfacf0cdd3050cfb12ca35d2fc1bada87c5c
4
- data.tar.gz: 284fb1f71ef59e638c76239f98debd63b23f07ee
3
+ metadata.gz: 3fc398cce7e6d5f213c99fe009d05377e7f389ff
4
+ data.tar.gz: 9ea15647790c5116a88c855104d2ff0e4f84613a
5
5
  SHA512:
6
- metadata.gz: 13a3bccbf71a25f693403a729cd9769c2aacf6c498ecd96e79f4adcc880a2fcfba88eca04bea94cf45901b2fb969b6f2a8a33376b910deb6f056fae11597e957
7
- data.tar.gz: 66d340478f710f2235503039eff058d5c55bbed68ca07a249094a804dcbf50f5b3de677fdfc1402a702ccc6f1900dad25d835cff8431f772d3d7f0119342de30
6
+ metadata.gz: ac19222336770d92793889b4c225077e687ed7808983a26b27db71e6bec91cfe62fe5de18ed67e40a445dea202c9424a7e8982c9be349919c316d49515ea963d
7
+ data.tar.gz: 8d909da0917e18409ac360a47f14e5919ee7aeb176b655a13f8cad70b3f23b1408da8c817e88361757c2131848a5bfef23072fe1020ae99679c93e0704d24ca7
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Jimmy Cuadra
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,7 +28,11 @@ module Lita
28
28
 
29
29
  if data["responseStatus"] == 200
30
30
  choice = data["responseData"]["results"].sample
31
- response.reply "#{choice["unescapedUrl"]}#.png"
31
+ if choice
32
+ response.reply "#{choice["unescapedUrl"]}#.png"
33
+ else
34
+ response.reply %{No images found for "#{query}".}
35
+ end
32
36
  else
33
37
  reason = data["responseDetails"] || "unknown error"
34
38
  Lita.logger.warn(
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-google-images"
3
- spec.version = "1.0.1"
3
+ spec.version = "1.0.2"
4
4
  spec.authors = ["Jimmy Cuadra"]
5
5
  spec.email = ["jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{A Lita handler for fetching images from Google.}
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.add_development_dependency "bundler", "~> 1.3"
19
19
  spec.add_development_dependency "rake"
20
- spec.add_development_dependency "rspec", ">= 2.14.0.rc1"
20
+ spec.add_development_dependency "rspec", "~> 2.14"
21
21
  spec.add_development_dependency "simplecov"
22
22
  spec.add_development_dependency "coveralls"
23
23
  end
@@ -35,6 +35,15 @@ JSON
35
35
  )
36
36
  end
37
37
 
38
+ it "replies that no images were found if the results are empty" do
39
+ allow(response).to receive(:body).and_return(<<-JSON.chomp
40
+ {"responseStatus": 200, "responseData": { "results": [] } }
41
+ JSON
42
+ )
43
+ send_command("image carl")
44
+ expect(replies.last).to eq(%{No images found for "carl".})
45
+ end
46
+
38
47
  it "logs a warning on failure" do
39
48
  allow(response).to receive(:body).and_return(<<-JSON.chomp
40
49
  {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-google-images
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Cuadra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2013-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 2.14.0.rc1
61
+ version: '2.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 2.14.0.rc1
68
+ version: '2.14'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +104,7 @@ files:
104
104
  - .gitignore
105
105
  - .travis.yml
106
106
  - Gemfile
107
+ - LICENSE
107
108
  - README.md
108
109
  - Rakefile
109
110
  - lib/lita-google-images.rb