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
#auth_method, #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
51
52
53
|
# File 'lib/nylas/account.rb', line 51
def self.resources_path(api:)
"/a/#{api.app_id}/accounts"
end
|
Instance Method Details
#downgrade ⇒ Object
30
31
32
33
|
# File 'lib/nylas/account.rb', line 30
def downgrade
response = execute(method: :post, path: "#{resource_path}/downgrade")
response[:success]
end
|
#revoke_all(keep_access_token: nil) ⇒ Object
35
36
37
38
39
40
|
# File 'lib/nylas/account.rb', line 35
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
45
46
47
48
49
|
# File 'lib/nylas/account.rb', line 45
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
25
26
27
28
|
# File 'lib/nylas/account.rb', line 25
def upgrade
response = execute(method: :post, path: "#{resource_path}/upgrade")
response[:success]
end
|