Module: Zanshin::SDK::Account
- Included in:
- Client
- Defined in:
- lib/zanshin/account.rb
Overview
Zanshin SDK Account
Instance Method Summary collapse
-
#accept_invite(invite_id) ⇒ Object
Accepts an invitation with the informed ID, it only works if the user accepting the invitation is the user that received the invitation #reference.
-
#create_api_key(name) ⇒ Object
Creates a new API key for the current logged user, API Keys can be used to interact with the zanshin api directly on behalf of that user #reference.
-
#delete_api_key(api_key_id) ⇒ Object
Deletes a given API key by its id, it will only work if the informed ID belongs to the current logged user #reference.
-
#get_invite(invite_id) ⇒ Object
Gets a specific invitation details, it only works if the invitation was made for the current logged user #reference.
-
#get_me ⇒ Object
Returns the details of the user account that owns the API key used by this Connection instance #reference.
-
#iter_api_keys ⇒ Object
API keys Enumerator of current logged user #reference.
-
#iter_invites ⇒ Object
Invites Enumerator of current logged user #reference.
Instance Method Details
#accept_invite(invite_id) ⇒ Object
Accepts an invitation with the informed ID, it only works if the user accepting the invitation is the user that received the invitation #reference
52 53 54 |
# File 'lib/zanshin/account.rb', line 52 def accept_invite(invite_id) @http.request('POST', "/me/invites/#{validate_uuid(invite_id)}/accept") end |
#create_api_key(name) ⇒ Object
Creates a new API key for the current logged user, API Keys can be used to interact with the zanshin api directly on behalf of that user #reference
79 80 81 82 83 |
# File 'lib/zanshin/account.rb', line 79 def create_api_key(name) body = {} body['name'] = name @http.request('POST', '/me/apikeys', body) end |
#delete_api_key(api_key_id) ⇒ Object
Deletes a given API key by its id, it will only work if the informed ID belongs to the current logged user #reference
91 92 93 |
# File 'lib/zanshin/account.rb', line 91 def delete_api_key(api_key_id) @http.request('DELETE', "/me/apikeys/#{validate_uuid(api_key_id)}") end |
#get_invite(invite_id) ⇒ Object
Gets a specific invitation details, it only works if the invitation was made for the current logged user #reference
41 42 43 |
# File 'lib/zanshin/account.rb', line 41 def get_invite(invite_id) @http.request('GET', "/me/invites/#{validate_uuid(invite_id)}") end |
#get_me ⇒ Object
Returns the details of the user account that owns the API key used by this Connection instance #reference
15 16 17 |
# File 'lib/zanshin/account.rb', line 15 def get_me @http.request('GET', '/me') end |
#iter_api_keys ⇒ Object
API keys Enumerator of current logged user #reference
64 65 66 67 68 69 70 |
# File 'lib/zanshin/account.rb', line 64 def iter_api_keys Enumerator.new do |yielder| @http.request('GET', '/me/apikeys').each do |e| yielder.yield e end end end |
#iter_invites ⇒ Object
Invites Enumerator of current logged user #reference
27 28 29 30 31 32 33 |
# File 'lib/zanshin/account.rb', line 27 def iter_invites Enumerator.new do |yielder| @http.request('GET', '/me/invites').each do |e| yielder.yield e end end end |