iAuditor 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 9727b8629ce062fc6aac6e91e2d27da3b8e131d9
4
- data.tar.gz: 7fb7a4c6a352f5da80f7d54d7df76a186693f259
3
+ metadata.gz: 1a3c6d766508bd9ac27f7a7b5d367d912b0af289
4
+ data.tar.gz: f058622af02f513253e5b34297b7db30de25564a
5
5
  SHA512:
6
- metadata.gz: 758cf70070f32e1ef18738c51cc469c629cc3cdfda1ae8323b2ee21373ff739c3c404dabeabd23c57eeebdeab8d4c58cc56744bd4c8e08f81a636cb3c7287570
7
- data.tar.gz: 7ec412ed80c32fdfd341c01ec8e00efda943f17d9f81318e4960cca02bcd30fe4bcbf4fb8b17a3fea9767b28a8c844da0341e123bcbecb2dbb066c484189c8f8
6
+ metadata.gz: d7f01fbf3a00c5db1336e44ffe69894d2ee0d78b3b53e19f5aabd01155d94b5a90d483cc962bb747082ceac902a4fdbfbffe72e7b95f349d36dcdacb56c1aaa7
7
+ data.tar.gz: 5e66b831d4f17d0674d2ee0dec9b264b489a21cfad9210fc18962658ad21e5c1afc9d776125b04ff10705c578835e2c8a86bfba0c0aec5705fbf62425339b545
@@ -14,7 +14,6 @@ module IAuditor
14
14
  def fetch(audit)
15
15
  @audit = self.class.get("/audits/#{audit}", @options)
16
16
  @audit.parsed_response
17
-
18
17
  end
19
18
 
20
19
  # Retrieving audit link
@@ -27,20 +26,25 @@ module IAuditor
27
26
  @audits = self.class.get("/audits/#{audit}/web_report_link", @options)
28
27
  end
29
28
 
30
- # Need to be add based on checklist
31
- # def start_audit
32
- #
33
- # end
34
-
35
29
  # Retrieving audit media
36
30
  def audit_media(audit,media)
37
31
  @audits = self.class.get("/audits/#{audit}/media/#{media}", @options)
38
32
  end
39
33
 
34
+ def export(audit, options={})
35
+ @audit_id = audit
36
+ @options.merge!(query: options) if options.present?
37
+ @export = self.class.post("/audits/#{@audit_id}/export", @options).parsed_response
38
+ @status = export_polling_status
39
+ return @status if @status["status"] == "FAILED"
40
+
41
+ export_document
42
+ end
43
+
40
44
  # format. timezone, export_profile
41
45
  def start_audit_export(audit,options={})
42
46
  @options.merge!(query: options) if options.present?
43
- @audits = self.class.get("/audits/#{audit}/export", @options)
47
+ @audits = self.class.post("/audits/#{audit}/export", @options)
44
48
  end
45
49
 
46
50
  # format. timezone, export_profile
@@ -48,6 +52,17 @@ module IAuditor
48
52
  @audits = self.class.get("/audits/#{audit}/exports/#{export}/#{file}", @options)
49
53
  end
50
54
 
55
+ private
56
+
57
+ def export_polling_status
58
+ @status = self.class.get("/audits/#{@audit_id}/exports/#{@export["id"]}", @options).parsed_response
59
+ export_polling_status if @status["status"] == "IN PROGRESS"
60
+ @status
61
+ end
51
62
 
63
+ def export_document
64
+ file_name = URI.encode(@status["filename"])
65
+ self.class.get("/audits/#{@audit_id}/exports/#{@export["id"]}/#{file_name}", @options).parsed_response
66
+ end
52
67
  end
53
68
  end
@@ -26,10 +26,8 @@ module IAuditor
26
26
  "username": username,
27
27
  "password": password,
28
28
  "grant_type":"password"
29
-
30
29
  }
31
30
  ).parsed_response["access_token"]
32
-
33
31
  token
34
32
  end
35
33
 
@@ -6,8 +6,8 @@ class BaseModules
6
6
  def initialize(token)
7
7
  @options = token.is_a?(String) ? {
8
8
  headers: {
9
- "Content-Type": "application/json",
10
- "Authorization": "Bearer #{token}"
9
+ "Content-Type" => "application/json",
10
+ "Authorization"=> "Bearer #{token}"
11
11
  }
12
12
  }
13
13
  : token
@@ -1,3 +1,3 @@
1
1
  module IAuditor
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iAuditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Wetteroth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-06-06 00:00:00.000000000 Z
12
+ date: 2018-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler