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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70b18fea03338a3bd8824ee9654cac968055a1de
4
- data.tar.gz: e53a002401c837a960b57cf9b89e7cca439eae2f
3
+ metadata.gz: 95b2091c55ed60098f2a184e8ec9137695a804d9
4
+ data.tar.gz: 8273a0b8310c9fd8296d9b2e05456c38252cf19d
5
5
  SHA512:
6
- metadata.gz: b1bbfcb2550f9fc973d80550e598c6aa3148cee9aa769a850829b142256683a1871ac97089a18e5c8947071ea8d6ff903a4964625b86027dbef140d3e1a4fea3
7
- data.tar.gz: 5b6c06836d7913037dcebe7131597bd160de41be9beda06bd25ab3c02065e48fcac2e2246a63de70391dd0e190b66d0ab9b6bd9fc678cc319c0bc75f21c1394a
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
- TODO: Write usage instructions here
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
 
@@ -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
@@ -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
- "http://lgtm.herokuapp.com/#{url}"
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
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Lgtm
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
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.1
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-07 00:00:00.000000000 Z
11
+ date: 2014-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty