Class: ChatWork::Client
- Inherits:
-
BaseClient
- Object
- BaseClient
- ChatWork::Client
- Includes:
- ContactsMethods, FileMethods, IncomingRequestMethods, InvitationLinkMethods, MeMethods, MemberMethods, MessageMethods, MyStatusMethods, MyTaskMethods, RoomMethods, TaskMethods
- Defined in:
- lib/chatwork/client.rb
Defined Under Namespace
Modules: ContactsMethods, FileMethods, IncomingRequestMethods, InvitationLinkMethods, MeMethods, MemberMethods, MessageMethods, MyStatusMethods, MyTaskMethods, RoomMethods, TaskMethods
Instance Method Summary collapse
-
#initialize(api_key: nil, access_token: nil, api_base: nil, api_version: nil) ⇒ Client
constructor
A new instance of Client.
Methods included from TaskMethods
#create_task, #find_task, #get_tasks, #update_task_status
Methods included from RoomMethods
#create_room, #destroy_room, #find_room, #get_rooms, #update_room
Methods included from MyTaskMethods
Methods included from MyStatusMethods
Methods included from MessageMethods
#create_message, #destroy_message, #find_message, #get_messages, #read_message, #unread_message, #update_message
Methods included from MemberMethods
#get_members, #update_all_members
Methods included from MeMethods
Methods included from InvitationLinkMethods
#create_invitation_link, #destroy_invitation_link, #get_invitation_link, #update_invitation_link
Methods included from IncomingRequestMethods
#destroy_incoming_request, #get_incoming_requests, #update_incoming_request
Methods included from FileMethods
#create_file, #find_file, #get_files
Methods included from ContactsMethods
Methods inherited from BaseClient
Methods included from Converter
Constructor Details
#initialize(api_key: nil, access_token: nil, api_base: nil, api_version: nil) ⇒ Client
Either api_key or access_token is required
Returns a new instance of Client.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/chatwork/client.rb', line 32 def initialize(api_key: nil, access_token: nil, api_base: nil, api_version: nil) api_base ||= ChatWork.api_base api_version ||= ChatWork.api_version header = if api_key { "X-ChatWorkToken" => api_key } elsif access_token { "Authorization" => "Bearer #{access_token}" } else raise "Either api_key or access_token is required" end super(api_base: api_base, api_version: api_version, header: header) end |