class DevTrainingBot::Cli
Public Class Methods
exit_on_failure?()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 6 def self.exit_on_failure? true end
Public Instance Methods
list()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 48 def list topics_table = topic_service.topics.map do |topic| ['', set_color(topic.author, :blue), topic.title] end print_table topics_table end
open()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 18 def open Launchy.open GoogleDriveService::DOC_URL end
publish()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 40 def publish topics = topic_service.to_poll(exclude: options[:exclude]) slack_service.create_poll(topics) slack_service.link_doc say 'Successfully published the poll!', :green end
save(file)
click to toggle source
# File lib/dev_training_bot/cli.rb, line 28 def save(file) mime = GoogleDriveService.mime(options[:format]) drive_service.export_file(ENV['FILE_ID'], mime, download_dest: file) say 'Successfully saved the document!', :green end
version()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 13 def version say "v#{VERSION}" end
Private Instance Methods
drive_service()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 58 def drive_service @drive_service ||= GoogleDriveService.new end
slack_service()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 66 def slack_service @slack_service ||= SlackService.new end
topic_service()
click to toggle source
# File lib/dev_training_bot/cli.rb, line 62 def topic_service @topic_service ||= TopicService.new(drive_service) end