Class: Altcha::V1::Challenge

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

Overview

A challenge sent to the client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(algorithm:, challenge:, maxnumber: nil, salt:, signature:) ⇒ Challenge

Returns a new instance of Challenge.



44
45
46
47
48
49
50
# File 'lib/altcha/v1.rb', line 44

def initialize(algorithm:, challenge:, maxnumber: nil, salt:, signature:)
  @algorithm = algorithm
  @challenge = challenge
  @maxnumber = maxnumber
  @salt      = salt
  @signature = signature
end

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



42
43
44
# File 'lib/altcha/v1.rb', line 42

def algorithm
  @algorithm
end

#challengeObject

Returns the value of attribute challenge.



42
43
44
# File 'lib/altcha/v1.rb', line 42

def challenge
  @challenge
end

#maxnumberObject

Returns the value of attribute maxnumber.



42
43
44
# File 'lib/altcha/v1.rb', line 42

def maxnumber
  @maxnumber
end

#saltObject

Returns the value of attribute salt.



42
43
44
# File 'lib/altcha/v1.rb', line 42

def salt
  @salt
end

#signatureObject

Returns the value of attribute signature.



42
43
44
# File 'lib/altcha/v1.rb', line 42

def signature
  @signature
end

Instance Method Details

#to_json(options = {}) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/altcha/v1.rb', line 52

def to_json(options = {})
  {
    algorithm: @algorithm,
    challenge: @challenge,
    maxnumber: @maxnumber,
    salt:      @salt,
    signature: @signature
  }.to_json(options)
end