form_api 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/examples/{generate_pdf_no_wait.rb → generate_pdf_async.rb} +0 -0
- data/examples/merge_generated_pdfs.rb +31 -0
- data/extensions/lib/form_api/api/client.rb +47 -3
- data/lib/form_api.rb +5 -1
- data/lib/form_api/api/pdf_api.rb +168 -11
- data/lib/form_api/models/data.rb +24 -13
- data/lib/form_api/models/data_1.rb +211 -0
- data/lib/form_api/models/inline_response_201.rb +7 -7
- data/lib/form_api/models/inline_response_201_1.rb +235 -0
- data/lib/form_api/models/{inline_response_201_submission.rb → inline_response_201_1_submission.rb} +1 -6
- data/lib/form_api/models/inline_response_201_combined_submission.rb +297 -0
- data/lib/form_api/models/inline_response_401.rb +193 -0
- data/lib/form_api/version.rb +1 -1
- data/spec/models/data_1_spec.rb +54 -0
- data/spec/models/inline_response_201_1_spec.rb +52 -0
- data/spec/models/inline_response_201_1_submission_spec.rb +82 -0
- data/spec/models/inline_response_201_combined_submission_spec.rb +82 -0
- data/swagger-config.json +1 -1
- metadata +17 -5
- data/examples/generate_pdf.rb +0 -47
data/lib/form_api/version.rb
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
=begin
|
2
|
+
#API V1
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for FormAPI::Data1
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'Data1' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = FormAPI::Data1.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of Data1' do
|
31
|
+
it 'should create an instance of Data1' do
|
32
|
+
expect(@instance).to be_instance_of(FormAPI::Data1)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "test"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "data"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "metadata"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
=begin
|
2
|
+
#API V1
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for FormAPI::InlineResponse2011
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'InlineResponse2011' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = FormAPI::InlineResponse2011.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of InlineResponse2011' do
|
31
|
+
it 'should create an instance of InlineResponse2011' do
|
32
|
+
expect(@instance).to be_instance_of(FormAPI::InlineResponse2011)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "status"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["success", "error"])
|
39
|
+
#validator.allowable_values.each do |value|
|
40
|
+
# expect { @instance.status = value }.not_to raise_error
|
41
|
+
#end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'test attribute "submission"' do
|
46
|
+
it 'should work' do
|
47
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
=begin
|
2
|
+
#API V1
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for FormAPI::InlineResponse2011Submission
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'InlineResponse2011Submission' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = FormAPI::InlineResponse2011Submission.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of InlineResponse2011Submission' do
|
31
|
+
it 'should create an instance of InlineResponse2011Submission' do
|
32
|
+
expect(@instance).to be_instance_of(FormAPI::InlineResponse2011Submission)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "id"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "test"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "expired"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'test attribute "expires_at"' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'test attribute "state"' do
|
60
|
+
it 'should work' do
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
62
|
+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["pending", "processed", "invalid_data", "error", "image_download_failed", "image_processing_failed"])
|
63
|
+
#validator.allowable_values.each do |value|
|
64
|
+
# expect { @instance.state = value }.not_to raise_error
|
65
|
+
#end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe 'test attribute "metadata"' do
|
70
|
+
it 'should work' do
|
71
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'test attribute "download_url"' do
|
76
|
+
it 'should work' do
|
77
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
=begin
|
2
|
+
#API V1
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for FormAPI::InlineResponse201CombinedSubmission
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'InlineResponse201CombinedSubmission' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = FormAPI::InlineResponse201CombinedSubmission.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of InlineResponse201CombinedSubmission' do
|
31
|
+
it 'should create an instance of InlineResponse201CombinedSubmission' do
|
32
|
+
expect(@instance).to be_instance_of(FormAPI::InlineResponse201CombinedSubmission)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "id"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "expired"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "expires_at"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'test attribute "state"' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["pending", "processed", "error"])
|
57
|
+
#validator.allowable_values.each do |value|
|
58
|
+
# expect { @instance.state = value }.not_to raise_error
|
59
|
+
#end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'test attribute "metadata"' do
|
64
|
+
it 'should work' do
|
65
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe 'test attribute "submission_ids"' do
|
70
|
+
it 'should work' do
|
71
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'test attribute "download_url"' do
|
76
|
+
it 'should work' do
|
77
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
data/swagger-config.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: form_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Form Applications Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -248,8 +248,8 @@ files:
|
|
248
248
|
- README.md
|
249
249
|
- Rakefile
|
250
250
|
- examples/generate_and_download_pdf.rb
|
251
|
-
- examples/
|
252
|
-
- examples/
|
251
|
+
- examples/generate_pdf_async.rb
|
252
|
+
- examples/merge_generated_pdfs.rb
|
253
253
|
- extensions/lib/form_api/api/client.rb
|
254
254
|
- form_api.gemspec
|
255
255
|
- lib/form_api.rb
|
@@ -258,9 +258,13 @@ files:
|
|
258
258
|
- lib/form_api/api_error.rb
|
259
259
|
- lib/form_api/configuration.rb
|
260
260
|
- lib/form_api/models/data.rb
|
261
|
+
- lib/form_api/models/data_1.rb
|
261
262
|
- lib/form_api/models/inline_response_201.rb
|
262
|
-
- lib/form_api/models/
|
263
|
+
- lib/form_api/models/inline_response_201_1.rb
|
264
|
+
- lib/form_api/models/inline_response_201_1_submission.rb
|
265
|
+
- lib/form_api/models/inline_response_201_combined_submission.rb
|
263
266
|
- lib/form_api/models/inline_response_400.rb
|
267
|
+
- lib/form_api/models/inline_response_401.rb
|
264
268
|
- lib/form_api/models/inline_response_422.rb
|
265
269
|
- lib/form_api/version.rb
|
266
270
|
- scripts/clean
|
@@ -273,7 +277,11 @@ files:
|
|
273
277
|
- spec/api/pdf_api_spec.rb
|
274
278
|
- spec/api_client_spec.rb
|
275
279
|
- spec/configuration_spec.rb
|
280
|
+
- spec/models/data_1_spec.rb
|
276
281
|
- spec/models/data_spec.rb
|
282
|
+
- spec/models/inline_response_201_1_spec.rb
|
283
|
+
- spec/models/inline_response_201_1_submission_spec.rb
|
284
|
+
- spec/models/inline_response_201_combined_submission_spec.rb
|
277
285
|
- spec/models/inline_response_201_spec.rb
|
278
286
|
- spec/models/inline_response_201_submission_spec.rb
|
279
287
|
- spec/models/inline_response_302_spec.rb
|
@@ -310,7 +318,11 @@ test_files:
|
|
310
318
|
- spec/api/pdf_api_spec.rb
|
311
319
|
- spec/api_client_spec.rb
|
312
320
|
- spec/configuration_spec.rb
|
321
|
+
- spec/models/data_1_spec.rb
|
313
322
|
- spec/models/data_spec.rb
|
323
|
+
- spec/models/inline_response_201_1_spec.rb
|
324
|
+
- spec/models/inline_response_201_1_submission_spec.rb
|
325
|
+
- spec/models/inline_response_201_combined_submission_spec.rb
|
314
326
|
- spec/models/inline_response_201_spec.rb
|
315
327
|
- spec/models/inline_response_201_submission_spec.rb
|
316
328
|
- spec/models/inline_response_302_spec.rb
|
data/examples/generate_pdf.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This example demonstrates generating a PDF from a preconfigured template,
|
4
|
-
# and waiting for the PDF to be processed.
|
5
|
-
#
|
6
|
-
# You can run this example with: ./examples/generate_pdf.rb
|
7
|
-
|
8
|
-
require "bundler/setup"
|
9
|
-
Bundler.require
|
10
|
-
|
11
|
-
# This is a real test API token and template on formapi.io
|
12
|
-
# -------------------------------------------------------------
|
13
|
-
API_TOKEN_ID = 'yRaaR9JmTPtGX7EN'
|
14
|
-
API_TOKEN_SECRET = 'IB3TRkSdm4f2BdtU_D3YgxjdMB7l-r2fOgvxD1Yzwec'
|
15
|
-
TEMPLATE_ID = '6zz3dYRYM67fxMXA'
|
16
|
-
|
17
|
-
|
18
|
-
begin
|
19
|
-
FormAPI.configure do |c|
|
20
|
-
c.username = API_TOKEN_ID # Your API Token ID
|
21
|
-
c.password = API_TOKEN_SECRET # Your API Token Secret
|
22
|
-
# c.debugging = true
|
23
|
-
end
|
24
|
-
|
25
|
-
formapi = FormAPI::Client.new
|
26
|
-
|
27
|
-
puts "Generating PDF and waiting until ready..."
|
28
|
-
|
29
|
-
response = formapi.generate_pdf(
|
30
|
-
template_id: TEMPLATE_ID,
|
31
|
-
test: true,
|
32
|
-
data: {
|
33
|
-
first_name: 'John',
|
34
|
-
last_name: 'Smith',
|
35
|
-
favorite_color: 'Blue'
|
36
|
-
}
|
37
|
-
)
|
38
|
-
|
39
|
-
puts "PDF was generated:"
|
40
|
-
puts response
|
41
|
-
|
42
|
-
rescue FormAPI::ApiError => ex
|
43
|
-
puts "#{ex.class}: #{ex.message}"
|
44
|
-
puts ex.code # HTTP response code
|
45
|
-
puts ex.response_body # HTTP response body
|
46
|
-
puts ex.backtrace[0..3].join("\n")
|
47
|
-
end
|