Class: AntiCaptcha::GeetestSolution

Inherits:
Solution show all
Defined in:
lib/anti_captcha/models/geetest_solution.rb

Instance Attribute Summary collapse

Attributes inherited from Solution

#api_response, #task_result

Instance Method Summary collapse

Constructor Details

#initialize(task_result = nil) ⇒ GeetestSolution

Returns a new instance of GeetestSolution.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/anti_captcha/models/geetest_solution.rb', line 5

def initialize(task_result = nil)
  super

  if task_result
    solution = task_result.api_result['solution']

    if solution['pass_token']
      @v4 = {
        'captcha_id'     => solution['captcha_id'],
        'lot_number'     => solution['lot_number'],
        'pass_token'     => solution['pass_token'],
        'gen_time'       => solution['gen_time'],
        'captcha_output' => solution['captcha_output'],
      }

    else
      @v3 = {
        'challenge' => solution['challenge'],
        'validate'  => solution['validate'],
        'seccode'   => solution['seccode'],
      }
    end
  end
end

Instance Attribute Details

#v3Object

Returns the value of attribute v3.



3
4
5
# File 'lib/anti_captcha/models/geetest_solution.rb', line 3

def v3
  @v3
end

#v4Object

Returns the value of attribute v4.



3
4
5
# File 'lib/anti_captcha/models/geetest_solution.rb', line 3

def v4
  @v4
end