ellen-google_image 0.0.2 → 0.0.3

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: 107cfad953bc05f1c5d09b22dee600dc1bdb66d0
4
- data.tar.gz: b6088614c207cf7a139735791fb5c2343d51f4b7
3
+ metadata.gz: 0569d08da2060c76111e064ffea6012068af4f3a
4
+ data.tar.gz: d43f47877a9e6723f24365a47b4cd2680625fd7e
5
5
  SHA512:
6
- metadata.gz: 13cededc25bbfb7d12924b6438c832817e042a8bd87efe30c3cf2c51b4a3a8c854aa47db76e0f60d04e6218da0e4496a6cd714fea1f8b96d63ef2da313649616
7
- data.tar.gz: b7afa513ccd8f8733e83d2f8ef97e20cbc0db4659ecdcef736c8e7f9cdea4decd2882133234d4bd63b35d3260358ba578544de800fb4d25f1d4a77db9518a879
6
+ metadata.gz: 6cf883f780fac390e098cdcbc1da32d4150b59685e60f0569780aef1a33b6c55c713abb6190c293f876978aa668ada5a1049fde724a47b3db607384fccb5b20f
7
+ data.tar.gz: 69a99d371744803305d43512862bd63af74d334aae67a597cc95fde708a28d01f99411d3a5f18d4e57dbd9f00b89b581be38b01631ce783fd41a107142d366e0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.0.3
2
+ * Adapt to ellen 0.0.8's new handler interface
3
+
1
4
  ## 0.0.2
2
5
  * Fix animate query
3
6
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_dependency "ellen", ">= 0.0.5"
19
+ spec.add_dependency "ellen", ">= 0.0.8"
20
20
  spec.add_dependency "faraday"
21
21
  spec.add_dependency "faraday_middleware"
22
22
  spec.add_development_dependency "bundler", "~> 1.6"
@@ -1,5 +1,5 @@
1
1
  module Ellen
2
2
  module GoogleImage
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -1,17 +1,27 @@
1
1
  module Ellen
2
2
  module Handlers
3
3
  class GoogleImage < Base
4
- on /image (.+)/, description: "Search image from Google" do |message|
5
- if url = Ellen::GoogleImage::Client.new(query: message[1]).get
6
- say url
4
+ on /image (.+)/, name: "image", description: "Search image from Google"
5
+
6
+ on /animate (.+)/, name: "animate", description: "Search animation from Google"
7
+
8
+ def image(message)
9
+ if url = search(message[1])
10
+ robot.say url
7
11
  end
8
12
  end
9
13
 
10
- on /animate (.+)/, description: "Search animation from Google" do |message|
11
- if url = Ellen::GoogleImage::Client.new(query: message[1], animated: true).get
12
- say url
14
+ def animate(message)
15
+ if url = search(message[1], animated: true)
16
+ robot.say url
13
17
  end
14
18
  end
19
+
20
+ private
21
+
22
+ def search(query, options = {})
23
+ Ellen::GoogleImage::Client.new(options.merge(query: query)).get
24
+ end
15
25
  end
16
26
  end
17
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ellen-google_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
11
+ date: 2014-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ellen
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.5
19
+ version: 0.0.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.5
26
+ version: 0.0.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement