class SlackMsgr::Conversations
Handles all conversations functionality and methods corresponding with Slack API
Constants
- CONVERSATIONS_METHODS
- PERMITTED_ARGUMENTS
- REQUIRED_ARGUMENTS
Attributes
body[R]
method[R]
opts[R]
Public Class Methods
call(method, opts = {})
click to toggle source
# File lib/slack_msgr/conversations.rb, line 13 def call(method, opts = {}) chat = new(method, opts) send_post_request_to_slack(chat) end
new(method, opts)
click to toggle source
# File lib/slack_msgr/conversations.rb, line 23 def initialize(method, opts) conversations_method = CONVERSATIONS_METHODS[method] ErrorHandling.raise(:unknown_method, method: method) unless conversations_method @method = "conversations.#{conversations_method}" @opts = opts @body = sanitize_body end
Private Instance Methods
req_args_missing?()
click to toggle source
# File lib/slack_msgr/conversations.rb, line 43 def req_args_missing? !(REQUIRED_ARGUMENTS - opts.keys).empty? end
sanitize_body()
click to toggle source
# File lib/slack_msgr/conversations.rb, line 34 def sanitize_body ErrorHandling.raise(:req_args_missing, req_args: REQUIRED_ARGUMENTS, method: method) if req_args_missing? opts.keys.each_with_object({}) do |key, body| body[key] ||= opts[key] if PERMITTED_ARGUMENTS.include?(key) body end.to_json end