a_parser_client 0.1.2 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22f8b6c17477106cec46e6bd45d03be6c369e36e77ebab5f030defe60d17d2c6
4
- data.tar.gz: 49285e64aa071ad88629c6f98d1fadc26999aecd59228ff4cd3d11bcebd9d60c
3
+ metadata.gz: 420bdf672bc9ceb584c65ce865513b87c34c5749f32900653c284bdf1d48f9cb
4
+ data.tar.gz: c4cb1b9a6c7be8c2af31a1e83429743a18e00a783e12341d25756300091ea8ff
5
5
  SHA512:
6
- metadata.gz: 9e8c2a60e972b22ecc1a654f9d8881564f20b2b4458495ac974e1e88262fecf109cc42f7259d23b79c47613ff2acbc3e8d28b0426e66a66eb0daf4f0ce3c86c1
7
- data.tar.gz: '0694ff64734fa5f06bb5ca2abbddbf1f5e71f2ca8ff664be1f755cf91c79bc4450f8ebdadc04f14021c5d7d1292b651883d2b6814d723bef5e4d01b777843050'
6
+ metadata.gz: 69fe3774906263c4b5d00fbbe2b7ba1f5e55c5e0c99a8a1d52ef3f20122628b51aebefc469d154c9ad475e079bc4120bc2462f14318717d91c0b5a8f339d48c2
7
+ data.tar.gz: '08fdcf0b798c9a430f280c556e07f93a021e54d670eaaaa9ba759c63a1245b46f7377b7a67b90d47fcd0f5108c91bc3ab2bc5fde53ff6695e5bb9c282b851ad4'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- a_parser_client (0.1.2)
4
+ a_parser_client (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # AParserClient
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/a_parser_client.svg)](https://badge.fury.io/rb/a_parser_client)
4
+
5
+ Ruby client for A-Parser user API.
6
+
7
+ This is a test release, more API coverage is upcoming.
8
+
9
+ Covered for now:
10
+
11
+ - ping
12
+ - info
13
+ - getTaskList
14
+ - getTaskState
15
+ - getTaskConf
16
+ - addTask
17
+ - changeTaskStatus
18
+ - getAccountsCount
19
+ - getProxies
20
+ - update
21
+ - getTaskResultsFile
22
+ - deleteTaskResultsFile
23
+ - moveTask
24
+ - getParserInfo
25
+ - getParserPreset
26
+ - oneRequest
27
+ - bulkRequest
28
+
29
+ TODO:
30
+
31
+ Some automation procedures:
32
+
33
+ - multitasks operations (like stop all tasks etc.)
34
+
35
+
3
36
  ## Installation
4
37
 
5
38
  Add this line to your application's Gemfile:
@@ -18,7 +51,18 @@ Or install it yourself as:
18
51
 
19
52
  ## Usage
20
53
 
21
- TODO: Write usage instructions here
54
+ There will be a wiki page soon.
55
+
56
+ The code sample below is all for now...
57
+
58
+ ```ruby
59
+ require 'a_parser_client'
60
+
61
+ api = AParserClient::API.new 'http://<your_host_running_aparser>:9091/API, ''
62
+ api.ping
63
+
64
+ => {"success" : 1, "data" : "pong"}
65
+ ```
22
66
 
23
67
  ## Development
24
68
 
@@ -36,4 +80,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
36
80
 
37
81
  ## Code of Conduct
38
82
 
39
- Everyone interacting in the AParserClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yvshevchenko /a_parser_client/blob/master/CODE_OF_CONDUCT.md).
83
+ Everyone interacting in the AParserClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yvshevchenko/a_parser_client/blob/master/CODE_OF_CONDUCT.md).
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Yaroslav Shevchenko"]
9
9
  spec.email = ["yvshevchenko@gmail.com"]
10
10
 
11
- spec.summary = %q{A simple inerface to a-parser API.}
12
- spec.description = %q{Gem allowing to use a-parser API simple way.}
11
+ spec.summary = %q{A simple inerface to A-Parser API.}
12
+ spec.description = %q{Gem allowing to use A-Parser API simple way.}
13
13
  spec.homepage = "https://github.com/yvshevchenko/a_parser_client"
14
14
  spec.license = "MIT"
15
15
 
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/yvshevchenko/a_parser_client"
20
- spec.metadata["changelog_uri"] = "https://github.com/yvshevchenko/a_parser_client"
20
+ spec.metadata["changelog_uri"] = "https://github.com/yvshevchenko/a_parser_client/wiki/Changes-Log"
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -20,7 +20,7 @@ module AParserClient
20
20
  end
21
21
  end
22
22
 
23
- def ping_a_parser
23
+ def ping
24
24
  request = {
25
25
  password: @api_pass,
26
26
  action: 'ping'
@@ -30,7 +30,7 @@ module AParserClient
30
30
 
31
31
  #updates alive status
32
32
  def alive?
33
- @alive = ping_a_parser ? true : false
33
+ @alive = ping ? true : false
34
34
  end
35
35
 
36
36
 
@@ -46,7 +46,7 @@ module AParserClient
46
46
  def get_task_state(task_id)
47
47
  request = {
48
48
  password: @api_password,
49
- action: 'getTasksState',
49
+ action: 'getTaskState',
50
50
  data: {taskUid: task_id}
51
51
  }
52
52
  do_it request
@@ -55,7 +55,7 @@ module AParserClient
55
55
  def get_task_conf(task_id)
56
56
  request = {
57
57
  password: @api_password,
58
- action: 'getTasksConf',
58
+ action: 'getTaskConf',
59
59
  data: {taskUid: task_id}
60
60
  }
61
61
  do_it request
@@ -86,6 +86,41 @@ module AParserClient
86
86
  do_it request
87
87
  end
88
88
 
89
+
90
+ def one_request(query, parser, preset='default', config_preset='default', options=[])
91
+ request = {
92
+ password: @api_password,
93
+ action: 'oneRequest',
94
+ data: {
95
+ query: query,
96
+ parser: parser,
97
+ configPreset: config_preset,
98
+ preset: preset,
99
+ options: options
100
+ }
101
+ }
102
+ do_it request
103
+ end
104
+
105
+ def bulk_request(queries=[], parser, preset='default', config_preset='default', threads, raw_results=0, need_data=0, options=[])
106
+ request = {
107
+ password: @api_password,
108
+ action: 'bulkRequest',
109
+ data: {
110
+ queries: queries,
111
+ parser: parser,
112
+ configPreset: config_preset,
113
+ preset: preset,
114
+ threads: threads,
115
+ rawResults: raw_results,
116
+ needData: need_data,
117
+ options: options
118
+ }
119
+ }
120
+ do_it request
121
+ end
122
+
123
+
89
124
  def change_task_status(task_id, to_status)
90
125
  request = {
91
126
  password: @api_password,
@@ -98,6 +133,87 @@ module AParserClient
98
133
  do_it request
99
134
  end
100
135
 
136
+ def get_accounts_count
137
+ request = {
138
+ password: @api_password,
139
+ action: 'getAccountsCount',
140
+ data: {}
141
+ }
142
+ do_it request
143
+ end
144
+
145
+
146
+ def get_proxies
147
+ request = {
148
+ password: @api_password,
149
+ action: 'getProxies'
150
+ }
151
+ do_it request
152
+ end
153
+
154
+ def update!
155
+ request = {
156
+ password: @api_password,
157
+ action: 'update',
158
+ data: {}
159
+ }
160
+ do_it request
161
+ end
162
+
163
+ def get_task_results_file(task_id)
164
+ request = {
165
+ password: @api_password,
166
+ action: 'getTaskResultsFile',
167
+ data: {taskUid: task_id}
168
+ }
169
+ do_it request
170
+ end
171
+
172
+ def delete_task_results_file(task_id)
173
+ request = {
174
+ password: @api_password,
175
+ action: 'deleteTaskResultsFile',
176
+ data: {taskUid: task_id}
177
+ }
178
+ do_it request
179
+ end
180
+
181
+ def move_task(task_id, direction)
182
+ request = {
183
+ password: @api_password,
184
+ action: 'moveTask',
185
+ data: {
186
+ taskUid: task_id,
187
+ toStatus: direction
188
+ }
189
+ }
190
+ do_it request
191
+ end
192
+
193
+ def get_parser_info(parser_name)
194
+ request = {
195
+ password: @api_password,
196
+ action: 'getParserInfo',
197
+ data: {
198
+ parser: parser_name
199
+ }
200
+ }
201
+ do_it request
202
+ end
203
+
204
+
205
+ def get_parser_preset(parser_name, preset_name)
206
+ request = {
207
+ password: @api_password,
208
+ action: 'getParserInfo',
209
+ data: {
210
+ parser: parser_name,
211
+ reset: preset_name
212
+ }
213
+ }
214
+ do_it request
215
+ end
216
+
101
217
 
102
218
  private # internal use only
103
219
 
@@ -1,3 +1,3 @@
1
1
  module AParserClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: a_parser_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shevchenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-24 00:00:00.000000000 Z
11
+ date: 2020-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- description: Gem allowing to use a-parser API simple way.
55
+ description: Gem allowing to use A-Parser API simple way.
56
56
  email:
57
57
  - yvshevchenko@gmail.com
58
58
  executables: []
@@ -80,7 +80,7 @@ metadata:
80
80
  allowed_push_host: https://rubygems.org
81
81
  homepage_uri: https://github.com/yvshevchenko/a_parser_client
82
82
  source_code_uri: https://github.com/yvshevchenko/a_parser_client
83
- changelog_uri: https://github.com/yvshevchenko/a_parser_client
83
+ changelog_uri: https://github.com/yvshevchenko/a_parser_client/wiki/Changes-Log
84
84
  post_install_message:
85
85
  rdoc_options: []
86
86
  require_paths:
@@ -100,5 +100,5 @@ rubyforge_project:
100
100
  rubygems_version: 2.7.7
101
101
  signing_key:
102
102
  specification_version: 4
103
- summary: A simple inerface to a-parser API.
103
+ summary: A simple inerface to A-Parser API.
104
104
  test_files: []