deathbycaptcha 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
- == DeathByCaptcha
1
+ DeathByCaptcha
2
+ ==============
2
3
 
3
4
  DeathByCaptcha is a Ruby API for acessing the http://www.deathbycaptcha.com services.
4
5
 
@@ -6,11 +7,13 @@ It supports HTTP and socket-based connections, with the latter being recommended
6
7
 
7
8
  When using socket connections, make sure that outgoing TCP traffic to <b>api.deathbycaptcha.com</b> to the ports range in <b>8123-8130</b> is not blocked by your firewall.
8
9
 
9
- === Thread-safety note
10
+ Thread-safety note
11
+ ------------------
10
12
 
11
13
  The API is thread-safe, which means it is perfectly fine to share a client instance between multiple threads.
12
14
 
13
- === Installation
15
+ Installation
16
+ ------------
14
17
 
15
18
  You can install the latest DeathByCaptcha gem with:
16
19
 
@@ -20,41 +23,42 @@ You can add it to your Gemfile:
20
23
 
21
24
  gem 'deathbycaptcha'
22
25
 
23
- === Examples
26
+ Examples
27
+ --------
24
28
 
25
- ==== Create a client
29
+ ### Create a client
26
30
 
27
- ===== HTTP client
31
+ #### HTTP client
28
32
 
29
33
  require 'deathbycaptcha'
30
34
 
31
35
  client = DeathByCaptcha.http_client('myusername', 'mypassword')
32
36
 
33
- ===== Socket client
37
+ #### Socket client
34
38
 
35
39
  require 'deathbycaptcha'
36
40
 
37
41
  client = DeathByCaptcha.socket_client('myusername', 'mypassword')
38
42
 
39
- ==== Verbose mode (for debugging purposes)
43
+ #### Verbose mode (for debugging purposes)
40
44
 
41
45
  client.config.is_verbose = true
42
46
 
43
- ==== Decoding captcha
47
+ #### Decoding captcha
44
48
 
45
- ===== From URL
49
+ ##### From URL
46
50
 
47
51
  response = client.decode 'http://www.phpcaptcha.org/securimage/securimage_show.php'
48
52
 
49
53
  puts "captcha id: #{response['captcha']}, solution: #{response['text']}, is_correct: #{response['is_correct']}}"
50
54
 
51
- ===== From file path
55
+ ##### From file path
52
56
 
53
57
  response = client.decode 'path/to/my/captcha/file'
54
58
 
55
59
  puts "captcha id: #{response['captcha']}, solution: #{response['text']}, is_correct: #{response['is_correct']}}"
56
60
 
57
- ===== From a file
61
+ ##### From a file
58
62
 
59
63
  file = File.open('path/to/my/captcha/file', 'r')
60
64
 
@@ -62,7 +66,7 @@ You can add it to your Gemfile:
62
66
 
63
67
  puts "captcha id: #{response['captcha']}, solution: #{response['text']}, is_correct: #{response['is_correct']}}"
64
68
 
65
- ===== From raw content
69
+ ##### From raw content
66
70
 
67
71
  raw_content = File.open('path/to/my/captcha/file', 'r').read
68
72
 
@@ -70,19 +74,21 @@ You can add it to your Gemfile:
70
74
 
71
75
  puts "captcha id: #{response['captcha']}, solution: #{response['text']}, is_correct: #{response['is_correct']}}"
72
76
 
73
- ==== Get the solution of a captcha
77
+ #### Get the solution of a captcha
74
78
 
75
79
  puts client.get_captcha('130920620')['text'] # where 130920620 is the captcha id
76
80
 
77
- ==== Get user account information
81
+ #### Get user account information
78
82
 
79
83
  puts client.get_user
80
84
 
81
- === Maintainers
85
+ Maintainers
86
+ -----------
82
87
 
83
88
  * Rafael Barbolo Lopes (http://github.com/barbolo)
84
89
  * Rafael Ivan Garcia (http://github.com/rafaelivan)
85
90
 
86
- == License
91
+ License
92
+ -------
87
93
 
88
94
  MIT License. Copyright (C) 2011 by Infosimples. http://www.infosimples.com.br
@@ -185,7 +185,7 @@ module DeathByCaptcha
185
185
 
186
186
  if file.nil?
187
187
  raise DeathByCaptcha::Errors::CaptchaEmpty
188
- elsif config.max_captcha_file_size <= file.size
188
+ elsif config.max_captcha_file_size <= File.size?(file).to_i
189
189
  raise DeathByCaptcha::Errors::CaptchaOverflow
190
190
  end
191
191
 
@@ -1,4 +1,4 @@
1
1
  module DeathByCaptcha
2
- VERSION = "4.0.1"
3
- API_VERSION = "DBC/Ruby v4.0.1"
2
+ VERSION = "4.0.2"
3
+ API_VERSION = "DBC/Ruby v4.0.2"
4
4
  end
metadata CHANGED
@@ -1,54 +1,50 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: deathbycaptcha
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.0.2
4
5
  prerelease:
5
- version: 4.0.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Rafael Barbolo Lopes, Rafael Ivan Garcia
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-04-07 00:00:00 -03:00
12
+ date: 2011-09-26 00:00:00.000000000 -03:00
14
13
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: rest-client
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2153340400 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
19
+ requirements:
22
20
  - - ~>
23
- - !ruby/object:Gem::Version
21
+ - !ruby/object:Gem::Version
24
22
  version: 1.6.1
25
23
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: json
29
24
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2153340400
26
+ - !ruby/object:Gem::Dependency
27
+ name: json
28
+ requirement: &2153339900 !ruby/object:Gem::Requirement
31
29
  none: false
32
- requirements:
30
+ requirements:
33
31
  - - ~>
34
- - !ruby/object:Gem::Version
32
+ - !ruby/object:Gem::Version
35
33
  version: 1.4.6
36
34
  type: :runtime
37
- version_requirements: *id002
35
+ prerelease: false
36
+ version_requirements: *2153339900
38
37
  description: Ruby API for DeathByCaptcha (Captcha Solver as a Service)
39
- email:
38
+ email:
40
39
  - tech@infosimples.com.br
41
40
  executables: []
42
-
43
41
  extensions: []
44
-
45
42
  extra_rdoc_files: []
46
-
47
- files:
43
+ files:
48
44
  - .gitignore
49
45
  - Gemfile
50
46
  - MIT-LICENSE
51
- - README.rdoc
47
+ - README.md
52
48
  - Rakefile
53
49
  - deathbycaptcha.gemspec
54
50
  - lib/deathbycaptcha.rb
@@ -61,30 +57,26 @@ files:
61
57
  has_rdoc: true
62
58
  homepage: http://github.com/infosimples/deathbycaptcha
63
59
  licenses: []
64
-
65
60
  post_install_message:
66
61
  rdoc_options: []
67
-
68
- require_paths:
62
+ require_paths:
69
63
  - lib
70
- required_ruby_version: !ruby/object:Gem::Requirement
64
+ required_ruby_version: !ruby/object:Gem::Requirement
71
65
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: "0"
76
- required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
71
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: "0"
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
82
76
  requirements: []
83
-
84
77
  rubyforge_project: deathbycaptcha
85
- rubygems_version: 1.5.2
78
+ rubygems_version: 1.6.2
86
79
  signing_key:
87
80
  specification_version: 3
88
81
  summary: Ruby API for DeathByCaptcha (Captcha Solver as a Service)
89
82
  test_files: []
90
-