Class: Nautilfer::Adapters::Chatwork

Inherits:
Base
  • Object
show all
Defined in:
lib/nautilfer/adapters/chatwork.rb

Constant Summary collapse

API_ENDPOINT =
"https://api.chatwork.com/v2"

Instance Method Summary collapse

Constructor Details

#initialize(api_token:) ⇒ Chatwork

Returns a new instance of Chatwork.



11
12
13
# File 'lib/nautilfer/adapters/chatwork.rb', line 11

def initialize(api_token:)
  @api_token = api_token
end

Instance Method Details

#body(payload) ⇒ Object



26
27
28
# File 'lib/nautilfer/adapters/chatwork.rb', line 26

def body(payload)
  URI.encode_www_form(payload)
end

#headersObject



15
16
17
18
19
20
# File 'lib/nautilfer/adapters/chatwork.rb', line 15

def headers
  {
    'X-ChatWorkToken' => api_token,
    'Content-Type' => 'application/x-www-form-urlencoded'
  }
end

#payload(message) ⇒ Object



22
23
24
# File 'lib/nautilfer/adapters/chatwork.rb', line 22

def payload(message)
  { body: message }
end