Class: VerificationToken

Inherits:
Object
  • Object
show all
Defined in:
lib/trustcaptcha/model/verification_token.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verification_id, client_failover = false) ⇒ VerificationToken

Returns a new instance of VerificationToken.



7
8
9
10
# File 'lib/trustcaptcha/model/verification_token.rb', line 7

def initialize(verification_id, client_failover = false)
  @verification_id = verification_id
  @client_failover = client_failover
end

Instance Attribute Details

#client_failoverObject (readonly)

Returns the value of attribute client_failover.



5
6
7
# File 'lib/trustcaptcha/model/verification_token.rb', line 5

def client_failover
  @client_failover
end

#verification_idObject (readonly)

Returns the value of attribute verification_id.



5
6
7
# File 'lib/trustcaptcha/model/verification_token.rb', line 5

def verification_id
  @verification_id
end

Class Method Details

.from_base64(base64_string) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/trustcaptcha/model/verification_token.rb', line 12

def self.from_base64(base64_string)
  json_string = Base64.decode64(base64_string)
  data = JSON.parse(json_string)
  raise StandardError, 'Missing verificationId' if data['verificationId'].nil?
  new(data['verificationId'], data['clientFailover'] == true)
rescue StandardError => e
  raise e
end