Class: VerificationResult

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ VerificationResult

Returns a new instance of VerificationResult.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/trustcaptcha/model/verification_result.rb', line 8

def initialize(data)
  @captcha_id = data['captchaId']
  @verification_id = data['verificationId']
  @score = data['score']
  @reason = data['reason']
  @mode = data['mode']
  @origin = data['origin']
  @ip_address = data['ipAddress']
  @device_family = data['deviceFamily']
  @operating_system = data['operatingSystem']
  @browser = data['browser']
  @creation_timestamp = data['creationTimestamp']
  @release_timestamp = data['releaseTimestamp']
  @retrieval_timestamp = data['retrievalTimestamp']
  @verification_passed = data['verificationPassed']
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def browser
  @browser
end

#captcha_idObject (readonly)

Returns the value of attribute captcha_id.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def captcha_id
  @captcha_id
end

#creation_timestampObject (readonly)

Returns the value of attribute creation_timestamp.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def creation_timestamp
  @creation_timestamp
end

#device_familyObject (readonly)

Returns the value of attribute device_family.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def device_family
  @device_family
end

#ip_addressObject (readonly)

Returns the value of attribute ip_address.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def ip_address
  @ip_address
end

#modeObject (readonly)

Returns the value of attribute mode.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def mode
  @mode
end

#operating_systemObject (readonly)

Returns the value of attribute operating_system.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def operating_system
  @operating_system
end

#originObject (readonly)

Returns the value of attribute origin.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def origin
  @origin
end

#reasonObject (readonly)

Returns the value of attribute reason.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def reason
  @reason
end

#release_timestampObject (readonly)

Returns the value of attribute release_timestamp.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def release_timestamp
  @release_timestamp
end

#retrieval_timestampObject (readonly)

Returns the value of attribute retrieval_timestamp.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def retrieval_timestamp
  @retrieval_timestamp
end

#scoreObject (readonly)

Returns the value of attribute score.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def score
  @score
end

#verification_idObject (readonly)

Returns the value of attribute verification_id.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def verification_id
  @verification_id
end

#verification_passedObject (readonly)

Returns the value of attribute verification_passed.



4
5
6
# File 'lib/trustcaptcha/model/verification_result.rb', line 4

def verification_passed
  @verification_passed
end

Class Method Details

.from_json(json_data) ⇒ Object



25
26
27
28
# File 'lib/trustcaptcha/model/verification_result.rb', line 25

def self.from_json(json_data)
  data = JSON.parse(json_data)
  new(data)
end

Instance Method Details

#to_json(*_args) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/trustcaptcha/model/verification_result.rb', line 30

def to_json(*_args)
  {
    captchaId: @captcha_id,
    verificationId: @verification_id,
    score: @score,
    reason: @reason,
    mode: @mode,
    origin: @origin,
    ipAddress: @ip_address,
    deviceFamily: @device_family,
    operatingSystem: @operating_system,
    browser: @browser,
    creationTimestamp: @creation_timestamp,
    releaseTimestamp: @release_timestamp,
    retrievalTimestamp: @retrieval_timestamp,
    verificationPassed: @verification_passed
  }.to_json
end