module SelfSDK

Namespace for classes and modules that handle Self interactions.

Copyright 2020 Self Group Ltd. All Rights Reserved.

Copyright 2020 Self Group Ltd. All Rights Reserved.

Namespace for classes and modules that handle Self interactions.

Namespace for classes and modules that handle SelfSDK gem

Namespace for classes and modules that handle SelfSDK gem

Namespace for classes and modules that handle SelfSDK gem

Namespace for classes and modules that handle SelfSDK gem

Copyright 2020 Self Group Ltd. All Rights Reserved.

Constants

ACTION_ADD
ACTION_REVOKE
FACT_ADDRESS
FACT_CATEGORIES
FACT_COUNTRY_OF_ISSUANCE
FACT_DATE_OF_BIRTH
FACT_DATE_OF_EXPIRATION
FACT_DATE_OF_ISSUANCE
FACT_DISPLAY_NAME
FACT_DOCUMENT_NUMBER
FACT_EMAIL
FACT_GIVEN_NAMES
FACT_ISSUING_AUTHORITY
FACT_NATIONALITY
FACT_PHONE
FACT_PLACE_OF_BIRTH
FACT_SEX
FACT_SORT_CODE
FACT_SURNAME
FACT_VALID_FROM
FACT_VALID_TO
KEY_TYPE_DEVICE
KEY_TYPE_RECOVERY
SOURCE_DRIVING_LICENSE
SOURCE_IDENTITY_CARD
SOURCE_PASSPORT
SOURCE_USER_SPECIFIED

Attributes

logger[W]

Public Class Methods

fact_name(input) click to toggle source
# File lib/sources.rb, line 51
def fact_name(input)
  facts = { email_address: FACT_EMAIL,
            phone_number: FACT_PHONE,
            display_name: FACT_DISPLAY_NAME,
            document_number: FACT_DOCUMENT_NUMBER,
            given_names: FACT_GIVEN_NAMES,
            surname: FACT_SURNAME,
            sex: FACT_SEX,
            issuing_authority: FACT_ISSUING_AUTHORITY,
            nationality: FACT_NATIONALITY,
            address: FACT_ADDRESS,
            place_of_birth: FACT_PLACE_OF_BIRTH,
            date_of_birth: FACT_DATE_OF_BIRTH,
            date_of_issuance: FACT_DATE_OF_ISSUANCE,
            date_of_expiration: FACT_DATE_OF_EXPIRATION,
            valid_from: FACT_VALID_FROM,
            valid_to: FACT_VALID_TO,
            categories: FACT_CATEGORIES,
            sort_code: FACT_SORT_CODE,
            country_of_issuance: FACT_COUNTRY_OF_ISSUANCE }
  get(facts, input, "fact")
end
get(options, input, option_type) click to toggle source
# File lib/sources.rb, line 82
def get(options, input, option_type)
  if input.is_a? Symbol
    raise "invalid #{option_type} '#{input.to_s}'" unless options.key? input
    return options[input]
  end
  raise "invalid #{option_type} '#{input}'" unless options.values.include? input
  input
end
logger() click to toggle source
# File lib/log.rb, line 11
def logger
  @logger ||= Logger.new('/dev/null')

  #@logger ||= ::Logger.new($stdout).tap do |log|
  #  log.progname = name
  #end
end
message_type(s) click to toggle source
# File lib/sources.rb, line 32
def message_type(s)
  types = { authentication_request: SelfSDK::Messages::AuthenticationReq::MSG_TYPE,
            authentication_response: SelfSDK::Messages::AuthenticationResp::MSG_TYPE,
            fact_request: SelfSDK::Messages::FactRequest::MSG_TYPE,
            fact_response: SelfSDK::Messages::FactResponse::MSG_TYPE }
  raise "invalid message type" unless types.key? s
  return types[s]
end
operator(input) click to toggle source
# File lib/sources.rb, line 41
def operator(input)
  operators = { equals: '==',
                different: '!=',
                great_or_equal_than: '>=',
                less_or_equal: '<=',
                great_than: '>',
                less_than: '<' }
  get(operators, input, "operator")
end
source(input) click to toggle source
# File lib/sources.rb, line 74
def source(input)
  sources = { user_specified: SOURCE_USER_SPECIFIED,
            passport: SOURCE_PASSPORT,
            driving_license: SOURCE_DRIVING_LICENSE,
            identity_card: SOURCE_IDENTITY_CARD }
  get(sources, input, "source")
end