Class: IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::ModuleTokenApiModel
- Inherits:
-
BasicActiveModel
- Object
- BasicActiveModel
- IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::ModuleTokenApiModel
- Defined in:
- lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb
Instance Attribute Summary collapse
-
#clientId ⇒ Object
Returns the value of attribute clientId.
-
#expiration ⇒ Object
Returns the value of attribute expiration.
-
#expired ⇒ Object
Returns the value of attribute expired.
-
#message ⇒ Object
Returns the value of attribute message.
-
#modules ⇒ Object
Returns the value of attribute modules.
-
#tenantId ⇒ Object
Returns the value of attribute tenantId.
-
#token ⇒ Object
Returns the value of attribute token.
-
#tokenType ⇒ Object
Returns the value of attribute tokenType.
-
#username ⇒ Object
Returns the value of attribute username.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
- #add_errors(json_response) ⇒ Object
- #add_messages(json_response) ⇒ Object
- #add_modules(modules) ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize(parsed_response = nil) ⇒ ModuleTokenApiModel
constructor
A new instance of ModuleTokenApiModel.
- #to_json(*options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(parsed_response = nil) ⇒ ModuleTokenApiModel
Returns a new instance of ModuleTokenApiModel.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 11 def initialize(parsed_response = nil) if !parsed_response.nil? @username = parsed_response['username'] @clientId = parsed_response['clientId'] @tokenType = parsed_response['tokenType'] @token = parsed_response['token'] @expiration = parsed_response['expiration'] @expired = parsed_response['expired'] @tenantId = parsed_response['tenantId'] @uuid = parsed_response['member']['uuid'] if parsed_response['member'].present? @modules = add_modules(parsed_response['modules']) if parsed_response['modules'].present? end end |
Instance Attribute Details
#clientId ⇒ Object
Returns the value of attribute clientId.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def clientId @clientId end |
#expiration ⇒ Object
Returns the value of attribute expiration.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def expiration @expiration end |
#expired ⇒ Object
Returns the value of attribute expired.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def expired @expired end |
#message ⇒ Object
Returns the value of attribute message.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def end |
#modules ⇒ Object
Returns the value of attribute modules.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def modules @modules end |
#tenantId ⇒ Object
Returns the value of attribute tenantId.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def tenantId @tenantId end |
#token ⇒ Object
Returns the value of attribute token.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def token @token end |
#tokenType ⇒ Object
Returns the value of attribute tokenType.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def tokenType @tokenType end |
#username ⇒ Object
Returns the value of attribute username.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def username @username end |
#uuid ⇒ Object
Returns the value of attribute uuid.
9 10 11 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 9 def uuid @uuid end |
Instance Method Details
#add_errors(json_response) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 35 def add_errors(json_response) json_response["errors"].each do |e| property_name = e['propertyName'] msg = e['message'] self.errors[property_name] << msg end end |
#add_messages(json_response) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 43 def (json_response) if json_response["message"].present? = json_response["message"] elsif json_response["error"].present? = json_response["error"] end end |
#add_modules(modules) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 25 def add_modules(modules) @modules = [] if modules.size > 0 modules.each do |m| @modules << IdnSdkRuby::Com::Nbos::Capi::Modules::Core::V0::ModuleTokenApiModel.new(m) end end end |
#as_json(options = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 52 def as_json(={}) { username: @username, clientId: @clientId, tokenType: @tokenType, token: @token, expiration: @expiration, expired: @expired, tenantId: @tenantId, modules: @modules } end |
#to_json(*options) ⇒ Object
65 66 67 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 65 def to_json(*) as_json(*).to_json(*) end |
#to_s ⇒ Object
69 70 71 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb', line 69 def to_s to_json end |