Class: DevTrainingBot::SlackService
- Inherits:
-
Object
- Object
- DevTrainingBot::SlackService
- Defined in:
- lib/dev_training_bot/services/slack_service.rb
Instance Method Summary collapse
- #create_poll(topics) ⇒ Object
-
#initialize ⇒ SlackService
constructor
A new instance of SlackService.
- #link_doc ⇒ Object
- #no_topics_available ⇒ Object
Constructor Details
#initialize ⇒ SlackService
Returns a new instance of SlackService.
11 12 13 14 |
# File 'lib/dev_training_bot/services/slack_service.rb', line 11 def initialize @client = Slack::Web::Client.new @client.auth_test end |
Instance Method Details
#create_poll(topics) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/dev_training_bot/services/slack_service.rb', line 16 def create_poll(topics) return no_topics_available if topics.empty? next_friday = Chronic.parse('next friday').to_date @client.chat_command channel: ENV['SLACK_CHANNEL'], command: '/poll', text: "\"@here Vote for the next dev learning! [#{next_friday}]\" #{topics}" end |
#link_doc ⇒ Object
32 33 34 35 36 |
# File 'lib/dev_training_bot/services/slack_service.rb', line 32 def link_doc @client.chat_postMessage channel: ENV['SLACK_CHANNEL'], text: GoogleDriveService::DOC_URL, as_user: true end |
#no_topics_available ⇒ Object
26 27 28 29 30 |
# File 'lib/dev_training_bot/services/slack_service.rb', line 26 def no_topics_available @client.chat_postMessage channel: ENV['SLACK_CHANNEL'], text: '<!here> Please propose your topics for the next Dev Learning!', as_user: true end |