class SlackProgress::Client

Attributes

parsed_options[R]

Public Class Methods

new(token, channel_id, options = {}) click to toggle source
# File lib/slack-progress/client.rb, line 10
def initialize(token, channel_id, options = {})
  raise ArgumentError, 'Token required' if token.nil?
  raise ArgumentError, 'Channel ID required' if channel_id.nil?

  @token = token
  @channel_id = channel_id
  @parsed_options   = OptionsParser.new(options).parse
end

Public Instance Methods

update_progress(thread_id: nil, current_value:, max_value:) click to toggle source
# File lib/slack-progress/client.rb, line 19
def update_progress(thread_id: nil, current_value:, max_value:)
  message_builder = MessageBuilder.new(parsed_options.formatting_options)
  text = message_builder.build_message(current_value, max_value)

  connection = Connection.new(@token, @channel_id)
  connection.send_request(text, thread_id)
end