rucaptcha_api 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 642a13024ef55b534056108982db38a64189151d
4
- data.tar.gz: 71ac25cca9fe38550a7b5f1814df40f3991f3ee2
3
+ metadata.gz: b78a687d548bffb75d3385de710ab10183f4599f
4
+ data.tar.gz: 71738660d81feba3c89bc4ba35cd660c0499afee
5
5
  SHA512:
6
- metadata.gz: 45b70900c9022c1eb3fc6c7298176ba10c887fc2587db7045d6cdb6b02f933d522bd163581adf8c0f214f51f2bc6749d4211371f5a79846424f4131cd578c61f
7
- data.tar.gz: e09ecf5a6977662c7ba4583afc2de2020936287c69182915920794fb8cf50e596cfe61a243e1f9faf27e1ebc88cff4054e8de32d887b87d23e5be58efd171d69
6
+ metadata.gz: 2923871020d1cebe9608e8983c4e93bef824a5189a719b4af6edaf4be89194f363fc298dc698085b5f511a703897fc7f70e77ce80442a5c46965ebcbf7bf9b50
7
+ data.tar.gz: f4569069617abffae4f66c198d827bbab53d85fb79da60ec59c3ff394ccb0c6e63458d677fa605304dced6e0124668f244d424aa74f793bf22191333b7498a32
data/.gitignore CHANGED
@@ -1,9 +1,7 @@
1
- /.bundle/
2
- /.yardoc
3
1
  /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
2
+
3
+ /test.rb
4
+
5
+
6
+
7
+
data/README.md CHANGED
@@ -1,32 +1,136 @@
1
- # RucaptchaApi
1
+ ## RucaptchaApi
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rucaptcha_api`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This gem facilitates interaction with https://rucaptcha.com/api-rucaptcha API.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ### Installation
6
6
 
7
- ## Installation
7
+ `gem 'rucaptcha_api'`
8
8
 
9
- Add this line to your application's Gemfile:
9
+ ### Fast usage
10
+ [/example.rb](https://github.com/lakesare/rucaptcha_api/blob/master/example.rb)
10
11
 
11
- ```ruby
12
- gem 'rucaptcha_api'
13
- ```
12
+ ### Explained usage
13
+ `require 'rucaptcha_api'`
14
+ `rucaptcha_key = '5d01e7jk4d9c64a784b25d38840d1407'` - for example. get your own 'captcha KEY' from https://rucaptcha.com/setting page after you registered.
15
+ `api = RucaptchaApi.new rucaptcha_key`
16
+ `path_to_captcha = File.expand_path 'var/captchas/1.png'` - absolute path to image of your captcha (only accepts jpg,jpeg,gif,png)
17
+ `captcha_id = api.send_captcha_for_solving path_to_captcha, params: {phrase: 1}` - you send captcha for solving, and you get its id as a resonse so that you can later look up its solution when it's ready.
18
+ **params** here are optional, and you can find possible params in API docs https://rucaptcha.com/api-rucaptcha:
14
19
 
15
- And then execute:
16
20
 
17
- $ bundle
21
+ <table border="1" cellpadding="1" cellspacing="1" style="width:900px">
22
+ <thead>
23
+ <tr>
24
+ <th scope="col">POST параметр</th>
25
+ <th scope="col">возможные значения</th>
26
+ <th scope="col">описание параметра</th>
27
+ </tr>
28
+ </thead>
29
+ <tbody>
30
+ <tr>
31
+ <td>phrase</td>
32
+ <td>0;1</td>
33
+ <td><strong>0</strong> = одно слово (значение по умлочанию)<br>
34
+ <strong>1</strong> = капча имеет два слова</td>
35
+ </tr>
36
+ <tr>
37
+ <td>regsense</td>
38
+ <td>0;1</td>
39
+ <td><strong>0</strong> = регистр ответа не имеет значения (значение по умолчанию )<br>
40
+ <strong>1</strong> = регистр ответа имеет значение</td>
41
+ </tr>
42
+ <tr>
43
+ <td>question</td>
44
+ <td>0;1</td>
45
+ <td><strong>0</strong> = параметр не задействован (значение по умолчанию )<br>
46
+ <strong>1</strong> = на изображении задан вопрос, работник должен написать ответ</td>
47
+ </tr>
48
+ <tr>
49
+ <td>numeric</td>
50
+ <td>0;1;2;3</td>
51
+ <td>
52
+ <p><strong>0</strong> = параметр не задействован (значение по умолчанию)<br>
53
+ <strong>1</strong> = капча состоит только из цифр<br>
54
+ <strong>2</strong> = Капча состоит только из букв<br>
55
+ <strong>3</strong> = Капча состоит либо только из цифр, либо только из букв.</p>
56
+ </td>
57
+ </tr>
58
+ <tr>
59
+ <td>calc</td>
60
+ <td>0;1</td>
61
+ <td><strong>0</strong> = параметр не задействован (значение по умолчанию)<br>
62
+ <strong>1</strong> = работнику нужно совершить математическое действие с капчи</td>
63
+ </tr>
64
+ <tr>
65
+ <td>min_len</td>
66
+ <td>0..20</td>
67
+ <td>
68
+ <p><strong>0</strong> = параметр не задействован (значение по умолчанию)<br>
69
+ <strong>1..20 </strong>= минимальное количество знаков в ответе</p>
70
+ </td>
71
+ </tr>
72
+ <tr>
73
+ <td>max_len</td>
74
+ <td>1..20</td>
75
+ <td><strong>0</strong> = параметр не задействован (значение по умолчанию)<br>
76
+ <strong>1..20 </strong>= максимальное количество знаков в ответе</td>
77
+ </tr>
78
+ <tr>
79
+ <td>is_russian</td>
80
+ <td>0;1</td>
81
+ <td>
82
+ <p>параметр больше не используется, т.к. он означал "слать данную капчу русским исполнителям", а в системе находятся только русскоязычные исполнители. Смотрите новый параметр language, однозначно обозначающий язык капчи</p>
83
+ </td>
84
+ </tr>
85
+ <tr>
86
+ <td>soft_id</td>
87
+ <td>&nbsp;</td>
88
+ <td>ID разработчика приложения. Разработчику приложения отчисляется 10% от всех капч, пришедших из его приложения.</td>
89
+ </tr>
90
+ <tr>
91
+ <td>language</td>
92
+ <td>0;1;2</td>
93
+ <td>
94
+ <strong>0</strong> = параметр не задействован (значение по умолчанию)<br>
95
+ <strong>1</strong> = на капче только кириллические буквы<br>
96
+ <strong>2</strong> = на капче только латинские буквы<br>
97
+ </td>
98
+ </tr>
99
+ <tr>
100
+ <td>header_acao</td>
101
+ <td>0;1</td>
102
+ <td><strong>0</strong> = значение по умолчанию<br>
103
+ <strong>1</strong> = in.php передаст Access-Control-Allow-Origin: * параметр в заголовке ответа. (Необходимо для кросс-доменных AJAX запросов в браузерных приложениях. Работает также для res.php.)</td>
104
+ </tr>
105
+ <tr>
106
+ <td>textinstructions</td>
107
+ <td>TEXT</td>
108
+ <td>Текст, который будет показан работнику. Может содержать в себе инструкции по разгадке капчи. Ограничение - 140 символов. Текст необходимо слать в кодировке UTF-8.</td>
109
+ </tr>
110
+ <tr>
111
+ <td>textcaptcha </td>
112
+ <td>TEXT</td>
113
+ <td>Текстовая капча. Картинка при этом не загружается, работник получает только текст и вводит ответ на этот текст. Ограничение - 140 символов. Текст необходимо слать в кодировке UTF-8.</td>
114
+ </tr>
115
+ </tbody>
116
+ </table>
18
117
 
19
- Or install it yourself as:
20
118
 
21
- $ gem install rucaptcha_api
22
119
 
23
- ## Usage
120
+ after you sent your captcha for solving and got captcha_id, you can find solved captcha with:
121
+ `solved_captcha = api.get_solved_captcha captcha_id #=> Yi7yu8` (in case it's not ready yet, this method will automatically wait for 5 seconds and then resend the request for solved captcha).
24
122
 
25
- TODO: Write usage instructions here
123
+ in case your captcha wasn't properly solved, you can complain on it with `api.complain captcha_id`.
124
+
125
+ ### Methods to get statistics
126
+ `api.balance #=> 95.03` - Узнать баланс аккаунта. Баланс указывается в Российских рублях.
127
+
128
+ `api.captcha_cost captcha_id` - Запрос статуса и стоимости распознования данной капчи. Цена указывается в рублях.
129
+
130
+ `api.stats_for date: '2013-11-27' # => string with xml` - получить статистику использования аккаунта в XML за указанную дату.
131
+
132
+ `RucaptchaApi.rucaptcha_stats # => {waiting: ..., ...}` - waiting: количество работников ожидающих капчу. load: процент загрузки работников. minbid: текущая ставка за распознание капчи. В рублях. averageRecognitionTime: среднее время (в секундах) за которое в данный момент разгадываются капчи
26
133
 
27
- ## Development
28
134
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
135
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
136
 
data/example.rb ADDED
@@ -0,0 +1,17 @@
1
+
2
+
3
+
4
+
5
+ require 'rucaptcha_api'
6
+ rucaptcha_key = '5d01e7jk4d9c64a784b25d38840d1407'
7
+ api = RucaptchaApi.new rucaptcha_key
8
+ path_to_captcha = File.expand_path 'var/captchas/1.png'
9
+ captcha_id = api.send_captcha_for_solving path_to_captcha, params: {phrase: 1}
10
+ solved_captcha = api.get_solved_captcha captcha_id
11
+ p solved_captcha #=> "3yk4p"
12
+
13
+
14
+
15
+
16
+
17
+
@@ -1,3 +1,3 @@
1
1
  class RucaptchaApi
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
Binary file
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jevgenija Karunus"]
10
10
  spec.email = ["lakesare@gmail.com"]
11
11
 
12
- spec.summary = 'Ruby mapper for https://rucaptcha.com API'
12
+ spec.summary = 'This gem facilitates interaction with https://rucaptcha.com/api-rucaptcha API.'
13
13
  spec.homepage = 'https://github.com/lakesare/rucaptcha_api'
14
14
  spec.license = 'MIT'
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rucaptcha_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jevgenija Karunus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-05 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,17 +90,18 @@ files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
92
  - ".travis.yml"
93
- - CODE_OF_CONDUCT.md
94
93
  - Gemfile
95
94
  - LICENSE.txt
96
95
  - README.md
97
96
  - Rakefile
98
97
  - bin/console
99
98
  - bin/setup
99
+ - example.rb
100
100
  - lib/rucaptcha_api.rb
101
101
  - lib/rucaptcha_api/errors.rb
102
102
  - lib/rucaptcha_api/stats.rb
103
103
  - lib/rucaptcha_api/version.rb
104
+ - pkg/rucaptcha_api-1.0.0.gem
104
105
  - rucaptcha_api.gemspec
105
106
  homepage: https://github.com/lakesare/rucaptcha_api
106
107
  licenses:
@@ -125,5 +126,7 @@ rubyforge_project:
125
126
  rubygems_version: 2.4.6
126
127
  signing_key:
127
128
  specification_version: 4
128
- summary: Ruby mapper for https://rucaptcha.com API
129
+ summary: This gem facilitates interaction with https://rucaptcha.com/api-rucaptcha
130
+ API.
129
131
  test_files: []
132
+ has_rdoc:
data/CODE_OF_CONDUCT.md DELETED
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)