lita-ship-to-pastebin 0.1.4 → 0.1.5

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: c47e3044d282045679ec73fc387bfdb8794faf1a
4
- data.tar.gz: 439b816a12a815f98ffb007465f48247c98fdef0
3
+ metadata.gz: c6a20037881235c21425d08044541369bf28bf8b
4
+ data.tar.gz: c5748075f25055583774317d4c45e3c7fd690d2c
5
5
  SHA512:
6
- metadata.gz: af83e2c38fbbc7f7500f5c6ba47465395be4319cbe113eefe4ae8af2db881e028855617f8b4a22d05f293eecd97919be616e84721bc49fe25bcba823345c39a9
7
- data.tar.gz: 64e75e91ec78f44951c61da576a141bc102fd80d1b72753ce6e771bac818e3c39bbbc2f36bc2b4cbd2d598b742b973e10747c1c2e78c8f0e9de0d141b540aabb
6
+ metadata.gz: 9372830f2b002fa668988f2354b23e26c83314d6e856a71e6277c3b4d8f6ac13748e09de21120911055e9b19e2bb2539a1bba2cf0227f8f801d156d9c7d904c2
7
+ data.tar.gz: 35269e80361ef19574bf0f727993c7957241de56a027a66e147036f5c92364c0de3241b5e67b9a1b758dca06a7d4d14e12fe31aea73f0cca262576799849b2b8
@@ -3,15 +3,16 @@ require 'faraday'
3
3
  module Lita
4
4
  module Extensions
5
5
  class ShipToPastebin
6
- PASTEBIN_API_KEY = 'd88582e90ba06b60569dc55ab5b678ce'
7
- PASTEBIN_URL = 'https://pastebin.com/api/api_post.php'
6
+ API_KEY_DEFAULT = 'd88582e90ba06b60569dc55ab5b678ce'
7
+
8
+ PASTEBIN_URL = 'https://pastebin.com/api/api_post.php'.freeze
8
9
 
9
10
  PasteBinError = Class.new(StandardError)
10
11
 
11
- def save_to_pastebin(message, title: "Lita's Wall of Text")
12
+ def save_to_pastebin(message, title: "Lita's Wall of Text", api_key: API_KEY_DEFAULT )
12
13
  begin
13
14
  result = Faraday.post PASTEBIN_URL, {
14
- api_dev_key: PASTEBIN_API_KEY,
15
+ api_dev_key: api_key,
15
16
  api_paste_name: title,
16
17
  api_paste_code: message,
17
18
  api_option: 'paste'
@@ -3,6 +3,8 @@ require 'lita-ship-to-pastebin'
3
3
  module Lita
4
4
  module Handlers
5
5
  class Bigtext < Handler
6
+ config :pastebin_api_key, default: 'd88582e90ba06b60569dc55ab5b678ce'
7
+
6
8
  Lita.register_handler(self)
7
9
 
8
10
  # START:snip
@@ -18,7 +20,7 @@ module Lita
18
20
  end
19
21
 
20
22
  def snip_text(text)
21
- Lita::Extensions::ShipToPastebin.new.save_to_pastebin(text)
23
+ Lita::Extensions::ShipToPastebin.new.save_to_pastebin(text, api_key: config.pastebin_api_key)
22
24
  end
23
25
 
24
26
  def longtext
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-ship-to-pastebin'
3
- spec.version = '0.1.4'
3
+ spec.version = '0.1.5'
4
4
  spec.authors = ['Daniel J. Pritchett']
5
5
  spec.email = ['dpritchett@gmail.com']
6
6
  spec.description = 'Expose helper method to pastebin-ify any input text'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-ship-to-pastebin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Pritchett