Class: Altcha::V1::Payload
- Inherits:
-
Object
- Object
- Altcha::V1::Payload
- Defined in:
- lib/altcha/v1.rb
Overview
The client-submitted solution payload.
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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(algorithm:, challenge:, number:, salt:, signature:) ⇒ Payload
constructor
A new instance of Payload.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(algorithm:, challenge:, number:, salt:, signature:) ⇒ Payload
Returns a new instance of Payload.
67 68 69 70 71 72 73 |
# File 'lib/altcha/v1.rb', line 67 def initialize(algorithm:, challenge:, number:, salt:, signature:) @algorithm = algorithm @challenge = challenge @number = number @salt = salt @signature = signature end |
Instance Attribute Details
#algorithm ⇒ Object
Returns the value of attribute algorithm.
65 66 67 |
# File 'lib/altcha/v1.rb', line 65 def algorithm @algorithm end |
#challenge ⇒ Object
Returns the value of attribute challenge.
65 66 67 |
# File 'lib/altcha/v1.rb', line 65 def challenge @challenge end |
#number ⇒ Object
Returns the value of attribute number.
65 66 67 |
# File 'lib/altcha/v1.rb', line 65 def number @number end |
#salt ⇒ Object
Returns the value of attribute salt.
65 66 67 |
# File 'lib/altcha/v1.rb', line 65 def salt @salt end |
#signature ⇒ Object
Returns the value of attribute signature.
65 66 67 |
# File 'lib/altcha/v1.rb', line 65 def signature @signature end |
Class Method Details
.from_json(string) ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/altcha/v1.rb', line 85 def self.from_json(string) data = JSON.parse(string) new( algorithm: data['algorithm'], challenge: data['challenge'], number: data['number'], salt: data['salt'], signature: data['signature'] ) end |
Instance Method Details
#to_json(options = {}) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/altcha/v1.rb', line 75 def to_json( = {}) { algorithm: @algorithm, challenge: @challenge, number: @number, salt: @salt, signature: @signature }.to_json() end |