ruboty-lgtm 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/ruboty/handlers/lgtm.rb +3 -1
- data/lib/ruboty/lgtm/client.rb +7 -1
- data/lib/ruboty/lgtm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95b2091c55ed60098f2a184e8ec9137695a804d9
|
4
|
+
data.tar.gz: 8273a0b8310c9fd8296d9b2e05456c38252cf19d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b32804567e5031495526c3c8fa5151f10cad6a934106025a8515e4cf5ffb103d594bb40e3cce39cb0e7c1eeb43d146a941fe36a0da92bb52f555fcbcaf05d6d
|
7
|
+
data.tar.gz: 7aeb6707c5b537db040b185e0a222b8270be7ce17d97d4a361c113c25a9716f036d3dd9169d563e65dab08f0bb92a80b9ab55dc41861646e3e5b90dfd9f19fc7
|
data/README.md
CHANGED
@@ -18,7 +18,14 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
```
|
22
|
+
@ruboty lgtm <keyword> - Generate lgtm image matching with the keyword.
|
23
|
+
```
|
24
|
+
|
25
|
+
## ENV
|
26
|
+
```
|
27
|
+
LGTM_ENDPOINT - LGTM server endpoint (default: http://lgtm.herokuapp.com)
|
28
|
+
```
|
22
29
|
|
23
30
|
## Contributing
|
24
31
|
|
data/lib/ruboty/handlers/lgtm.rb
CHANGED
@@ -3,6 +3,8 @@ module Ruboty
|
|
3
3
|
class Lgtm < Base
|
4
4
|
on /lgtm( me)? ?(?<keyword>.+)?/, name: 'lgtm', description: 'Generate lgtm image matching with the keyword'
|
5
5
|
|
6
|
+
env :LGTM_ENDPOINT, "LGTM server endpoint (default: http://lgtm.herokuapp.com)", optional: true
|
7
|
+
|
6
8
|
def lgtm(message = {})
|
7
9
|
keyword = message[:keyword] || 'lgtm'
|
8
10
|
url = generate(keyword)
|
@@ -15,7 +17,7 @@ module Ruboty
|
|
15
17
|
private
|
16
18
|
|
17
19
|
def generate(query)
|
18
|
-
Ruboty::Lgtm::Client.new(query: query).generate
|
20
|
+
Ruboty::Lgtm::Client.new(query: query, endpoint: ENV["LGTM_ENDPOINT"]).generate
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
data/lib/ruboty/lgtm/client.rb
CHANGED
@@ -4,6 +4,8 @@ require 'faraday_middleware'
|
|
4
4
|
module Ruboty
|
5
5
|
module Lgtm
|
6
6
|
class Client
|
7
|
+
DEFAULT_ENDPOINT = 'http://lgtm.herokuapp.com'
|
8
|
+
|
7
9
|
GOOGLE_IMAGE_API_URL = 'http://ajax.googleapis.com/ajax/services/search/images'
|
8
10
|
|
9
11
|
def initialize(options)
|
@@ -14,7 +16,7 @@ module Ruboty
|
|
14
16
|
url = get
|
15
17
|
|
16
18
|
if url
|
17
|
-
|
19
|
+
File.join(endpoint, url)
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -75,6 +77,10 @@ module Ruboty
|
|
75
77
|
connection.response :json
|
76
78
|
end
|
77
79
|
end
|
80
|
+
|
81
|
+
def endpoint
|
82
|
+
@options[:endpoint] || DEFAULT_ENDPOINT
|
83
|
+
end
|
78
84
|
end
|
79
85
|
end
|
80
86
|
end
|
data/lib/ruboty/lgtm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-lgtm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- negipo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|