Class: Nylas::Account
- Inherits:
-
Object
show all
- Includes:
- Model
- Defined in:
- lib/nylas/account.rb
Overview
Representation of the accounts for Account management purposes.
Instance Attribute Summary
Attributes included from Model
#api
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Model
#create, #destroy, #execute, included, #model_class, #persisted?, #reload, #resource_path, #resources_path, #save, #save_all_attributes, #to_json, #update, #update_all_attributes
Class Method Details
.resources_path(api:) ⇒ Object
49
50
51
|
# File 'lib/nylas/account.rb', line 49
def self.resources_path(api:)
"/a/#{api.app_id}/accounts"
end
|
Instance Method Details
#downgrade ⇒ Object
28
29
30
31
|
# File 'lib/nylas/account.rb', line 28
def downgrade
response = execute(method: :post, path: "#{resource_path}/downgrade")
response[:success]
end
|
#revoke_all(keep_access_token: nil) ⇒ Object
33
34
35
36
37
38
|
# File 'lib/nylas/account.rb', line 33
def revoke_all(keep_access_token: nil)
payload = JSON.dump(keep_access_token: keep_access_token) if keep_access_token
response = execute(method: :post, path: "#{resource_path}/revoke-all", payload: payload)
response[:success]
end
|
#token_info(access_token) ⇒ TokenInfo
Return information about an account's access token
43
44
45
46
47
|
# File 'lib/nylas/account.rb', line 43
def token_info(access_token)
payload = JSON.dump(access_token: access_token)
response = execute(method: :post, path: "#{resource_path}/token-info", payload: payload)
TokenInfo.new(**response)
end
|
#upgrade ⇒ Object
23
24
25
26
|
# File 'lib/nylas/account.rb', line 23
def upgrade
response = execute(method: :post, path: "#{resource_path}/upgrade")
response[:success]
end
|