Class: Unit::ApiToken::Org::CreateApiTokenRequest
- Inherits:
-
Object
- Object
- Unit::ApiToken::Org::CreateApiTokenRequest
- Defined in:
- lib/unit/models/api_token/org/create_api_token_request.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#source_ip ⇒ Object
readonly
Returns the value of attribute source_ip.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(user_id, description, scope, expiration, source_ip = nil, resources = nil) ⇒ CreateApiTokenRequest
constructor
A new instance of CreateApiTokenRequest.
- #to_json_api ⇒ Object
Constructor Details
#initialize(user_id, description, scope, expiration, source_ip = nil, resources = nil) ⇒ CreateApiTokenRequest
Returns a new instance of CreateApiTokenRequest.
17 18 19 20 21 22 23 24 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 17 def initialize(user_id, description, scope, expiration, source_ip = nil, resources = nil) @user_id = user_id @description = description @scope = scope @expiration = expiration @source_ip = source_ip @resources = resources end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
9 10 11 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 9 def description @description end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
9 10 11 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 9 def expiration @expiration end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
9 10 11 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 9 def resources @resources end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
9 10 11 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 9 def scope @scope end |
#source_ip ⇒ Object (readonly)
Returns the value of attribute source_ip.
9 10 11 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 9 def source_ip @source_ip end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
9 10 11 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 9 def user_id @user_id end |
Instance Method Details
#to_json_api ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/unit/models/api_token/org/create_api_token_request.rb', line 26 def to_json_api result = { data: { type: "apiToken", attributes: { description: description, scope: scope.join(" "), expiration: expiration, sourceIp: source_ip, resources: resources } } } result[:data][:attributes].compact! result.to_json end |