Class: Yoti::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Set config variables by using a configuration block



9
10
11
12
13
14
15
16
17
# File 'lib/yoti/configuration.rb', line 9

def initialize
  @client_sdk_id = ''
  @key_file_path = ''
  @key = ''
  @sdk_identifier = 'Ruby'
  @api_url = 'https://api.yoti.com'
  @api_port = 443
  @api_version = 'v1'
end

Instance Attribute Details

#api_endpointString

Returns the API endpoint for the selected API version.

Returns:

  • (String)

    the API endpoint for the selected API version



20
21
22
# File 'lib/yoti/configuration.rb', line 20

def api_endpoint
  @api_endpoint ||= ENV['YOTI_API_URL'] || "#{@api_url}/api/#{@api_version}"
end

#api_portObject

Returns the value of attribute api_port.



3
4
5
# File 'lib/yoti/configuration.rb', line 3

def api_port
  @api_port
end

#api_urlObject

Returns the value of attribute api_url.



3
4
5
# File 'lib/yoti/configuration.rb', line 3

def api_url
  @api_url
end

#api_versionObject

Returns the value of attribute api_version.



3
4
5
# File 'lib/yoti/configuration.rb', line 3

def api_version
  @api_version
end

#client_sdk_idObject

Returns the value of attribute client_sdk_id.



3
4
5
# File 'lib/yoti/configuration.rb', line 3

def client_sdk_id
  @client_sdk_id
end

#doc_scan_api_endpointString

Returns the Doc Scan API endpoint.

Returns:

  • (String)

    the Doc Scan API endpoint



25
26
27
# File 'lib/yoti/configuration.rb', line 25

def doc_scan_api_endpoint
  @doc_scan_api_endpoint ||= ENV['YOTI_DOC_SCAN_API_URL'] || "#{@api_url}/idverify/#{@api_version}"
end

#keyObject

Returns the value of attribute key.



3
4
5
# File 'lib/yoti/configuration.rb', line 3

def key
  @key
end

#key_file_pathObject

Returns the value of attribute key_file_path.



3
4
5
# File 'lib/yoti/configuration.rb', line 3

def key_file_path
  @key_file_path
end

#sdk_identifierObject

Returns the value of attribute sdk_identifier.



3
4
5
# File 'lib/yoti/configuration.rb', line 3

def sdk_identifier
  @sdk_identifier
end

Instance Method Details

#validatenil

Validates the configuration values set in instance variables

Returns:

  • (nil)


31
32
33
34
35
# File 'lib/yoti/configuration.rb', line 31

def validate
  validate_required_all(%w[client_sdk_id])
  validate_required_any(%w[key_file_path key])
  validate_value('api_version', ['v1'])
end