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](api.zanshin.tenchisecurity.com/#operation/acceptInviteById).
-
#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](api.zanshin.tenchisecurity.com/#operation/createApiKeys).
-
#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](api.zanshin.tenchisecurity.com/#operation/deleteApiKey).
-
#get_invite(invite_id) ⇒ Object
Gets a specific invitation details, it only works if the invitation was made for the current logged user [#reference](api.zanshin.tenchisecurity.com/#operation/getInviteById).
-
#get_me ⇒ Object
Returns the details of the user account that owns the API key used by this Connection instance [#reference](api.zanshin.tenchisecurity.com/#operation/getMe).
-
#iter_api_keys ⇒ Object
API keys Enumerator of current logged user [#reference](api.zanshin.tenchisecurity.com/#operation/getMyApiKeys).
-
#iter_invites ⇒ Object
Invites Enumerator of current logged user [#reference](api.zanshin.tenchisecurity.com/#operation/getInvites).
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](api.zanshin.tenchisecurity.com/#operation/acceptInviteById)
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](api.zanshin.tenchisecurity.com/#operation/createApiKeys)
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](api.zanshin.tenchisecurity.com/#operation/deleteApiKey)
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](api.zanshin.tenchisecurity.com/#operation/getInviteById)
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](api.zanshin.tenchisecurity.com/#operation/getMe)
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](api.zanshin.tenchisecurity.com/#operation/getMyApiKeys)
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](api.zanshin.tenchisecurity.com/#operation/getInvites)
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 |