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
@@ -20,10 +20,67 @@ module FormAPI
20
20
  @api_client = api_client
21
21
  end
22
22
 
23
+ # Generates multiple PDFs
24
+ #
25
+ # @param template_id
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [Array<CreateSubmissionBatchBody>] :create_submission_batch_body
28
+ # @return [Array<InlineResponse2011>]
29
+ def batch_generate_pdf(template_id, opts = {})
30
+ data, _status_code, _headers = batch_generate_pdf_with_http_info(template_id, opts)
31
+ return data
32
+ end
33
+
34
+ # Generates multiple PDFs
35
+ #
36
+ # @param template_id
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [Array<CreateSubmissionBatchBody>] :create_submission_batch_body
39
+ # @return [Array<(Array<InlineResponse2011>, Fixnum, Hash)>] Array<InlineResponse2011> data, response status code and response headers
40
+ def batch_generate_pdf_with_http_info(template_id, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: PDFApi.batch_generate_pdf ..."
43
+ end
44
+ # verify the required parameter 'template_id' is set
45
+ if @api_client.config.client_side_validation && template_id.nil?
46
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.batch_generate_pdf"
47
+ end
48
+ # resource path
49
+ local_var_path = "/templates/{template_id}/submissions/batch".sub('{' + 'template_id' + '}', template_id.to_s)
50
+
51
+ # query parameters
52
+ query_params = {}
53
+
54
+ # header parameters
55
+ header_params = {}
56
+ # HTTP header 'Accept' (if needed)
57
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
58
+ # HTTP header 'Content-Type'
59
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
60
+
61
+ # form parameters
62
+ form_params = {}
63
+
64
+ # http body (model)
65
+ post_body = @api_client.object_to_http_body(opts[:'create_submission_batch_body'])
66
+ auth_names = ['api_token_basic']
67
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => 'Array<InlineResponse2011>')
74
+ if @api_client.config.debugging
75
+ @api_client.config.logger.debug "API called: PDFApi#batch_generate_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
+ end
77
+ return data, status_code, headers
78
+ end
79
+
23
80
  # Merge generated PDFs together
24
81
  #
25
82
  # @param [Hash] opts the optional parameters
26
- # @option opts [Data] :data
83
+ # @option opts [CreateCombinedSubmissionBody] :create_combined_submission_body
27
84
  # @return [InlineResponse201]
28
85
  def combine_submissions(opts = {})
29
86
  data, _status_code, _headers = combine_submissions_with_http_info(opts)
@@ -33,7 +90,7 @@ module FormAPI
33
90
  # Merge generated PDFs together
34
91
  #
35
92
  # @param [Hash] opts the optional parameters
36
- # @option opts [Data] :data
93
+ # @option opts [CreateCombinedSubmissionBody] :create_combined_submission_body
37
94
  # @return [Array<(InlineResponse201, Fixnum, Hash)>] InlineResponse201 data, response status code and response headers
38
95
  def combine_submissions_with_http_info(opts = {})
39
96
  if @api_client.config.debugging
@@ -56,8 +113,8 @@ module FormAPI
56
113
  form_params = {}
57
114
 
58
115
  # http body (model)
59
- post_body = @api_client.object_to_http_body(opts[:'data'])
60
- auth_names = ['basic']
116
+ post_body = @api_client.object_to_http_body(opts[:'create_combined_submission_body'])
117
+ auth_names = ['api_token_basic']
61
118
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
62
119
  :header_params => header_params,
63
120
  :query_params => query_params,
@@ -110,7 +167,7 @@ module FormAPI
110
167
 
111
168
  # http body (model)
112
169
  post_body = nil
113
- auth_names = ['basic']
170
+ auth_names = ['api_token_basic']
114
171
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
115
172
  :header_params => header_params,
116
173
  :query_params => query_params,
@@ -128,7 +185,7 @@ module FormAPI
128
185
  #
129
186
  # @param submission_id
130
187
  # @param [Hash] opts the optional parameters
131
- # @return [InlineResponse2011Submission]
188
+ # @return [TemplatestemplateIdsubmissionsbatchSubmission]
132
189
  def expire_submission(submission_id, opts = {})
133
190
  data, _status_code, _headers = expire_submission_with_http_info(submission_id, opts)
134
191
  return data
@@ -138,7 +195,7 @@ module FormAPI
138
195
  #
139
196
  # @param submission_id
140
197
  # @param [Hash] opts the optional parameters
141
- # @return [Array<(InlineResponse2011Submission, Fixnum, Hash)>] InlineResponse2011Submission data, response status code and response headers
198
+ # @return [Array<(TemplatestemplateIdsubmissionsbatchSubmission, Fixnum, Hash)>] TemplatestemplateIdsubmissionsbatchSubmission data, response status code and response headers
142
199
  def expire_submission_with_http_info(submission_id, opts = {})
143
200
  if @api_client.config.debugging
144
201
  @api_client.config.logger.debug "Calling API: PDFApi.expire_submission ..."
@@ -163,14 +220,14 @@ module FormAPI
163
220
 
164
221
  # http body (model)
165
222
  post_body = nil
166
- auth_names = ['basic']
223
+ auth_names = ['api_token_basic']
167
224
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
168
225
  :header_params => header_params,
169
226
  :query_params => query_params,
170
227
  :form_params => form_params,
171
228
  :body => post_body,
172
229
  :auth_names => auth_names,
173
- :return_type => 'InlineResponse2011Submission')
230
+ :return_type => 'TemplatestemplateIdsubmissionsbatchSubmission')
174
231
  if @api_client.config.debugging
175
232
  @api_client.config.logger.debug "API called: PDFApi#expire_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
176
233
  end
@@ -181,7 +238,7 @@ module FormAPI
181
238
  #
182
239
  # @param template_id
183
240
  # @param [Hash] opts the optional parameters
184
- # @option opts [Data1] :data
241
+ # @option opts [CreateSubmissionBody] :create_submission_body
185
242
  # @return [InlineResponse2011]
186
243
  def generate_pdf(template_id, opts = {})
187
244
  data, _status_code, _headers = generate_pdf_with_http_info(template_id, opts)
@@ -192,7 +249,7 @@ module FormAPI
192
249
  #
193
250
  # @param template_id
194
251
  # @param [Hash] opts the optional parameters
195
- # @option opts [Data1] :data
252
+ # @option opts [CreateSubmissionBody] :create_submission_body
196
253
  # @return [Array<(InlineResponse2011, Fixnum, Hash)>] InlineResponse2011 data, response status code and response headers
197
254
  def generate_pdf_with_http_info(template_id, opts = {})
198
255
  if @api_client.config.debugging
@@ -219,8 +276,8 @@ module FormAPI
219
276
  form_params = {}
220
277
 
221
278
  # http body (model)
222
- post_body = @api_client.object_to_http_body(opts[:'data'])
223
- auth_names = ['basic']
279
+ post_body = @api_client.object_to_http_body(opts[:'create_submission_body'])
280
+ auth_names = ['api_token_basic']
224
281
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
225
282
  :header_params => header_params,
226
283
  :query_params => query_params,
@@ -273,7 +330,7 @@ module FormAPI
273
330
 
274
331
  # http body (model)
275
332
  post_body = nil
276
- auth_names = ['basic']
333
+ auth_names = ['api_token_basic']
277
334
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
278
335
  :header_params => header_params,
279
336
  :query_params => query_params,
@@ -291,7 +348,7 @@ module FormAPI
291
348
  #
292
349
  # @param submission_id
293
350
  # @param [Hash] opts the optional parameters
294
- # @return [InlineResponse2011Submission]
351
+ # @return [TemplatestemplateIdsubmissionsbatchSubmission]
295
352
  def get_submission(submission_id, opts = {})
296
353
  data, _status_code, _headers = get_submission_with_http_info(submission_id, opts)
297
354
  return data
@@ -301,7 +358,7 @@ module FormAPI
301
358
  #
302
359
  # @param submission_id
303
360
  # @param [Hash] opts the optional parameters
304
- # @return [Array<(InlineResponse2011Submission, Fixnum, Hash)>] InlineResponse2011Submission data, response status code and response headers
361
+ # @return [Array<(TemplatestemplateIdsubmissionsbatchSubmission, Fixnum, Hash)>] TemplatestemplateIdsubmissionsbatchSubmission data, response status code and response headers
305
362
  def get_submission_with_http_info(submission_id, opts = {})
306
363
  if @api_client.config.debugging
307
364
  @api_client.config.logger.debug "Calling API: PDFApi.get_submission ..."
@@ -326,20 +383,73 @@ module FormAPI
326
383
 
327
384
  # http body (model)
328
385
  post_body = nil
329
- auth_names = ['basic']
386
+ auth_names = ['api_token_basic']
330
387
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
331
388
  :header_params => header_params,
332
389
  :query_params => query_params,
333
390
  :form_params => form_params,
334
391
  :body => post_body,
335
392
  :auth_names => auth_names,
336
- :return_type => 'InlineResponse2011Submission')
393
+ :return_type => 'TemplatestemplateIdsubmissionsbatchSubmission')
337
394
  if @api_client.config.debugging
338
395
  @api_client.config.logger.debug "API called: PDFApi#get_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
339
396
  end
340
397
  return data, status_code, headers
341
398
  end
342
399
 
400
+ # Get a list of all templates
401
+ #
402
+ # @param [Hash] opts the optional parameters
403
+ # @option opts [Integer] :page Default: 1
404
+ # @option opts [Integer] :per_page Default: 50
405
+ # @return [Array<InlineResponse2001>]
406
+ def get_templates(opts = {})
407
+ data, _status_code, _headers = get_templates_with_http_info(opts)
408
+ return data
409
+ end
410
+
411
+ # Get a list of all templates
412
+ #
413
+ # @param [Hash] opts the optional parameters
414
+ # @option opts [Integer] :page Default: 1
415
+ # @option opts [Integer] :per_page Default: 50
416
+ # @return [Array<(Array<InlineResponse2001>, Fixnum, Hash)>] Array<InlineResponse2001> data, response status code and response headers
417
+ def get_templates_with_http_info(opts = {})
418
+ if @api_client.config.debugging
419
+ @api_client.config.logger.debug "Calling API: PDFApi.get_templates ..."
420
+ end
421
+ # resource path
422
+ local_var_path = "/templates"
423
+
424
+ # query parameters
425
+ query_params = {}
426
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
427
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
428
+
429
+ # header parameters
430
+ header_params = {}
431
+ # HTTP header 'Accept' (if needed)
432
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
433
+
434
+ # form parameters
435
+ form_params = {}
436
+
437
+ # http body (model)
438
+ post_body = nil
439
+ auth_names = ['api_token_basic']
440
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
441
+ :header_params => header_params,
442
+ :query_params => query_params,
443
+ :form_params => form_params,
444
+ :body => post_body,
445
+ :auth_names => auth_names,
446
+ :return_type => 'Array<InlineResponse2001>')
447
+ if @api_client.config.debugging
448
+ @api_client.config.logger.debug "API called: PDFApi#get_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
449
+ end
450
+ return data, status_code, headers
451
+ end
452
+
343
453
  # Test Authentication
344
454
  #
345
455
  # @param [Hash] opts the optional parameters
@@ -373,7 +483,7 @@ module FormAPI
373
483
 
374
484
  # http body (model)
375
485
  post_body = nil
376
- auth_names = ['basic']
486
+ auth_names = ['api_token_basic']
377
487
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
378
488
  :header_params => header_params,
379
489
  :query_params => query_params,
@@ -196,7 +196,7 @@ module FormAPI
196
196
  # Returns Auth Settings hash for api client.
197
197
  def auth_settings
198
198
  {
199
- 'basic' =>
199
+ 'api_token_basic' =>
200
200
  {
201
201
  type: 'basic',
202
202
  in: 'header',
@@ -14,7 +14,7 @@ require 'date'
14
14
 
15
15
  module FormAPI
16
16
 
17
- class Data
17
+ class CreateCombinedSubmissionBody
18
18
  attr_accessor :test
19
19
 
20
20
  attr_accessor :submission_ids
@@ -0,0 +1,211 @@
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 'date'
14
+
15
+ module FormAPI
16
+
17
+ class CreateSubmissionBatchBody
18
+ attr_accessor :test
19
+
20
+ attr_accessor :data
21
+
22
+ attr_accessor :metadata
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'test' => :'test',
29
+ :'data' => :'data',
30
+ :'metadata' => :'metadata'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ :'test' => :'BOOLEAN',
38
+ :'data' => :'Object',
39
+ :'metadata' => :'Object'
40
+ }
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+ if attributes.has_key?(:'test')
52
+ self.test = attributes[:'test']
53
+ end
54
+
55
+ if attributes.has_key?(:'data')
56
+ self.data = attributes[:'data']
57
+ end
58
+
59
+ if attributes.has_key?(:'metadata')
60
+ self.metadata = attributes[:'metadata']
61
+ end
62
+
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properies with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @data.nil?
70
+ invalid_properties.push("invalid value for 'data', data cannot be nil.")
71
+ end
72
+
73
+ return invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @data.nil?
80
+ return true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ test == o.test &&
89
+ data == o.data &&
90
+ metadata == o.metadata
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Fixnum] Hash code
101
+ def hash
102
+ [test, data, metadata].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.swagger_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :BOOLEAN
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ temp_model = FormAPI.const_get(type).new
163
+ temp_model.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ next if value.nil?
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map{ |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+
211
+ end
@@ -14,7 +14,7 @@ require 'date'
14
14
 
15
15
  module FormAPI
16
16
 
17
- class Data1
17
+ class CreateSubmissionBody
18
18
  attr_accessor :test
19
19
 
20
20
  attr_accessor :data