Class: Altcha::Challenge
- Inherits:
-
Object
- Object
- Altcha::Challenge
- Defined in:
- lib/altcha.rb
Overview
Class representing a challenge with its attributes.
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
Returns the value of attribute algorithm.
-
#challenge ⇒ Object
Returns the value of attribute challenge.
-
#maxnumber ⇒ Object
Returns the value of attribute maxnumber.
-
#salt ⇒ Object
Returns the value of attribute salt.
-
#signature ⇒ Object
Returns the value of attribute signature.
Instance Method Summary collapse
-
#initialize(algorithm:, challenge:, maxnumber: nil, salt:, signature:) ⇒ Challenge
constructor
A new instance of Challenge.
-
#to_json(options = {}) ⇒ String
Converts the Challenge object to a JSON string.
Constructor Details
#initialize(algorithm:, challenge:, maxnumber: nil, salt:, signature:) ⇒ Challenge
Returns a new instance of Challenge.
43 44 45 46 47 48 49 |
# File 'lib/altcha.rb', line 43 def initialize(algorithm:, challenge:, maxnumber: nil, salt:, signature:) @algorithm = algorithm @challenge = challenge @maxnumber = maxnumber @salt = salt @signature = signature end |
Instance Attribute Details
#algorithm ⇒ Object
Returns the value of attribute algorithm.
41 42 43 |
# File 'lib/altcha.rb', line 41 def algorithm @algorithm end |
#challenge ⇒ Object
Returns the value of attribute challenge.
41 42 43 |
# File 'lib/altcha.rb', line 41 def challenge @challenge end |
#maxnumber ⇒ Object
Returns the value of attribute maxnumber.
41 42 43 |
# File 'lib/altcha.rb', line 41 def maxnumber @maxnumber end |
#salt ⇒ Object
Returns the value of attribute salt.
41 42 43 |
# File 'lib/altcha.rb', line 41 def salt @salt end |
#signature ⇒ Object
Returns the value of attribute signature.
41 42 43 |
# File 'lib/altcha.rb', line 41 def signature @signature end |
Instance Method Details
#to_json(options = {}) ⇒ String
Converts the Challenge object to a JSON string.
54 55 56 57 58 59 60 61 62 |
# File 'lib/altcha.rb', line 54 def to_json( = {}) { algorithm: @algorithm, challenge: @challenge, maxnumber: @maxnumber, salt: @salt, signature: @signature }.to_json() end |