Class: TruthID::AuthChallenge
- Inherits:
-
Object
- Object
- TruthID::AuthChallenge
- Defined in:
- lib/truthid/types.rb
Overview
AuthChallenge precisa de to_h com camelCase — por isso classe manual, não Struct
Instance Attribute Summary collapse
-
#issued_at ⇒ Object
readonly
Returns the value of attribute issued_at.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, nonce:, issued_at:, origin:) ⇒ AuthChallenge
constructor
A new instance of AuthChallenge.
-
#to_h ⇒ Object
JSON.generate(challenge.to_h) → formato exato que o mobile assina.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(type:, nonce:, issued_at:, origin:) ⇒ AuthChallenge
Returns a new instance of AuthChallenge.
8 9 10 11 12 13 |
# File 'lib/truthid/types.rb', line 8 def initialize(type:, nonce:, issued_at:, origin:) @type = type @nonce = nonce @issued_at = issued_at @origin = origin end |
Instance Attribute Details
#issued_at ⇒ Object (readonly)
Returns the value of attribute issued_at.
6 7 8 |
# File 'lib/truthid/types.rb', line 6 def issued_at @issued_at end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
6 7 8 |
# File 'lib/truthid/types.rb', line 6 def nonce @nonce end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
6 7 8 |
# File 'lib/truthid/types.rb', line 6 def origin @origin end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/truthid/types.rb', line 6 def type @type end |
Instance Method Details
#to_h ⇒ Object
JSON.generate(challenge.to_h) → formato exato que o mobile assina
16 17 18 |
# File 'lib/truthid/types.rb', line 16 def to_h { "type" => @type, "nonce" => @nonce, "issuedAt" => @issued_at, "origin" => @origin } end |
#to_json(*args) ⇒ Object
20 21 22 |
# File 'lib/truthid/types.rb', line 20 def to_json(*args) JSON.generate(to_h) end |