iaa 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/iaa/version.rb +1 -1
  3. data/lib/server.rb +27 -18
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d28bb67ec2b098a190369324f73676b623bef300
4
- data.tar.gz: f8c4ef7d446ab399d91c47ed27ad5f830532aa3e
3
+ metadata.gz: 0ee387c16e11e0106a97c07ce26549f690dcf211
4
+ data.tar.gz: 82b7a9b3bf661c7bca6e77633109fa5b044ae85e
5
5
  SHA512:
6
- metadata.gz: faf9536e30a36a83d9e6e0cad208832735c0dac140dbeb9ffe92f2f95f5c95c764bcf362f33c45d29f7669cbaf9c772fefe262cc744bbd0eb7faece6b5a0dc08
7
- data.tar.gz: e2088f3d4de80d0d76bec6795a88d9d0617f2f33f32ca0ae80840fe20f5b9b049a99a3f948871f06539e3bb3f2dcd52d2b7c5b5f3ffd9f65f46ed84341d9a131
6
+ metadata.gz: 4a1efe7516e3a7005512b10116a32fc1fa9e03090ac75a163a87465367d69b9254628f93657b63b916757c1844ec4606f6c1ff9ceb887cb4801cce3723869e2e
7
+ data.tar.gz: d358f12fa426de5e557f59d94eb3e40d40d30ed48862f30842393f23e9cedae2a85cfc1675ec792040caa1707ac5eda2c66a30d33bcbcf6c6779aa61ab9d0f63
data/lib/iaa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IAA
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/lib/server.rb CHANGED
@@ -10,30 +10,39 @@ module IAA
10
10
  end
11
11
 
12
12
  post '/7600a' do
13
- # Get the params
14
- json_params = JSON.parse(request.body.read)
13
+ begin
14
+ # Get the params
15
+ json_params = JSON.parse(request.body.read)
15
16
 
16
- # Create and fill the form
17
- form = IAA::Form7600A.new
18
- json_params.each_pair do |key, value|
19
- form.send("#{key}=", value)
20
- end
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
- # Save the form
23
- file = form.save
23
+ # Save the form
24
+ file = form.save
24
25
 
25
- # Get the bytes
26
- bytes = File.read(file)
26
+ # Get the bytes
27
+ bytes = File.read(file)
27
28
 
28
- # Delete the file
29
- File.delete(file)
29
+ # Delete the file
30
+ File.delete(file)
30
31
 
31
- # Put the bytes in a tempfile
32
- tmpfile = Tempfile.new('response.pdf')
33
- tmpfile.write(bytes)
32
+ # Put the bytes in a tempfile
33
+ tmpfile = Tempfile.new('response.pdf')
34
+ tmpfile.write(bytes)
34
35
 
35
- # Let the user download the file
36
- send_file(tmpfile)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iaa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan deLevie