answersengine 0.3.1 → 0.3.2

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: f825e7af5d28a8772973f8be6765afcfa9a6d56ad8fc39bfac357ce1f88d7bcb
4
- data.tar.gz: 0a781992fb9d1a217a096cc65dd094c7402feb66e598109e611e9a08c1a6177c
3
+ metadata.gz: cd92cb339a082af029dd043ed54694cbe5102796a84249373ef4c52bf73cf892
4
+ data.tar.gz: 802e3e8409aaeded23f07c8fda60541d2f4b1875f8fda027fcd442de4ff76163
5
5
  SHA512:
6
- metadata.gz: 5220e6d708f155cc3d501c172b855778baab0927565919adc403795386adcd325baec68629ff9751398bea3ca01f6e322f23fca028abacb7a04f82df74067e58
7
- data.tar.gz: 8db3dc9fdfbc991294226a55ec3edcae425e55b1390c05eb30bae8fbafebb0bfc7320b9e2ceb0b84538ea354bd07b21772d046688efc8f3aaf5b160c134d29d0
6
+ metadata.gz: 49fd58cc1a1d882bc6e6e28e483c45e542728f79eb32769835344054064da45e5cc21a0a7214b56d9074e81da2d76b3882063f83ac647f91715ab9bf222d87b5
7
+ data.tar.gz: accdc7e52bee76e2dba9f1f5591e89d773f37734651a1dd6e3ee3929a43dd9854f2be4b3157e28d2cbcb3fce6cac47d5751c4b74a439295ddcb9e75de138d1c3
@@ -63,6 +63,13 @@ module AnswersEngine
63
63
  puts "#{client.find(scraper_name)}"
64
64
  end
65
65
 
66
+ desc "delete <scraper_name>", "Delete a scraper and related records"
67
+ def delete(scraper_name)
68
+ client = Client::Scraper.new(options)
69
+ puts "#{client.delete(scraper_name)}"
70
+ end
71
+
72
+
66
73
  desc "deploy <scraper_name>", "Deploy a scraper"
67
74
  long_desc <<-LONGDESC
68
75
  Deploys a scraper
@@ -11,15 +11,14 @@ module AnswersEngine
11
11
  end
12
12
 
13
13
  def create(scraper_name, git_repository, opts={})
14
- body = {
15
- name: scraper_name,
16
- git_repository: git_repository,
17
- git_branch: opts[:branch] ? opts[:branch] : "master"}
18
-
14
+ body = {}
15
+ body[:name] = scraper_name
16
+ body[:git_repository] = git_repository,
17
+ body[:git_branch] = opts[:branch] || opts[:git_branch] || "master" if opts[:branch] || opts[:git_branch]
19
18
  body[:freshness_type] = opts[:freshness_type] if opts[:freshness_type]
20
19
  body[:force_fetch] = opts[:force_fetch] if opts[:force_fetch]
21
- body[:standard_worker_count] = opts[:workers] if opts[:workers]
22
- body[:browser_worker_count] = opts[:browsers] if opts[:browsers]
20
+ body[:standard_worker_count] = opts[:workers] || opts[:standard_worker_count] if opts[:workers] || opts[:standard_worker_count]
21
+ body[:browser_worker_count] = opts[:browsers] || opts[:browser_worker_count] if opts[:browsers] || opts[:browser_worker_count]
23
22
  body[:proxy_type] = opts[:proxy_type] if opts[:proxy_type]
24
23
  body[:disable_scheduler] = opts[:disable_scheduler] if opts[:disable_scheduler]
25
24
  body[:cancel_current_job] = opts[:cancel_current_job] if opts[:cancel_current_job]
@@ -31,23 +30,26 @@ module AnswersEngine
31
30
 
32
31
  def update(scraper_name, opts={})
33
32
  body = {}
34
-
35
33
  body[:name] = opts[:name] if opts[:name]
36
- body[:git_repository] = opts[:repo] if opts[:repo]
37
- body[:git_branch] = opts[:branch] if opts[:branch]
34
+ body[:git_repository] = opts[:repo] || opts[:git_repository] if opts[:repo] || opts[:git_repository]
35
+ body[:git_branch] = opts[:branch] || opts[:git_branch] if opts[:branch] || opts[:git_branch]
38
36
  body[:freshness_type] = opts[:freshness_type] if opts[:freshness_type]
39
- body[:force_fetch] = opts[:force_fetch] if opts.has_key?("force_fetch")
40
- body[:standard_worker_count] = opts[:workers] if opts[:workers]
41
- body[:browser_worker_count] = opts[:browsers] if opts[:browsers]
37
+ body[:force_fetch] = opts[:force_fetch] if opts.has_key?("force_fetch") || opts.has_key?(:force_fetch)
38
+ body[:standard_worker_count] = opts[:workers] || opts[:standard_worker_count] if opts[:workers] || opts[:standard_worker_count]
39
+ body[:browser_worker_count] = opts[:browsers] || opts[:browser_worker_count] if opts[:browsers] || opts[:browser_worker_count]
42
40
  body[:proxy_type] = opts[:proxy_type] if opts[:proxy_type]
43
- body[:disable_scheduler] = opts[:disable_scheduler] if opts.has_key?("disable_scheduler")
44
- body[:cancel_current_job] = opts[:cancel_current_job] if opts.has_key?("cancel_current_job")
41
+ body[:disable_scheduler] = opts[:disable_scheduler] if opts.has_key?("disable_scheduler") || opts.has_key?(:disable_scheduler)
42
+ body[:cancel_current_job] = opts[:cancel_current_job] if opts.has_key?("cancel_current_job") || opts.has_key?(:cancel_current_job)
45
43
  body[:schedule] = opts[:schedule] if opts[:schedule]
46
44
  body[:timezone] = opts[:timezone] if opts[:timezone]
47
45
  @options.merge!({body: body.to_json})
48
46
 
49
47
  self.class.put("/scrapers/#{scraper_name}", @options)
50
48
  end
49
+
50
+ def delete(scraper_name, opts={})
51
+ self.class.delete("/scrapers/#{scraper_name}", @options)
52
+ end
51
53
  end
52
54
  end
53
55
  end
@@ -1,3 +1,3 @@
1
1
  module AnswersEngine
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: answersengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
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-03-21 00:00:00.000000000 Z
11
+ date: 2019-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor