Class: TwoCaptcha::Captcha

Inherits:
Model
  • Object
show all
Defined in:
lib/two_captcha/models/captcha.rb

Overview

Model of a Captcha returned by ZeroCaptcha API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from TwoCaptcha::Model

Instance Attribute Details

#api_responseObject

Returns the value of attribute api_response.



5
6
7
# File 'lib/two_captcha/models/captcha.rb', line 5

def api_response
  @api_response
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/two_captcha/models/captcha.rb', line 5

def id
  @id
end

#textObject

Returns the value of attribute text.



5
6
7
# File 'lib/two_captcha/models/captcha.rb', line 5

def text
  @text
end

Instance Method Details

#coordinatesObject



11
12
13
# File 'lib/two_captcha/models/captcha.rb', line 11

def coordinates
  text.scan(/x=([0-9]+),y=([0-9]+)/).map { |x, y| [x.to_i, y.to_i] }
end

#indexesObject



7
8
9
# File 'lib/two_captcha/models/captcha.rb', line 7

def indexes
  text.gsub('click:', '').split(/[^0-9]/).map(&:to_i)
end