class IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::ModuleTokenApiModel

Attributes

authorities[RW]
clientId[RW]
expiration[RW]
expired[RW]
message[RW]
modules[RW]
tenantId[RW]
token[RW]
tokenType[RW]
username[RW]
uuid[RW]

Public Class Methods

new(parsed_response = nil) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 13
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?
                @authorities = add_authorities(parsed_response['authorities']) if parsed_response['authorities'].present?
        end
end

Public Instance Methods

add_authorities(authorities) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 50
def add_authorities(authorities)
        @authorities = []
        if authorities.size > 0
                authorities.each do |at|
                        auth = IdnSdkRuby::Com::Nbos::Capi::Modules::Core::V0::AuthorityApiModel.new(at["uAuthorityName"], at["displayName"], at["description"])
                        @authorities << auth
                end
        end
end
add_errors(json_response) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 88
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) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 96
def add_messages(json_response)
        if json_response["message"].present?
                @message = json_response["message"]
        elsif json_response["error"].present?
                @message = json_response["error"]
        end

end
add_modules(modules) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 28
def add_modules(modules)
        @modules = []
        if modules.size > 0
                modules.each do |m|
                        mod = IdnSdkRuby::Com::Nbos::Capi::Modules::Core::V0::ModuleApiModel.new(m["uuid"], m["name"])
                        @modules << mod
                end
        end
end
as_json(options={}) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 105
def as_json(options={})
        {
                        username: @username,
                        clientId: @clientId,
                        tokenType: @tokenType,
                        token: @token,
                        expiration: @expiration,
                        expired: @expired,
                        tenantId: @tenantId,
                        modules: @modules,
                        uuid: @uuid
        }
end
get_authorities() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 60
def get_authorities
        if self.authorities.present?
                ms = []
                self.authorities.each do |m|
                        ms << m["uAuthorityName"]
                end
                ms
        else
                []
        end
end
get_modules() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 38
def get_modules
        if self.modules.present?
                ms = []
                self.modules.each do |m|
                        ms << m["name"]
                end
                ms
        else
                []
        end
end
has_authorities?() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 80
def has_authorities?
        if self.authorities.present?
                true
        else
                false
        end
end
is_member?() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 72
def is_member?
        if self.uuid.present?
                true
        else
                false
        end
end
to_json(*options) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 119
def to_json(*options)
        as_json(*options).to_json(*options)
end
to_s() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/module_token_api_model.rb, line 123
def to_s
        to_json
end