baez_slack 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 935822a3654f8a5a72b940a59016a20e9419910968eb565037a392b748e11511
4
- data.tar.gz: 62558085a0cd50adbcaf3df50099ffe2b1462fb4d0bef7f546a002ed2998e12d
3
+ metadata.gz: 13056c21b05b860bc02fd736bb34f9ad655b15405631901980f597678bab93bb
4
+ data.tar.gz: ff913d5a8c421686edf791cde6cd66bb68ae5c8a4f9ec6e8c5fe7bccb067a68c
5
5
  SHA512:
6
- metadata.gz: 2e8d2e35c76db6fe10bdf3411e4c5a2e108c241101bbf56a04970e5c3c30779a6348a629f5c5da3eceb051eae1a65932b6234be0b533600ed24dff3acd341a20
7
- data.tar.gz: 5fca708dd20ad4a0602db4ce0c40e53adf077cc30ad09b94ebb561ddcccb44bb2d133b7478e22cd8a046c666692f54589e02aae74bf69ab0445e8754edde9145
6
+ metadata.gz: e1f4851bc699ce46dea0f7814b8525d5cdf0344dca4b638cf64df4aa2eda2478edfdf3e2cf40ca0f55db563ae8aacf978431bec7f364c26d7488254190a3f7e1
7
+ data.tar.gz: 837c5f143083eb90ce66c4333fb1738eda1dbbc54dd081a04bcb0d905ea762550f233728ffeb75183d9ff2a3ebe55cc8d05d3da953bfe17aa0b9e51318d90036
@@ -2,15 +2,18 @@ require 'slack-ruby-client'
2
2
  require_relative "modules/message_slack"
3
3
  require_relative "modules/search_slack"
4
4
  require_relative 'modules/read_slack'
5
-
5
+ require_relative 'modules/regex_slack'
6
+ require_relative "credentials"
6
7
 
7
8
  # Groups client initialization with instance parameters
8
- class BaezSlack
9
+ class BaezSlack < Credentials
9
10
  include MessageSlack
10
- include SearchOnSlack
11
11
  include ReadSlack
12
+ include SearchOnSlack
12
13
 
13
14
  def initialize(name = '', image = '', token = nil)
15
+ set_credentials
16
+
14
17
  Slack.configure do |config|
15
18
  config.token = token.nil? ? @bot_token : token
16
19
  config.raise 'Missing token' unless config.token
@@ -0,0 +1,10 @@
1
+
2
+ class Credentials
3
+ def set_credentials
4
+ @bot_token = ENV['SLACK_TOKEN']
5
+ @bot_name = ENV['SLACK_NAME']
6
+ @bot_icon = ENV['SLACK_ICON']
7
+ @bot_channel = ENV['SLACK_DEFAULT_CHANNEL']
8
+ @bot_default_output = ENV['SLACK_DEFAULT_OUTPUT']
9
+ end
10
+ end
@@ -33,8 +33,7 @@ module MessageSlack
33
33
  text: text,
34
34
  icon_url: @bot_icon,
35
35
  username: @bot_name,
36
- thread_ts: @thread,
37
- as_user: true
36
+ thread_ts: @thread
38
37
  rescue Slack::Web::Api::Errors::SlackError => e
39
38
  print e.message
40
39
  false
@@ -51,8 +50,7 @@ module MessageSlack
51
50
  attachments: attachment,
52
51
  icon_url: @bot_icon,
53
52
  username: @bot_name,
54
- thread_ts: @thread,
55
- as_user: true
53
+ thread_ts: @thread
56
54
  end
57
55
 
58
56
  def add_reaction(icon, channel, thread)
@@ -8,7 +8,8 @@ module ReadSlack
8
8
  include DirectiveLookup
9
9
 
10
10
  def share_message(data)
11
- case @output
11
+ output = ENV['SLACK_C_OUTPUT'] || @output
12
+ case output
12
13
  when 'slack'
13
14
  check_type(data)
14
15
  when 'console'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baez_slack
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
  - Luciano Adonis
@@ -60,6 +60,7 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - lib/baez_slack.rb
63
+ - lib/credentials.rb
63
64
  - lib/modules/console_slack.rb
64
65
  - lib/modules/message_slack.rb
65
66
  - lib/modules/read_slack.rb