form_api 1.6.0 → 1.7.0

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +21 -10
  5. data/docs/{CreateSubmissionDataBatchV1.md → CombinePdfsData.md} +4 -4
  6. data/docs/CombinedSubmission.md +1 -0
  7. data/docs/CreateCustomFileData.md +8 -0
  8. data/docs/CreateCustomFileResponse.md +10 -0
  9. data/docs/CreateTemplateData.md +8 -0
  10. data/docs/CustomFile.md +9 -0
  11. data/docs/PDFApi.md +208 -12
  12. data/docs/SubmissionBatchData.md +1 -1
  13. data/docs/{CreateSubmissionData.md → SubmissionData.md} +1 -1
  14. data/docs/{CreateSubmissionDataBatchRequest.md → SubmissionDataBatchRequest.md} +5 -5
  15. data/docs/Templatesv2Template.md +19 -0
  16. data/docs/Templatesv2TemplateDocument.md +10 -0
  17. data/docs/Templatesv2TemplateDocumentMetadata.md +10 -0
  18. data/lib/form_api.rb +10 -3
  19. data/lib/form_api/api/client.rb +25 -9
  20. data/lib/form_api/api/pdf_api.rb +224 -20
  21. data/lib/form_api/models/{create_submission_data_batch_request.rb → combine_pdfs_data.rb} +31 -43
  22. data/lib/form_api/models/combined_submission.rb +12 -1
  23. data/lib/form_api/models/create_custom_file_data.rb +188 -0
  24. data/lib/form_api/models/create_custom_file_response.rb +237 -0
  25. data/lib/form_api/models/create_template_data.rb +188 -0
  26. data/lib/form_api/models/custom_file.rb +192 -0
  27. data/lib/form_api/models/submission_batch_data.rb +1 -1
  28. data/lib/form_api/models/{create_submission_data.rb → submission_data.rb} +1 -1
  29. data/lib/form_api/models/{create_submission_data_batch_v1.rb → submission_data_batch_request.rb} +32 -28
  30. data/lib/form_api/models/templatesv2_template.rb +316 -0
  31. data/lib/form_api/models/templatesv2_template_document.rb +235 -0
  32. data/lib/form_api/models/templatesv2_template_document_metadata.rb +235 -0
  33. data/lib/form_api/version.rb +1 -1
  34. data/spec/api/client_integration_spec.rb +41 -4
  35. data/spec/api/pdf_api_integration_spec.rb +7 -7
  36. data/spec/api/pdf_api_spec_original.skipped.rb +55 -9
  37. data/spec/models/{create_submission_data_batch_v1_spec.rb → combine_pdfs_data_spec.rb} +10 -10
  38. data/spec/models/combined_submission_spec.rb +6 -0
  39. data/spec/models/create_custom_file_data_spec.rb +41 -0
  40. data/spec/models/create_custom_file_response_spec.rb +57 -0
  41. data/spec/models/create_template_data_spec.rb +41 -0
  42. data/spec/models/custom_file_spec.rb +47 -0
  43. data/spec/models/{create_submission_data_batch_request_spec.rb → submission_data_batch_request_spec.rb} +12 -12
  44. data/spec/models/{create_submission_data_spec.rb → submission_data_spec.rb} +6 -6
  45. data/spec/models/templatesv2_template_document_metadata_spec.rb +57 -0
  46. data/spec/models/templatesv2_template_document_spec.rb +57 -0
  47. data/spec/models/templatesv2_template_spec.rb +111 -0
  48. data/spec/spec_helper.rb +3 -0
  49. metadata +42 -14
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #FormAPI is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module FormAPI
16
+ class CreateTemplateData
17
+ attr_accessor :template
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'template' => :'template'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'template' => :'Templatesv2Template'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
+
41
+ if attributes.has_key?(:'template')
42
+ self.template = attributes[:'template']
43
+ end
44
+ end
45
+
46
+ # Show invalid properties with the reasons. Usually used together with valid?
47
+ # @return Array for valid properties with the reasons
48
+ def list_invalid_properties
49
+ invalid_properties = Array.new
50
+ if @template.nil?
51
+ invalid_properties.push('invalid value for "template", template cannot be nil.')
52
+ end
53
+
54
+ invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ return false if @template.nil?
61
+ true
62
+ end
63
+
64
+ # Checks equality by comparing each attribute.
65
+ # @param [Object] Object to be compared
66
+ def ==(o)
67
+ return true if self.equal?(o)
68
+ self.class == o.class &&
69
+ template == o.template
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(o)
75
+ self == o
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [template].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ self.class.openapi_types.each_pair do |key, type|
90
+ if type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
94
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
98
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ # Deserializes the data based on type
105
+ # @param string type Data type
106
+ # @param string value Value to be deserialized
107
+ # @return [Object] Deserialized data
108
+ def _deserialize(type, value)
109
+ case type.to_sym
110
+ when :DateTime
111
+ DateTime.parse(value)
112
+ when :Date
113
+ Date.parse(value)
114
+ when :String
115
+ value.to_s
116
+ when :Integer
117
+ value.to_i
118
+ when :Float
119
+ value.to_f
120
+ when :BOOLEAN
121
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
122
+ true
123
+ else
124
+ false
125
+ end
126
+ when :Object
127
+ # generic object (usually a Hash), return directly
128
+ value
129
+ when /\AArray<(?<inner_type>.+)>\z/
130
+ inner_type = Regexp.last_match[:inner_type]
131
+ value.map { |v| _deserialize(inner_type, v) }
132
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
133
+ k_type = Regexp.last_match[:k_type]
134
+ v_type = Regexp.last_match[:v_type]
135
+ {}.tap do |hash|
136
+ value.each do |k, v|
137
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
138
+ end
139
+ end
140
+ else # model
141
+ temp_model = FormAPI.const_get(type).new
142
+ temp_model.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ next if value.nil?
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param [Object] value Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+ end
188
+ end
@@ -0,0 +1,192 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #FormAPI is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module FormAPI
16
+ class CustomFile
17
+ attr_accessor :id
18
+
19
+ attr_accessor :url
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'id' => :'id',
25
+ :'url' => :'url'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'id' => :'String',
33
+ :'url' => :'String'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'id')
46
+ self.id = attributes[:'id']
47
+ end
48
+
49
+ if attributes.has_key?(:'url')
50
+ self.url = attributes[:'url']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ id == o.id &&
73
+ url == o.url
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [id, url].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = FormAPI.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map { |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+ end
192
+ end
@@ -38,7 +38,7 @@ module FormAPI
38
38
  :'metadata' => :'Object',
39
39
  :'test' => :'BOOLEAN',
40
40
  :'template_id' => :'String',
41
- :'submissions' => :'Array<CreateSubmissionDataBatchRequest>'
41
+ :'submissions' => :'Array<SubmissionDataBatchRequest>'
42
42
  }
43
43
  end
44
44
 
@@ -13,7 +13,7 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module FormAPI
16
- class CreateSubmissionData
16
+ class SubmissionData
17
17
  attr_accessor :test
18
18
 
19
19
  attr_accessor :data
@@ -13,36 +13,40 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module FormAPI
16
- class CreateSubmissionDataBatchV1
16
+ class SubmissionDataBatchRequest
17
+ attr_accessor :css
18
+
19
+ attr_accessor :metadata
20
+
17
21
  attr_accessor :test
18
22
 
19
23
  attr_accessor :data
20
24
 
21
- attr_accessor :html
25
+ attr_accessor :template_id
22
26
 
23
- attr_accessor :css
24
-
25
- attr_accessor :metadata
27
+ attr_accessor :html
26
28
 
27
29
  # Attribute mapping from ruby-style variable name to JSON key.
28
30
  def self.attribute_map
29
31
  {
32
+ :'css' => :'css',
33
+ :'metadata' => :'metadata',
30
34
  :'test' => :'test',
31
35
  :'data' => :'data',
32
- :'html' => :'html',
33
- :'css' => :'css',
34
- :'metadata' => :'metadata'
36
+ :'template_id' => :'template_id',
37
+ :'html' => :'html'
35
38
  }
36
39
  end
37
40
 
38
41
  # Attribute type mapping.
39
42
  def self.openapi_types
40
43
  {
44
+ :'css' => :'String',
45
+ :'metadata' => :'Object',
41
46
  :'test' => :'BOOLEAN',
42
47
  :'data' => :'Object',
43
- :'html' => :'String',
44
- :'css' => :'String',
45
- :'metadata' => :'Object'
48
+ :'template_id' => :'String',
49
+ :'html' => :'String'
46
50
  }
47
51
  end
48
52
 
@@ -54,6 +58,14 @@ module FormAPI
54
58
  # convert string to symbol for hash key
55
59
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
60
 
61
+ if attributes.has_key?(:'css')
62
+ self.css = attributes[:'css']
63
+ end
64
+
65
+ if attributes.has_key?(:'metadata')
66
+ self.metadata = attributes[:'metadata']
67
+ end
68
+
57
69
  if attributes.has_key?(:'test')
58
70
  self.test = attributes[:'test']
59
71
  end
@@ -62,16 +74,12 @@ module FormAPI
62
74
  self.data = attributes[:'data']
63
75
  end
64
76
 
65
- if attributes.has_key?(:'html')
66
- self.html = attributes[:'html']
67
- end
68
-
69
- if attributes.has_key?(:'css')
70
- self.css = attributes[:'css']
77
+ if attributes.has_key?(:'template_id')
78
+ self.template_id = attributes[:'template_id']
71
79
  end
72
80
 
73
- if attributes.has_key?(:'metadata')
74
- self.metadata = attributes[:'metadata']
81
+ if attributes.has_key?(:'html')
82
+ self.html = attributes[:'html']
75
83
  end
76
84
  end
77
85
 
@@ -79,17 +87,12 @@ module FormAPI
79
87
  # @return Array for valid properties with the reasons
80
88
  def list_invalid_properties
81
89
  invalid_properties = Array.new
82
- if @data.nil?
83
- invalid_properties.push('invalid value for "data", data cannot be nil.')
84
- end
85
-
86
90
  invalid_properties
87
91
  end
88
92
 
89
93
  # Check to see if the all the properties in the model are valid
90
94
  # @return true if the model is valid
91
95
  def valid?
92
- return false if @data.nil?
93
96
  true
94
97
  end
95
98
 
@@ -98,11 +101,12 @@ module FormAPI
98
101
  def ==(o)
99
102
  return true if self.equal?(o)
100
103
  self.class == o.class &&
104
+ css == o.css &&
105
+ metadata == o.metadata &&
101
106
  test == o.test &&
102
107
  data == o.data &&
103
- html == o.html &&
104
- css == o.css &&
105
- metadata == o.metadata
108
+ template_id == o.template_id &&
109
+ html == o.html
106
110
  end
107
111
 
108
112
  # @see the `==` method
@@ -114,7 +118,7 @@ module FormAPI
114
118
  # Calculates hash code according to all attributes.
115
119
  # @return [Fixnum] Hash code
116
120
  def hash
117
- [test, data, html, css, metadata].hash
121
+ [css, metadata, test, data, template_id, html].hash
118
122
  end
119
123
 
120
124
  # Builds the object from hash