Class: ChatWork::OAuthClient

Inherits:
BaseClient show all
Includes:
TokenMethods
Defined in:
lib/chatwork/oauth_client.rb

Defined Under Namespace

Modules: TokenMethods

Instance Method Summary collapse

Methods included from TokenMethods

#refresh_access_token

Methods inherited from BaseClient

#handle_response

Methods included from Converter

#boolean_to_integer, #hash_compact

Constructor Details

#initialize(client_id:, client_secret:, api_base: nil) ⇒ OAuthClient

Returns a new instance of OAuthClient.

Parameters:

  • client_id (String)
  • client_secret (String)
  • api_base (String) (defaults to: nil)


12
13
14
15
16
# File 'lib/chatwork/oauth_client.rb', line 12

def initialize(client_id:, client_secret:, api_base: nil)
  api_base ||= ChatWork.oauth_api_base
  signature = Base64.encode64("#{client_id}:#{client_secret}").delete("\n")
  super(api_base: api_base, header: { "Authorization" => "Basic #{signature}" })
end