datahen 0.10.4 → 0.11.0

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
  SHA256:
3
- metadata.gz: 1ed77715ebc1abeb2b1f3e6e7056e5acca934d7b067e52109c91b4885346b83f
4
- data.tar.gz: ec4179ea4b21e6e22bfb70d5acca4e115aee4461e60f8c31433a56aad9dbe1b5
3
+ metadata.gz: d6c3a633e605f0c40a8c404f4bb2bb3c2b10aef8e6d7dec88d5a183687c056f0
4
+ data.tar.gz: 3d5a46ee42a099cf53d2f24187fb8115d94732cfe656db352e4cf05d31c83bfa
5
5
  SHA512:
6
- metadata.gz: aa842e66b934d77aff81706574a48c49c106e0e1104406f77dd1d8713e317a4a75ec04d7204e5a07c47bb501b380dd79c5b0c76fe4a961e378f862c67e7e78fc
7
- data.tar.gz: 372b18780ff931e73d4d7ecdae69506759df1bf8caa69275955ffba1e7d12a4488614f58375488f6cfb3384b9a31d9e37b5767f963f00da445bc1db604c4dcb8
6
+ metadata.gz: 7bd9f1d9d8a5b8b18e1658318738d75ea570ff4d400c1213eda504d3b2d2effc40c751923097671bc20407f33be80dd5d013f0f354cde714f974267fcf5a79dd
7
+ data.tar.gz: 268295cdb7787776216fba2a18d0941162c05caaa6db346e3d39f4a51c03def0ac9209724b8d06b4d21629c007fc31d22cab7f40f8df745fac92513c46736118
@@ -150,7 +150,23 @@ module Datahen
150
150
  else
151
151
  puts "#{client.scraper_job_current_stats(scraper_name)}"
152
152
  end
153
+ end
153
154
 
155
+ desc "history <scraper_name>", "Get historic stats for a job"
156
+ long_desc <<-LONGDESC
157
+ Get historic stats for a scraper's current job\n
158
+ LONGDESC
159
+ option :job, :aliases => :j, type: :numeric, desc: 'Set a specific job ID'
160
+ option :"min-timestamp", type: :string, desc: 'Starting timestamp point in time to query historic stats (inclusive)'
161
+ option :"max-timestamp", type: :string, desc: 'Ending timestamp point in time to query historic stats (inclusive)'
162
+ option :"limit", type: :numeric, desc: 'Limit stats retrieved.'
163
+ def history(scraper_name)
164
+ client = Client::JobStat.new(options)
165
+ if options[:job]
166
+ puts "#{client.job_stats_history(options[:job])}"
167
+ else
168
+ puts "#{client.scraper_job_stats_history(scraper_name)}"
169
+ end
154
170
  end
155
171
 
156
172
 
@@ -51,6 +51,9 @@ module Datahen
51
51
  query[:status] = opts[:status] if opts[:status]
52
52
  query[:page_type] = opts[:page_type] if opts[:page_type]
53
53
  query[:gid] = opts[:gid] if opts[:gid]
54
+ query[:"min-timestamp"] = opts[:"min-timestamp"]
55
+ query[:"max-timestamp"] = opts[:"max-timestamp"]
56
+ query[:limit] = opts[:limit]
54
57
 
55
58
  if opts[:query]
56
59
  if opts[:query].is_a?(Hash)
@@ -10,7 +10,14 @@ module Datahen
10
10
  self.class.get("/scrapers/#{scraper_name}/current_job/stats/current", @options)
11
11
  end
12
12
 
13
+ def job_stats_history(job_id)
14
+ self.class.get("/jobs/#{job_id}/stats/history", @options)
15
+ end
16
+
17
+ def scraper_job_stats_history(scraper_name)
18
+ self.class.get("/scrapers/#{scraper_name}/current_job/stats/history", @options)
19
+ end
20
+
13
21
  end
14
22
  end
15
23
  end
16
-
@@ -1,3 +1,3 @@
1
1
  module Datahen
2
- VERSION = "0.10.4"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datahen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parama Danoesubroto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-04 00:00:00.000000000 Z
11
+ date: 2020-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -262,8 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  - !ruby/object:Gem::Version
263
263
  version: '0'
264
264
  requirements: []
265
- rubyforge_project:
266
- rubygems_version: 2.7.6
265
+ rubygems_version: 3.0.3
267
266
  signing_key:
268
267
  specification_version: 4
269
268
  summary: DataHen toolbelt for developers