Class: TruthID::AuthResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/truthid/types.rb

Overview

AuthResponse é o que chega do mobile (chaves camelCase do JSON mapeadas manualmente)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(approved:, nonce:, signature:, device_address:) ⇒ AuthResponse

Returns a new instance of AuthResponse.



29
30
31
32
33
34
# File 'lib/truthid/types.rb', line 29

def initialize(approved:, nonce:, signature:, device_address:)
  @approved       = approved
  @nonce          = nonce
  @signature      = signature
  @device_address = device_address
end

Instance Attribute Details

#approvedObject (readonly)

Returns the value of attribute approved.



27
28
29
# File 'lib/truthid/types.rb', line 27

def approved
  @approved
end

#device_addressObject (readonly)

Returns the value of attribute device_address.



27
28
29
# File 'lib/truthid/types.rb', line 27

def device_address
  @device_address
end

#nonceObject (readonly)

Returns the value of attribute nonce.



27
28
29
# File 'lib/truthid/types.rb', line 27

def nonce
  @nonce
end

#signatureObject (readonly)

Returns the value of attribute signature.



27
28
29
# File 'lib/truthid/types.rb', line 27

def signature
  @signature
end

Class Method Details

.from_hash(h) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/truthid/types.rb', line 36

def self.from_hash(h)
  new(
    approved:       h["approved"],
    nonce:          h["nonce"],
    signature:      h["signature"],
    device_address: h["deviceAddress"]
  )
end