caseblocks_bucket_extractor 0.0.5 → 0.0.6
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.
- data/lib/caseblocks_bucket_extractor.rb +11 -7
- metadata +2 -2
@@ -27,11 +27,13 @@ class CaseblocksBucketExtractor
|
|
27
27
|
response = self.class.get("/case_blocks/#{URI::encode(case_type_name)}/buckets/#{bucket_slug}/schedule_download_job")
|
28
28
|
job_url = get_job_url(response.body)
|
29
29
|
|
30
|
-
|
30
|
+
|
31
|
+
#raise response.headers["status"] unless response.headers["status"].start_with?("200")
|
31
32
|
|
32
33
|
result = start_polling(job_url)
|
33
34
|
|
34
|
-
|
35
|
+
|
36
|
+
if !result.nil? && result["job"]["status"] == "completed"
|
35
37
|
create_files(file_options,result)
|
36
38
|
else
|
37
39
|
raise "!!!!! Job - #{job_url} did not complete. !!!!!!"
|
@@ -57,7 +59,7 @@ class CaseblocksBucketExtractor
|
|
57
59
|
next
|
58
60
|
end
|
59
61
|
|
60
|
-
download_complete = result["job"]["status"] == "
|
62
|
+
download_complete = result["job"]["status"] == "completed"
|
61
63
|
end
|
62
64
|
|
63
65
|
result
|
@@ -68,8 +70,10 @@ class CaseblocksBucketExtractor
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def create_files(file_options,json)
|
73
|
+
files = json["job"]["job_log"].find{|f| f["files"] }
|
71
74
|
file_options.each do |file_option|
|
72
|
-
|
75
|
+
binding.pry
|
76
|
+
json_file = files["files"].find{|f| f["file"].include?(file_option[:name])}
|
73
77
|
download_file(file_option[:path], json_file["link"])
|
74
78
|
end
|
75
79
|
end
|
@@ -87,9 +91,9 @@ class CaseblocksBucketExtractor
|
|
87
91
|
job_url = JSON.parse(response_body)["job_url"]
|
88
92
|
rescue
|
89
93
|
puts "SCHEDULE_DOWNLOAD: cannot get job_url with body of #{response_body}"
|
90
|
-
return nil
|
94
|
+
return nil
|
91
95
|
end
|
92
|
-
|
96
|
+
|
93
97
|
job_url
|
94
98
|
end
|
95
|
-
end
|
99
|
+
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caseblocks_bucket_extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Charlie Quinn, Stewart McKee
|
8
|
+
- Charlie Quinn, Stewart McKee, Colin Gemmell
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|