form_api 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +15 -13
  3. data/.swagger-codegen-ignore +0 -8
  4. data/Gemfile +1 -0
  5. data/Gemfile.lock +80 -0
  6. data/README.md +86 -70
  7. data/Rakefile +0 -3
  8. data/docs/CreateCombinedSubmissionBody.md +11 -0
  9. data/docs/CreateSubmissionBatchBody.md +10 -0
  10. data/docs/CreateSubmissionBody.md +10 -0
  11. data/docs/InlineResponse200.md +8 -0
  12. data/docs/InlineResponse2001.md +21 -0
  13. data/docs/InlineResponse201.md +9 -0
  14. data/docs/InlineResponse2011.md +9 -0
  15. data/docs/InlineResponse201CombinedSubmission.md +14 -0
  16. data/docs/InlineResponse400.md +9 -0
  17. data/docs/InlineResponse401.md +8 -0
  18. data/docs/InlineResponse422.md +9 -0
  19. data/docs/PDFApi.md +482 -0
  20. data/docs/TemplatestemplateIdsubmissionsbatchSubmission.md +14 -0
  21. data/form_api.gemspec +3 -10
  22. data/git_push.sh +55 -0
  23. data/{extensions/lib → lib}/form_api/api/client.rb +2 -2
  24. data/lib/form_api/api/pdf_api.rb +129 -19
  25. data/lib/form_api/configuration.rb +1 -1
  26. data/lib/form_api/models/{data.rb → create_combined_submission_body.rb} +1 -1
  27. data/lib/form_api/models/create_submission_batch_body.rb +211 -0
  28. data/lib/form_api/models/{data_1.rb → create_submission_body.rb} +1 -1
  29. data/lib/form_api/models/inline_response_200_1.rb +400 -0
  30. data/lib/form_api/models/inline_response_201_1.rb +1 -1
  31. data/lib/form_api/models/{inline_response_201_1_submission.rb → templatestemplate_idsubmissionsbatch_submission.rb} +1 -1
  32. data/lib/form_api/version.rb +1 -1
  33. data/lib/form_api.rb +6 -4
  34. data/spec/api/pdf_api_spec.rb +41 -15
  35. data/spec/api_client_spec.rb +1 -1
  36. data/spec/models/{data_spec.rb → create_combined_submission_body_spec.rb} +6 -6
  37. data/spec/models/create_submission_batch_body_spec.rb +54 -0
  38. data/spec/models/{data_1_spec.rb → create_submission_body_spec.rb} +6 -6
  39. data/spec/models/inline_response_200_1_spec.rb +124 -0
  40. data/spec/models/{inline_response_201_1_submission_spec.rb → templatestemplate_idsubmissionsbatch_submission_spec.rb} +6 -6
  41. data/spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml +2 -2
  42. metadata +45 -47
  43. data/.swagger-revision +0 -1
  44. data/.travis.yml +0 -8
  45. data/CHANGELOG.md +0 -2
  46. data/LICENSE +0 -7
  47. data/examples/generate_and_download_pdf.rb +0 -60
  48. data/examples/generate_pdf_async.rb +0 -57
  49. data/examples/merge_generated_pdfs.rb +0 -31
  50. data/scripts/clean +0 -5
  51. data/scripts/fix_gemspec.rb +0 -31
  52. data/scripts/generate +0 -22
  53. data/scripts/post_generate +0 -22
  54. data/scripts/release +0 -6
  55. data/scripts/swagger +0 -35
  56. data/scripts/test +0 -24
  57. data/swagger-config.json +0 -13
@@ -0,0 +1,124 @@
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::InlineResponse2001
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'InlineResponse2001' do
21
+ before do
22
+ # run before each test
23
+ @instance = FormAPI::InlineResponse2001.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of InlineResponse2001' do
31
+ it 'should create an instance of InlineResponse2001' do
32
+ expect(@instance).to be_instance_of(FormAPI::InlineResponse2001)
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 "name"' 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 "template_type"' 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 "public_web_form"' 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 "public_submissions"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "expire_submissions"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "expire_after"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ describe 'test attribute "expiration_interval"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ #validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["minutes", "hours", "days"])
81
+ #validator.allowable_values.each do |value|
82
+ # expect { @instance.expiration_interval = value }.not_to raise_error
83
+ #end
84
+ end
85
+ end
86
+
87
+ describe 'test attribute "allow_additional_properties"' do
88
+ it 'should work' do
89
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
90
+ end
91
+ end
92
+
93
+ describe 'test attribute "page_dimensions"' do
94
+ it 'should work' do
95
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
96
+ end
97
+ end
98
+
99
+ describe 'test attribute "webhook_url"' do
100
+ it 'should work' do
101
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
102
+ end
103
+ end
104
+
105
+ describe 'test attribute "slack_webhook_url"' do
106
+ it 'should work' do
107
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
108
+ end
109
+ end
110
+
111
+ describe 'test attribute "redirect_url"' do
112
+ it 'should work' do
113
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
114
+ end
115
+ end
116
+
117
+ describe 'test attribute "blockchain_timestamp_verification"' do
118
+ it 'should work' do
119
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
120
+ end
121
+ end
122
+
123
+ end
124
+
@@ -14,22 +14,22 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for FormAPI::InlineResponse2011Submission
17
+ # Unit tests for FormAPI::TemplatestemplateIdsubmissionsbatchSubmission
18
18
  # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
19
  # Please update as you see appropriate
20
- describe 'InlineResponse2011Submission' do
20
+ describe 'TemplatestemplateIdsubmissionsbatchSubmission' do
21
21
  before do
22
22
  # run before each test
23
- @instance = FormAPI::InlineResponse2011Submission.new
23
+ @instance = FormAPI::TemplatestemplateIdsubmissionsbatchSubmission.new
24
24
  end
25
25
 
26
26
  after do
27
27
  # run after each test
28
28
  end
29
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)
30
+ describe 'test an instance of TemplatestemplateIdsubmissionsbatchSubmission' do
31
+ it 'should create an instance of TemplatestemplateIdsubmissionsbatchSubmission' do
32
+ expect(@instance).to be_instance_of(FormAPI::TemplatestemplateIdsubmissionsbatchSubmission)
33
33
  end
34
34
  end
35
35
  describe 'test attribute "id"' do
@@ -60,7 +60,7 @@ http_interactions:
60
60
  body:
61
61
  encoding: UTF-8
62
62
  string: '{"status":"success","submission":{"state":"pending","test":true,"expired":false,"expires_at":null,"metadata":{},"id":"eyR4KFkaYKHztMdR","download_url":null}}'
63
- http_version:
63
+ http_version:
64
64
  recorded_at: Mon, 23 Oct 2017 08:53:51 GMT
65
65
  - request:
66
66
  method: get
@@ -122,6 +122,6 @@ http_interactions:
122
122
  body:
123
123
  encoding: UTF-8
124
124
  string: '{"state":"processed","test":true,"expired":false,"expires_at":"2017-10-30T08:53:50.350Z","metadata":{},"id":"eyR4KFkaYKHztMdR","download_url":"https://formapi-docs.s3.amazonaws.com/store/submissions/eyR4KFkaYKHztMdR/20171023085350-eyR4KFka.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJMQF3V7PUSLOCZYA%2F20171023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171023T085351Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=e3798e78fdcc1a0293d1b200dd7836eebae74e0c048a1e58e00d64aaf4c9f184"}'
125
- http_version:
125
+ http_version:
126
126
  recorded_at: Mon, 23 Oct 2017 08:53:52 GMT
127
127
  recorded_with: VCR 3.0.3
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.5
4
+ version: 0.2.0
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-11-02 00:00:00.000000000 Z
11
+ date: 2018-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -110,20 +110,6 @@ dependencies:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: 1.24.3
113
- - !ruby/object:Gem::Dependency
114
- name: addressable
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - "~>"
118
- - !ruby/object:Gem::Version
119
- version: 2.4.0
120
- type: :development
121
- prerelease: false
122
- version_requirements: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - "~>"
125
- - !ruby/object:Gem::Version
126
- version: 2.4.0
127
113
  - !ruby/object:Gem::Dependency
128
114
  name: autotest
129
115
  requirement: !ruby/object:Gem::Requirement
@@ -225,20 +211,26 @@ dependencies:
225
211
  - !ruby/object:Gem::Version
226
212
  version: 11.2.2
227
213
  - !ruby/object:Gem::Dependency
228
- name: pry-byebug
214
+ name: pry
229
215
  requirement: !ruby/object:Gem::Requirement
230
216
  requirements:
217
+ - - "~>"
218
+ - !ruby/object:Gem::Version
219
+ version: '0.10'
231
220
  - - ">="
232
221
  - !ruby/object:Gem::Version
233
- version: '0'
222
+ version: 0.10.4
234
223
  type: :development
235
224
  prerelease: false
236
225
  version_requirements: !ruby/object:Gem::Requirement
237
226
  requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '0.10'
238
230
  - - ">="
239
231
  - !ruby/object:Gem::Version
240
- version: '0'
241
- description: A client library for the FormAPI PDF generation service
232
+ version: 0.10.4
233
+ description: Client library for the FormAPI PDF generation service
242
234
  email:
243
235
  - support@formapi.io
244
236
  executables: []
@@ -249,58 +241,62 @@ files:
249
241
  - ".rspec"
250
242
  - ".swagger-codegen-ignore"
251
243
  - ".swagger-codegen/VERSION"
252
- - ".swagger-revision"
253
- - ".travis.yml"
254
- - CHANGELOG.md
255
244
  - Gemfile
256
- - LICENSE
245
+ - Gemfile.lock
257
246
  - README.md
258
247
  - Rakefile
259
- - examples/generate_and_download_pdf.rb
260
- - examples/generate_pdf_async.rb
261
- - examples/merge_generated_pdfs.rb
262
- - extensions/lib/form_api/api/client.rb
248
+ - docs/CreateCombinedSubmissionBody.md
249
+ - docs/CreateSubmissionBatchBody.md
250
+ - docs/CreateSubmissionBody.md
251
+ - docs/InlineResponse200.md
252
+ - docs/InlineResponse2001.md
253
+ - docs/InlineResponse201.md
254
+ - docs/InlineResponse2011.md
255
+ - docs/InlineResponse201CombinedSubmission.md
256
+ - docs/InlineResponse400.md
257
+ - docs/InlineResponse401.md
258
+ - docs/InlineResponse422.md
259
+ - docs/PDFApi.md
260
+ - docs/TemplatestemplateIdsubmissionsbatchSubmission.md
263
261
  - form_api.gemspec
262
+ - git_push.sh
264
263
  - lib/form_api.rb
264
+ - lib/form_api/api/client.rb
265
265
  - lib/form_api/api/pdf_api.rb
266
266
  - lib/form_api/api_client.rb
267
267
  - lib/form_api/api_error.rb
268
268
  - lib/form_api/configuration.rb
269
- - lib/form_api/models/data.rb
270
- - lib/form_api/models/data_1.rb
269
+ - lib/form_api/models/create_combined_submission_body.rb
270
+ - lib/form_api/models/create_submission_batch_body.rb
271
+ - lib/form_api/models/create_submission_body.rb
271
272
  - lib/form_api/models/inline_response_200.rb
273
+ - lib/form_api/models/inline_response_200_1.rb
272
274
  - lib/form_api/models/inline_response_201.rb
273
275
  - lib/form_api/models/inline_response_201_1.rb
274
- - lib/form_api/models/inline_response_201_1_submission.rb
275
276
  - lib/form_api/models/inline_response_201_combined_submission.rb
276
277
  - lib/form_api/models/inline_response_400.rb
277
278
  - lib/form_api/models/inline_response_401.rb
278
279
  - lib/form_api/models/inline_response_422.rb
280
+ - lib/form_api/models/templatestemplate_idsubmissionsbatch_submission.rb
279
281
  - lib/form_api/version.rb
280
- - scripts/clean
281
- - scripts/fix_gemspec.rb
282
- - scripts/generate
283
- - scripts/post_generate
284
- - scripts/release
285
- - scripts/swagger
286
- - scripts/test
287
282
  - spec/api/client_spec.rb
288
283
  - spec/api/pdf_api_spec.rb
289
284
  - spec/api_client_spec.rb
290
285
  - spec/configuration_spec.rb
291
- - spec/models/data_1_spec.rb
292
- - spec/models/data_spec.rb
286
+ - spec/models/create_combined_submission_body_spec.rb
287
+ - spec/models/create_submission_batch_body_spec.rb
288
+ - spec/models/create_submission_body_spec.rb
289
+ - spec/models/inline_response_200_1_spec.rb
293
290
  - spec/models/inline_response_200_spec.rb
294
291
  - spec/models/inline_response_201_1_spec.rb
295
- - spec/models/inline_response_201_1_submission_spec.rb
296
292
  - spec/models/inline_response_201_combined_submission_spec.rb
297
293
  - spec/models/inline_response_201_spec.rb
298
294
  - spec/models/inline_response_400_spec.rb
299
295
  - spec/models/inline_response_401_spec.rb
300
296
  - spec/models/inline_response_422_spec.rb
297
+ - spec/models/templatestemplate_idsubmissionsbatch_submission_spec.rb
301
298
  - spec/spec_helper.rb
302
299
  - spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml
303
- - swagger-config.json
304
300
  homepage: https://github.com/FormAPI/formapi-ruby
305
301
  licenses:
306
302
  - MIT
@@ -321,24 +317,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
317
  version: '0'
322
318
  requirements: []
323
319
  rubyforge_project:
324
- rubygems_version: 2.6.13
320
+ rubygems_version: 2.6.14
325
321
  signing_key:
326
322
  specification_version: 4
327
- summary: A client library for the FormAPI PDF generation service
323
+ summary: FormAPI API Client
328
324
  test_files:
329
325
  - spec/api/client_spec.rb
330
326
  - spec/api/pdf_api_spec.rb
331
327
  - spec/api_client_spec.rb
332
328
  - spec/configuration_spec.rb
333
- - spec/models/data_1_spec.rb
334
- - spec/models/data_spec.rb
329
+ - spec/models/create_combined_submission_body_spec.rb
330
+ - spec/models/create_submission_batch_body_spec.rb
331
+ - spec/models/create_submission_body_spec.rb
332
+ - spec/models/inline_response_200_1_spec.rb
335
333
  - spec/models/inline_response_200_spec.rb
336
334
  - spec/models/inline_response_201_1_spec.rb
337
- - spec/models/inline_response_201_1_submission_spec.rb
338
335
  - spec/models/inline_response_201_combined_submission_spec.rb
339
336
  - spec/models/inline_response_201_spec.rb
340
337
  - spec/models/inline_response_400_spec.rb
341
338
  - spec/models/inline_response_401_spec.rb
342
339
  - spec/models/inline_response_422_spec.rb
340
+ - spec/models/templatestemplate_idsubmissionsbatch_submission_spec.rb
343
341
  - spec/spec_helper.rb
344
342
  - spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml
data/.swagger-revision DELETED
@@ -1 +0,0 @@
1
- 28a5b74dbf313529a2fc697d46e9ed870cfd6a30
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4.2
4
- - 2.1.10
5
- - 1.9.3
6
-
7
- before_install:
8
- - gem update bundler
data/CHANGELOG.md DELETED
@@ -1,2 +0,0 @@
1
- ### 0.1.0 [October 3, 2017]
2
- * Initial Release
data/LICENSE DELETED
@@ -1,7 +0,0 @@
1
- Copyright © 2017 Form Applications Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This example demonstrates generating a PDF from a preconfigured template,
4
- # and downloading the PDF to a local file.
5
- #
6
- # You can run this example with: ./examples/generate_and_download_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
- PDF_FILENAME = '/tmp/formapi-test.pdf'
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..."
28
-
29
- response = formapi.generate_pdf(
30
- template_id: TEMPLATE_ID,
31
- data: {
32
- first_name: 'John',
33
- last_name: 'Smith',
34
- favorite_color: 'Blue'
35
- }
36
- )
37
-
38
- puts "Downloading PDF to #{PDF_FILENAME}..."
39
-
40
- # Note: This example uses the Typhoeus library to download the file as a stream.
41
- # This is a good way to download files, since the whole file is not loaded into memory.
42
- # (The form_api gem includes Typhoeus as a dependency.)
43
- downloaded_file = File.open PDF_FILENAME, 'wb'
44
- request = Typhoeus::Request.new(response.submission.download_url)
45
- request.on_body { |chunk| downloaded_file.write(chunk) }
46
- request.on_complete do |response|
47
- downloaded_file.close
48
-
49
- puts "PDF was downloaded!"
50
- # Open the downloaded PDF on Mac or Linux.
51
- `type xdg-open > /dev/null 2>&1 && xdg-open '#{PDF_FILENAME}' || open '#{PDF_FILENAME}'`
52
- end
53
- request.run
54
-
55
- rescue FormAPI::ApiError => ex
56
- puts "#{ex.class}: #{ex.message}"
57
- puts ex.code # HTTP response code
58
- puts ex.response_body # HTTP response body
59
- puts ex.backtrace[0..3].join("\n")
60
- end
@@ -1,57 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This example demonstrates generating a PDF from a preconfigured template,
4
- # and NOT 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, but not waiting for job to finish processing..."
28
-
29
- response = formapi.generate_pdf(
30
- template_id: TEMPLATE_ID,
31
- wait: false,
32
- data: {
33
- first_name: 'John',
34
- last_name: 'Smith',
35
- favorite_color: 'Blue'
36
- }
37
- )
38
-
39
- puts "PDF job was submitted:"
40
- puts response
41
-
42
- submission = response.submission
43
- while submission.state == 'pending'
44
- sleep 1
45
- submission = formapi.get_submission(response.submission.id)
46
- end
47
-
48
- puts "PDF finished processing:"
49
- puts submission
50
-
51
-
52
- rescue FormAPI::ApiError => ex
53
- puts "#{ex.class}: #{ex.message}"
54
- puts ex.code # HTTP response code
55
- puts ex.response_body # HTTP response body
56
- puts ex.backtrace[0..3].join("\n")
57
- end
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This example demonstrates merging multiple generated PDFs into a single PDF.
4
- #
5
-
6
- require "bundler/setup"
7
- Bundler.require
8
-
9
- begin
10
- FormAPI.configure do |c|
11
- c.username = ENV['FORM_API_TOKEN_ID']
12
- c.password = ENV['FORM_API_TOKEN_SECRET']
13
- end
14
-
15
- formapi = FormAPI::Client.new
16
-
17
- response = formapi.combine_submissions(
18
- submission_ids: ["SUBMISSION_1_ID", "SUBMISSION_2_ID", ... ],
19
- metadata: {
20
- user_id: 123
21
- }
22
- )
23
-
24
- puts "Download your combined PDF at: #{response.combined_submission.download_url}"
25
-
26
- rescue FormAPI::ApiError => ex
27
- puts "#{ex.class}: #{ex.message}"
28
- puts ex.code # HTTP response code
29
- puts ex.response_body # HTTP response body
30
- puts ex.backtrace[0..3].join("\n")
31
- end
data/scripts/clean DELETED
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
- cd "`dirname \"$0\"`/.."
4
-
5
- rm -rf lib/
@@ -1,31 +0,0 @@
1
- bad_files = %q{s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }}
2
- bad_test_files = %q{s.test_files = `find spec/*`.split("\n")}
3
- good_files = %q{s.files = `git ls-files`.split("\n").uniq.sort.select{|f| !f.empty? }}
4
- good_test_files = %q{s.test_files = `git ls-files spec test`.split("\n")}
5
-
6
- development_dependency_marker = %q{ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'}
7
- development_dependency_marker_plus_injection =
8
- " s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
9
-
10
- # added by script/fix_gemspec.rb.
11
- s.add_development_dependency 'rake', '~>11.2', '>= 11.2.2'
12
- s.add_development_dependency 'pry', '~>0.10', '>= 0.10.4'
13
- # </added> : if the above lines are missing in the gemspec, then
14
- # the matcher for autotest is probably broken"
15
-
16
- filename = "form_api.gemspec"
17
- content = File.read(filename)
18
- [bad_files, bad_test_files, development_dependency_marker].each do |bad_content_to_check|
19
- unless content.include?(bad_content_to_check)
20
- raise "Couldn't find content in form_api.gemspec. Check matchers in there for: “#{bad_content_to_check}”"
21
- end
22
- end
23
- updated_content = content.dup
24
- updated_content.sub!(bad_files, good_files)
25
- updated_content.sub!(bad_test_files, good_test_files)
26
- updated_content.sub!(development_dependency_marker,
27
- development_dependency_marker_plus_injection)
28
-
29
- File.open(filename, "w") do |file|
30
- file.write(updated_content)
31
- end
data/scripts/generate DELETED
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
- cd "$(dirname "$0")/.."
4
-
5
- LANGUAGE=ruby
6
- CONFIG_FILE="swagger-config.json"
7
-
8
- if [ ! -f "$CONFIG_FILE" ]; then
9
- echo "Could not find $CONFIG_FILE"
10
- ./scripts/swagger config-help -l "$LANGUAGE"
11
- exit 1
12
- fi
13
-
14
- ./scripts/clean
15
-
16
- ./scripts/swagger generate \
17
- -i ../form_api/swagger/v1/swagger.json \
18
- -l "$LANGUAGE" \
19
- -c "$CONFIG_FILE"
20
-
21
- # call a generator cleanup script
22
- ./scripts/post_generate
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
- cd "`dirname \"$0\"`/.."
4
-
5
- echo "Removing trailing whitespace..."
6
- find lib -name "*.rb" -type f -exec sed -E -i 's/[[:space:]]+$//g' {} +
7
-
8
- echo "Fixing gemspec to work around swagger..."
9
- ruby scripts/fix_gemspec.rb
10
-
11
-
12
- # This is not needed anymore.
13
- # echo "Adding ':followlocation => true'..."
14
- # sed -i "s/req_opts = {/\
15
- # req_opts = {\n :followlocation => true,/" \
16
- # lib/form_api/api_client.rb
17
-
18
-
19
- echo "Injecting extensions..."
20
- sed -i "s/require 'form_api\/api\/pdf_api'/\
21
- require File.join(File.dirname(__FILE__), '..\/extensions\/lib\/form_api\/api\/client')/" \
22
- lib/form_api.rb
data/scripts/release DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
-
4
- rm -f form_api-*.gem
5
- gem build form_api.gemspec
6
- gem push form_api-*.gem
data/scripts/swagger DELETED
@@ -1,35 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
- cd "$(dirname "$0")/.."
4
-
5
- SWAGGER_CODGEN_REVISION=$(cat .swagger-revision 2> /dev/null || true)
6
- if [ "$SWAGGER_CODGEN_REVISION" = "" ]; then
7
- echo "Set a revision of swagger-codegen to use in .swagger-revision"
8
- exit 1
9
- fi
10
-
11
- if [ ! -d "swagger-codegen" ]; then
12
- git clone https://github.com/swagger-api/swagger-codegen
13
- fi
14
-
15
- (
16
- cd swagger-codegen
17
- if [[ "${#SWAGGER_CODGEN_REVISION}" -lt 40 ]]; then
18
- # resolve git tags / branch names
19
- SWAGGER_CODGEN_REVISION=$(git show "$SWAGGER_CODGEN_REVISION" --format="%H")
20
- fi
21
- if [[ $(cat .git/HEAD) != "$SWAGGER_CODGEN_REVISION" ]]; then
22
- git fetch
23
- git checkout "$SWAGGER_CODGEN_REVISION"
24
- mvn clean package
25
- fi
26
- )
27
-
28
- executable="./swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
29
-
30
- if [ ! -f "$executable" ]; then
31
- mvn clean package
32
- fi
33
-
34
- export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
35
- java $JAVA_OPTS -jar $executable $*