Module: Unit::ApiToken::Org
- Defined in:
- lib/unit/models/api_token/api_token.rb,
lib/unit/models/api_token/org/create_api_token_request.rb
Defined Under Namespace
Classes: CreateApiTokenRequest
Class Method Summary collapse
-
.create_api_token(user_id:, description:, scope:, expiration:, source_ip: nil, resources: nil) ⇒ UnitResponse, UnitError
Create a new Org API api_token by calling Unit’s API.
-
.list_tokens(user_id:) ⇒ UnitResponse, UnitError
Get Org API tokens by calling Unit’s API.
-
.revoke_token(user_id:, token_id:) ⇒ UnitResponse, UnitError
Revoke Org API api_token by calling Unit’s API.
Class Method Details
.create_api_token(user_id:, description:, scope:, expiration:, source_ip: nil, resources: nil) ⇒ UnitResponse, UnitError
Create a new Org API api_token by calling Unit’s API
18 19 20 21 |
# File 'lib/unit/models/api_token/api_token.rb', line 18 def create_api_token(user_id:, description:, scope:, expiration:, source_ip: nil, resources: nil) request = CreateApiTokenRequest.new(user_id, description, scope, expiration, source_ip, resources) Unit::Resource::ApiTokenResource.create_org_api_token(request) end |
.list_tokens(user_id:) ⇒ UnitResponse, UnitError
Get Org API tokens by calling Unit’s API
27 28 29 |
# File 'lib/unit/models/api_token/api_token.rb', line 27 def list_tokens(user_id:) Unit::Resource::ApiTokenResource.list_org_tokens(user_id) end |
.revoke_token(user_id:, token_id:) ⇒ UnitResponse, UnitError
Revoke Org API api_token by calling Unit’s API
36 37 38 |
# File 'lib/unit/models/api_token/api_token.rb', line 36 def revoke_token(user_id:, token_id:) Unit::Resource::ApiTokenResource.revoke_org_token(user_id, token_id) end |