class SmartId::Api::ConfirmationResponse

Constants

COMPLETED_STATE
RUNNING_STATE

Attributes

body[R]

Public Class Methods

new(response_body, hashed_data) click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 8
def initialize(response_body, hashed_data)
  @body = response_body
  validate!(hashed_data)
end

Public Instance Methods

certificate() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 33
def certificate
  @certificate ||= SmartId::AuthenticationCertificate::Certificate.new(@body.dig("cert", "value"))
end
certificate_level() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 29
def certificate_level
  @body.dig("cert", "certificateLevel")
end
confirmation_running?() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 13
def confirmation_running?
  state == RUNNING_STATE
end
document_number() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 25
def document_number
  @body.dig("result", "documentNumber")
end
end_result() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 21
def end_result
  @body.dig("result", "endResult")
end
ignored_properties() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 45
def ignored_properties
  @body["ignoredProperties"]
end
signature() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 41
def signature
  @body.dig("signature", "value")
end
signature_algorithm() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 37
def signature_algorithm
  @body.dig("signature", "algorithm")
end
state() click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 17
def state
  @body["state"]
end

Private Instance Methods

validate!(hashed_data) click to toggle source
# File lib/smart_id/api/confirmation_response.rb, line 51
def validate!(hashed_data)
  SmartId::Utils::CertificateValidator.validate!(hashed_data, signature, certificate)
end