Class: Altcha::V2::Solution

Inherits:
Object
  • Object
show all
Defined in:
lib/altcha/v2.rb

Overview

The solution produced by V2.solve_challenge.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(counter:, derived_key:, time: nil) ⇒ Solution

Returns a new instance of Solution.



109
110
111
112
113
# File 'lib/altcha/v2.rb', line 109

def initialize(counter:, derived_key:, time: nil)
  @counter     = counter
  @derived_key = derived_key
  @time        = time
end

Instance Attribute Details

#counterObject

Returns the value of attribute counter.



107
108
109
# File 'lib/altcha/v2.rb', line 107

def counter
  @counter
end

#derived_keyObject

Returns the value of attribute derived_key.



107
108
109
# File 'lib/altcha/v2.rb', line 107

def derived_key
  @derived_key
end

#timeObject

Returns the value of attribute time.



107
108
109
# File 'lib/altcha/v2.rb', line 107

def time
  @time
end

Instance Method Details

#to_hObject



115
116
117
# File 'lib/altcha/v2.rb', line 115

def to_h
  { 'counter' => counter, 'derivedKey' => derived_key }
end

#to_json(options = {}) ⇒ Object



119
120
121
# File 'lib/altcha/v2.rb', line 119

def to_json(options = {})
  to_h.to_json(options)
end