Class: SmartId::Api::ConfirmationResponse

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

Constant Summary collapse

RUNNING_STATE =
"RUNNING"
COMPLETED_STATE =
"COMPLETE"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body, hashed_data) ⇒ ConfirmationResponse

Returns a new instance of ConfirmationResponse.



8
9
10
11
# File 'lib/smart_id/api/confirmation_response.rb', line 8

def initialize(response_body, hashed_data)
  @body = response_body
  validate!(hashed_data)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/smart_id/api/confirmation_response.rb', line 6

def body
  @body
end

Instance Method Details

#certificateObject



33
34
35
# File 'lib/smart_id/api/confirmation_response.rb', line 33

def certificate
  @certificate ||= SmartId::AuthenticationCertificate::Certificate.new(@body.dig("cert", "value"))
end

#certificate_levelObject



29
30
31
# File 'lib/smart_id/api/confirmation_response.rb', line 29

def certificate_level
  @body.dig("cert", "certificateLevel")
end

#confirmation_running?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/smart_id/api/confirmation_response.rb', line 13

def confirmation_running?
  state == RUNNING_STATE
end

#document_numberObject



25
26
27
# File 'lib/smart_id/api/confirmation_response.rb', line 25

def document_number
  @body.dig("result", "documentNumber")
end

#end_resultObject



21
22
23
# File 'lib/smart_id/api/confirmation_response.rb', line 21

def end_result
  @body.dig("result", "endResult")
end

#ignored_propertiesObject



45
46
47
# File 'lib/smart_id/api/confirmation_response.rb', line 45

def ignored_properties
  @body["ignoredProperties"]
end

#signatureObject



41
42
43
# File 'lib/smart_id/api/confirmation_response.rb', line 41

def signature
  @body.dig("signature", "value")
end

#signature_algorithmObject



37
38
39
# File 'lib/smart_id/api/confirmation_response.rb', line 37

def signature_algorithm
  @body.dig("signature", "algorithm")
end

#stateObject



17
18
19
# File 'lib/smart_id/api/confirmation_response.rb', line 17

def state
  @body["state"]
end