Class: SmartId::Api::Authentication::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_id/api/authentication/base.rb

Direct Known Subclasses

Document, IdentityNumber

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ Base

Returns a new instance of Base.



15
16
17
18
19
20
# File 'lib/smart_id/api/authentication/base.rb', line 15

def initialize(**opts)
  @authentication_hash = opts[:authentication_hash]
  @display_text = opts[:display_text]
  @certificate_level = opts[:certificate_level]
  @multiple_choice = opts[:multiple_choice]
end

Instance Attribute Details

#authentication_hashObject (readonly)

Returns the value of attribute authentication_hash.



9
10
11
# File 'lib/smart_id/api/authentication/base.rb', line 9

def authentication_hash
  @authentication_hash
end

Class Method Details

.authenticate(**opts) ⇒ Object



11
12
13
# File 'lib/smart_id/api/authentication/base.rb', line 11

def self.authenticate(**opts)
  new(**opts).call
end

Instance Method Details

#callObject



23
24
25
26
# File 'lib/smart_id/api/authentication/base.rb', line 23

def call
  response = SmartId::Api::Request.execute(method: :post, uri: api_uri, params: request_params)
  SmartId::Api::Response.new(JSON.parse(response.body), authentication_hash)
end