iaa 0.2.4 → 0.2.5

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/iaa/version.rb +1 -1
  3. data/lib/server.rb +33 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ee387c16e11e0106a97c07ce26549f690dcf211
4
- data.tar.gz: 82b7a9b3bf661c7bca6e77633109fa5b044ae85e
3
+ metadata.gz: 19c1edc89407165878d764e76d46f123a478fd1f
4
+ data.tar.gz: 9e1242292e6d134a8bc8010ca0524cc635caba03
5
5
  SHA512:
6
- metadata.gz: 4a1efe7516e3a7005512b10116a32fc1fa9e03090ac75a163a87465367d69b9254628f93657b63b916757c1844ec4606f6c1ff9ceb887cb4801cce3723869e2e
7
- data.tar.gz: d358f12fa426de5e557f59d94eb3e40d40d30ed48862f30842393f23e9cedae2a85cfc1675ec792040caa1707ac5eda2c66a30d33bcbcf6c6779aa61ab9d0f63
6
+ metadata.gz: 693bb24dca9f48ffb64d4cf5a154818cb06831ef5ee68ad67423e58f0f2fec14acfb97fdeb3b0200e3295cc64c937bb6ee2d3c364e6a5554305005bbd476da5d
7
+ data.tar.gz: 39fa6cd6bc32978ac5416ec7ca0c825674f9a2413f9c26bdf161b55807dc306de535a1979063e62cd89de7be4afc026a4a13df59573cb77a3088f92fe568e280
data/lib/iaa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IAA
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/server.rb CHANGED
@@ -4,11 +4,44 @@ require 'tempfile'
4
4
 
5
5
  module IAA
6
6
  class Server < Sinatra::Base
7
+
7
8
  # keep Meteor happy by responding to OPTIONS request
8
9
  options '/7600a' do
9
10
  halt 200
10
11
  end
11
12
 
13
+ get '/7600a' do
14
+ begin
15
+ # Create and fill the form
16
+ form = IAA::Form7600A.new
17
+ params.each_pair do |key, value|
18
+ form.send("#{key}=", value)
19
+ end
20
+
21
+ # Save the form
22
+ file = form.save
23
+
24
+ # Get the bytes
25
+ bytes = File.read(file)
26
+
27
+ # Delete the file
28
+ File.delete(file)
29
+
30
+ # Put the bytes in a tempfile
31
+ tmpfile = Tempfile.new('response.pdf')
32
+ tmpfile.write(bytes)
33
+
34
+ # Let the user download the file
35
+ send_file(tmpfile)
36
+ rescue => e
37
+ content_type :json
38
+
39
+ return {
40
+ error: e.to_s
41
+ }.to_json
42
+ end
43
+ end
44
+
12
45
  post '/7600a' do
13
46
  begin
14
47
  # Get the params
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.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan deLevie
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-08-11 00:00:00.000000000 Z
12
+ date: 2015-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pdf-forms