Module: ChatWork

Defined in:
lib/chatwork.rb,
lib/chatwork/me.rb,
lib/chatwork/file.rb,
lib/chatwork/room.rb,
lib/chatwork/task.rb,
lib/chatwork/token.rb,
lib/chatwork/client.rb,
lib/chatwork/member.rb,
lib/chatwork/message.rb,
lib/chatwork/my_task.rb,
lib/chatwork/version.rb,
lib/chatwork/contacts.rb,
lib/chatwork/converter.rb,
lib/chatwork/multipart.rb,
lib/chatwork/my_status.rb,
lib/chatwork/base_client.rb,
lib/chatwork/oauth_client.rb,
lib/chatwork/chatwork_error.rb,
lib/chatwork/invitation_link.rb,
lib/chatwork/incoming_request.rb

Defined Under Namespace

Modules: Contacts, Converter, File, IncomingRequest, InvitationLink, Me, Member, Message, MyStatus, MyTask, Room, Task, Token Classes: APIConnectionError, APIError, AuthenticateError, BaseClient, ChatWorkError, Client, EpiloguePart, Multipart, OAuthClient

Constant Summary collapse

VERSION =
"1.0.0".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_baseObject

Returns the value of attribute api_base.



45
46
47
# File 'lib/chatwork.rb', line 45

def api_base
  @api_base
end

.api_versionObject

Returns the value of attribute api_version.



53
54
55
# File 'lib/chatwork.rb', line 53

def api_version
  @api_version
end

.oauth_api_baseObject

Returns the value of attribute oauth_api_base.



49
50
51
# File 'lib/chatwork.rb', line 49

def oauth_api_base
  @oauth_api_base
end

Class Method Details

.access_tokenString

Note:

if access_token is not defined, returns ENV["CHATWORK_ACCESS_TOKEN"]

Returns:

  • (String)


119
120
121
# File 'lib/chatwork.rb', line 119

def access_token
  @access_token || ENV["CHATWORK_ACCESS_TOKEN"]
end

.access_token=(new_value) ⇒ Object

Parameters:

  • new_value (String)


91
92
93
94
95
# File 'lib/chatwork.rb', line 91

def access_token=(new_value)
  @api_key = nil
  @access_token = new_value
  @client = nil
end

.api_keyString

Note:

if api_key is not defined, returns ENV["CHATWORK_API_TOKEN"]

Returns:

  • (String)


112
113
114
# File 'lib/chatwork.rb', line 112

def api_key
  @api_key || ENV["CHATWORK_API_TOKEN"]
end

.api_key=(new_value) ⇒ Object

Parameters:

  • new_value (String)


84
85
86
87
88
# File 'lib/chatwork.rb', line 84

def api_key=(new_value)
  @api_key = new_value
  @access_token = nil
  @client = nil
end

.clientChatWork::Client

Returns:



56
57
58
# File 'lib/chatwork.rb', line 56

def client
  @client ||= Client.new(api_key: api_key, access_token: access_token)
end

.client_idString

Note:

if client_id is not defined, returns ENV["CHATWORK_CLIENT_ID"]

Returns:

  • (String)


126
127
128
# File 'lib/chatwork.rb', line 126

def client_id
  @client_id || ENV["CHATWORK_CLIENT_ID"]
end

.client_id=(new_value) ⇒ Object

Parameters:

  • new_value (String)


98
99
100
101
# File 'lib/chatwork.rb', line 98

def client_id=(new_value)
  @client_id = new_value
  @oauth_client = nil
end

.client_secretString

Note:

if client_secret is not defined, returns ENV["CHATWORK_CLIENT_SECRET"]

Returns:

  • (String)


133
134
135
# File 'lib/chatwork.rb', line 133

def client_secret
  @client_secret || ENV["CHATWORK_CLIENT_SECRET"]
end

.client_secret=(new_value) ⇒ Object

Parameters:

  • new_value (String)


104
105
106
107
# File 'lib/chatwork.rb', line 104

def client_secret=(new_value)
  @client_secret = new_value
  @oauth_client = nil
end

.oauth_clientChatWork::OAuthClient



61
62
63
# File 'lib/chatwork.rb', line 61

def oauth_client
  @oauth_client ||= OAuthClient.new(client_id: client_id, client_secret: client_secret)
end