Class: Soar::Authentication::IdentityUuidTranslator::Test::OrchestrationProvider::Customer

Inherits:
Base
  • Object
show all
Defined in:
lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb

Direct Known Subclasses

CustomerClientNumber, CustomerEmail

Instance Method Summary collapse

Methods inherited from Base

#given_identity_uuid_translator, #given_role_generator, #given_roles_directory, #request_identity_uuid

Instance Method Details

#given_existing_role_and_attributesObject



10
11
12
13
14
15
16
# File 'lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb', line 10

def given_existing_role_and_attributes
  @roles_directory.put({
    "identity_uuid" => Soar::Authentication::IdentityUuidTranslator::UuidGenerator.generate("#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity[:ID]}"),
    "identity_role" => Soar::Authentication::IdentityUuidTranslator::Provider::Customer::ROLE,
    "identity_role_attributes" => [Faker::Number.unique.number(10)].compact
  })
end

#role?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb', line 18

def role?
  begin
    primary_key = {
      "identity_uuid" => @uuid,
      "identity_role" => Soar::Authentication::IdentityUuidTranslator::Provider::Customer::ROLE
    }
    identity = @roles_directory.fetch(primary_key)
    identity['identity_role'] == Soar::Authentication::IdentityUuidTranslator::Provider::Customer::ROLE
    return identity['identity_role_attributes'].include?(@identity[:Client_Number])
  rescue Soar::Registry::Directory::Error::NoEntriesFoundError => e
    return false
  end
end

#uuid?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb', line 32

def uuid?
  @uuid == Soar::Authentication::IdentityUuidTranslator::UuidGenerator.generate("#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity[:ID]}")
end