iaa 0.2.3 → 0.2.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 +4 -4
- data/lib/iaa/version.rb +1 -1
- data/lib/server.rb +27 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ee387c16e11e0106a97c07ce26549f690dcf211
|
4
|
+
data.tar.gz: 82b7a9b3bf661c7bca6e77633109fa5b044ae85e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a1efe7516e3a7005512b10116a32fc1fa9e03090ac75a163a87465367d69b9254628f93657b63b916757c1844ec4606f6c1ff9ceb887cb4801cce3723869e2e
|
7
|
+
data.tar.gz: d358f12fa426de5e557f59d94eb3e40d40d30ed48862f30842393f23e9cedae2a85cfc1675ec792040caa1707ac5eda2c66a30d33bcbcf6c6779aa61ab9d0f63
|
data/lib/iaa/version.rb
CHANGED
data/lib/server.rb
CHANGED
@@ -10,30 +10,39 @@ module IAA
|
|
10
10
|
end
|
11
11
|
|
12
12
|
post '/7600a' do
|
13
|
-
|
14
|
-
|
13
|
+
begin
|
14
|
+
# Get the params
|
15
|
+
json_params = JSON.parse(request.body.read)
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
# Create and fill the form
|
18
|
+
form = IAA::Form7600A.new
|
19
|
+
json_params.each_pair do |key, value|
|
20
|
+
form.send("#{key}=", value)
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
# Save the form
|
24
|
+
file = form.save
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
# Get the bytes
|
27
|
+
bytes = File.read(file)
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
# Delete the file
|
30
|
+
File.delete(file)
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
# Put the bytes in a tempfile
|
33
|
+
tmpfile = Tempfile.new('response.pdf')
|
34
|
+
tmpfile.write(bytes)
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
# Let the user download the file
|
37
|
+
send_file(tmpfile)
|
38
|
+
rescue => e
|
39
|
+
content_type :json
|
40
|
+
|
41
|
+
return {
|
42
|
+
error: e.to_s
|
43
|
+
}.to_json
|
44
|
+
end
|
37
45
|
end
|
46
|
+
|
38
47
|
end
|
39
48
|
end
|