Class: SardonyxRing::Services::SlackAppClient

Inherits:
Object
  • Object
show all
Defined in:
lib/sardonyx_ring/services/slack_app_client.rb

Constant Summary collapse

SLACK_API_ORIGIN =
'https://slack.com'

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SlackAppClient

Returns a new instance of SlackAppClient.



8
9
10
# File 'lib/sardonyx_ring/services/slack_app_client.rb', line 8

def initialize(options = {})
  @app_token = options[:token]
end

Instance Method Details

#request(path, params = {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/sardonyx_ring/services/slack_app_client.rb', line 12

def request(path, params = {})
  res = create_http_client.post(
    "/api/#{path}", params.to_json,
    'Content-Type': 'application/json',
    Authorization: "Bearer #{@app_token}"
  )
  parse_response(res.body)
end