Class: Altcha::ServerSignaturePayload
- Inherits:
-
Object
- Object
- Altcha::ServerSignaturePayload
- Defined in:
- lib/altcha.rb
Overview
Class representing the payload for server signatures.
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
Returns the value of attribute algorithm.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#verification_data ⇒ Object
Returns the value of attribute verification_data.
-
#verified ⇒ Object
Returns the value of attribute verified.
Class Method Summary collapse
-
.from_json(string) ⇒ ServerSignaturePayload
Creates a ServerSignaturePayload object from a JSON string.
Instance Method Summary collapse
-
#initialize(algorithm:, verification_data:, signature:, verified:) ⇒ ServerSignaturePayload
constructor
A new instance of ServerSignaturePayload.
-
#to_json(options = {}) ⇒ String
Converts the ServerSignaturePayload object to a JSON string.
Constructor Details
#initialize(algorithm:, verification_data:, signature:, verified:) ⇒ ServerSignaturePayload
Returns a new instance of ServerSignaturePayload.
109 110 111 112 113 114 |
# File 'lib/altcha.rb', line 109 def initialize(algorithm:, verification_data:, signature:, verified:) @algorithm = algorithm @verification_data = verification_data @signature = signature @verified = verified end |
Instance Attribute Details
#algorithm ⇒ Object
Returns the value of attribute algorithm.
107 108 109 |
# File 'lib/altcha.rb', line 107 def algorithm @algorithm end |
#signature ⇒ Object
Returns the value of attribute signature.
107 108 109 |
# File 'lib/altcha.rb', line 107 def signature @signature end |
#verification_data ⇒ Object
Returns the value of attribute verification_data.
107 108 109 |
# File 'lib/altcha.rb', line 107 def verification_data @verification_data end |
#verified ⇒ Object
Returns the value of attribute verified.
107 108 109 |
# File 'lib/altcha.rb', line 107 def verified @verified end |
Class Method Details
.from_json(string) ⇒ ServerSignaturePayload
Creates a ServerSignaturePayload object from a JSON string.
131 132 133 134 135 136 137 138 139 |
# File 'lib/altcha.rb', line 131 def self.from_json(string) data = JSON.parse(string) new( algorithm: data['algorithm'], verification_data: data['verificationData'], signature: data['signature'], verified: data['verified'] ) end |
Instance Method Details
#to_json(options = {}) ⇒ String
Converts the ServerSignaturePayload object to a JSON string.
119 120 121 122 123 124 125 126 |
# File 'lib/altcha.rb', line 119 def to_json( = {}) { algorithm: @algorithm, verificationData: @verification_data, signature: @signature, verified: @verified }.to_json() end |