Class: Altcha::Payload
- Inherits:
-
Object
- Object
- Altcha::Payload
- Defined in:
- lib/altcha.rb
Overview
Class representing the payload of a challenge.
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
Returns the value of attribute algorithm.
-
#challenge ⇒ Object
Returns the value of attribute challenge.
-
#number ⇒ Object
Returns the value of attribute number.
-
#salt ⇒ Object
Returns the value of attribute salt.
-
#signature ⇒ Object
Returns the value of attribute signature.
Instance Method Summary collapse
-
#from_json(string) ⇒ Payload
Creates a Payload object from a JSON string.
-
#to_json(options = {}) ⇒ String
Converts the Payload object to a JSON string.
Instance Attribute Details
#algorithm ⇒ Object
Returns the value of attribute algorithm.
56 57 58 |
# File 'lib/altcha.rb', line 56 def algorithm @algorithm end |
#challenge ⇒ Object
Returns the value of attribute challenge.
56 57 58 |
# File 'lib/altcha.rb', line 56 def challenge @challenge end |
#number ⇒ Object
Returns the value of attribute number.
56 57 58 |
# File 'lib/altcha.rb', line 56 def number @number end |
#salt ⇒ Object
Returns the value of attribute salt.
56 57 58 |
# File 'lib/altcha.rb', line 56 def salt @salt end |
#signature ⇒ Object
Returns the value of attribute signature.
56 57 58 |
# File 'lib/altcha.rb', line 56 def signature @signature end |
Instance Method Details
#from_json(string) ⇒ Payload
Creates a Payload object from a JSON string.
74 75 76 77 |
# File 'lib/altcha.rb', line 74 def from_json(string) data = JSON.parse(string) new data['algorithm'], data['verificationData'], data['signature'], data['verified'] end |
#to_json(options = {}) ⇒ String
Converts the Payload object to a JSON string.
61 62 63 64 65 66 67 68 69 |
# File 'lib/altcha.rb', line 61 def to_json( = {}) { algorithm: @algorithm, challenge: @challenge, number: @number, salt: @salt, signature: @signature }.to_json() end |