Class: ChatWork::Client

Inherits:
BaseClient show all
Defined in:
lib/chatwork/client.rb

Instance Method Summary collapse

Methods inherited from BaseClient

#handle_response

Constructor Details

#initialize(api_key, access_token, api_base, api_version) ⇒ Client

Returns a new instance of Client.


3
4
5
6
7
8
9
10
11
# File 'lib/chatwork/client.rb', line 3

def initialize(api_key, access_token, api_base, api_version)
  if api_key
    super(api_base, api_version, { "X-ChatWorkToken" => api_key })
  elsif access_token
    super(api_base, api_version, { "Authorization" => "Bearer #{access_token}" })
  else
    raise "Either api_key or access_token is required"
  end
end