form_api 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/{.swagger-codegen-ignore → .openapi-generator-ignore} +3 -3
  4. data/.openapi-generator/VERSION +1 -0
  5. data/.rubocop.yml +154 -0
  6. data/Gemfile.lock +15 -16
  7. data/README.md +30 -28
  8. data/Rakefile +2 -0
  9. data/docs/{InlineResponse422.md → AuthenticationError.md} +3 -3
  10. data/docs/{InlineResponse401.md → AuthenticationSuccessResponse.md} +2 -2
  11. data/docs/CombinedSubmission.md +14 -0
  12. data/docs/CombinedSubmissionData.md +11 -0
  13. data/docs/CreateCombinedSubmissionResponse.md +10 -0
  14. data/docs/CreateSubmissionBatchResponse.md +12 -0
  15. data/docs/CreateSubmissionData.md +12 -0
  16. data/docs/CreateSubmissionDataBatchRequest.md +13 -0
  17. data/docs/CreateSubmissionResponse.md +10 -0
  18. data/docs/CreateSubmissionResponse1.md +10 -0
  19. data/docs/{InlineResponse200.md → Error.md} +3 -2
  20. data/docs/{InlineResponse400.md → InvalidRequest.md} +3 -3
  21. data/docs/PDFApi.md +148 -64
  22. data/docs/Submission.md +16 -0
  23. data/docs/SubmissionBatch.md +16 -0
  24. data/docs/SubmissionBatchData.md +11 -0
  25. data/docs/Template.md +21 -0
  26. data/form_api.gemspec +6 -11
  27. data/git_push.sh +3 -3
  28. data/lib/form_api.rb +22 -15
  29. data/lib/form_api/api/client.rb +91 -38
  30. data/lib/form_api/api/pdf_api.rb +222 -109
  31. data/lib/form_api/api_client.rb +13 -13
  32. data/lib/form_api/api_error.rb +3 -3
  33. data/lib/form_api/configuration.rb +26 -5
  34. data/lib/form_api/models/{inline_response_201_1.rb → authentication_error.rb} +25 -29
  35. data/lib/form_api/models/{inline_response_200.rb → authentication_success_response.rb} +15 -24
  36. data/lib/form_api/models/{inline_response_201_combined_submission.rb → combined_submission.rb} +42 -66
  37. data/lib/form_api/models/{create_combined_submission_body.rb → combined_submission_data.rb} +13 -18
  38. data/lib/form_api/models/{inline_response_201.rb → create_combined_submission_response.rb} +37 -35
  39. data/lib/form_api/models/create_submission_batch_response.rb +257 -0
  40. data/lib/form_api/models/{create_submission_batch_body.rb → create_submission_data.rb} +32 -19
  41. data/lib/form_api/models/{create_submission_body.rb → create_submission_data_batch_request.rb} +45 -18
  42. data/lib/form_api/models/create_submission_response.rb +237 -0
  43. data/lib/form_api/models/create_submission_response1.rb +237 -0
  44. data/lib/form_api/models/{inline_response_400.rb → error.rb} +17 -21
  45. data/lib/form_api/models/{inline_response_422.rb → invalid_request.rb} +17 -21
  46. data/lib/form_api/models/{templatestemplate_idsubmissionsbatch_submission.rb → submission.rb} +40 -26
  47. data/lib/form_api/models/submission_batch.rb +291 -0
  48. data/lib/form_api/models/{inline_response_401.rb → submission_batch_data.rb} +48 -24
  49. data/lib/form_api/models/{inline_response_200_1.rb → template.rb} +88 -152
  50. data/lib/form_api/version.rb +4 -4
  51. data/spec/api/client_spec.rb +197 -23
  52. data/spec/api/pdf_api_spec.rb +168 -63
  53. data/spec/api_client_spec.rb +37 -37
  54. data/spec/configuration_spec.rb +11 -11
  55. data/spec/models/authentication_error_spec.rb +51 -0
  56. data/spec/models/authentication_success_response_spec.rb +45 -0
  57. data/spec/models/combined_submission_data_spec.rb +59 -0
  58. data/spec/models/combined_submission_spec.rb +81 -0
  59. data/spec/models/create_combined_submission_response_spec.rb +57 -0
  60. data/spec/models/create_submission_batch_response_spec.rb +69 -0
  61. data/spec/models/create_submission_data_batch_request_spec.rb +71 -0
  62. data/spec/models/create_submission_data_spec.rb +65 -0
  63. data/spec/models/create_submission_response1_spec.rb +57 -0
  64. data/spec/models/create_submission_response_spec.rb +57 -0
  65. data/spec/models/error_spec.rb +51 -0
  66. data/spec/models/invalid_request_spec.rb +51 -0
  67. data/spec/models/submission_batch_data_spec.rb +59 -0
  68. data/spec/models/submission_batch_spec.rb +93 -0
  69. data/spec/models/submission_spec.rb +93 -0
  70. data/spec/models/template_spec.rb +123 -0
  71. data/spec/spec_helper.rb +3 -14
  72. metadata +70 -95
  73. data/.swagger-codegen/VERSION +0 -1
  74. data/docs/CreateCombinedSubmissionBody.md +0 -11
  75. data/docs/CreateSubmissionBatchBody.md +0 -10
  76. data/docs/CreateSubmissionBody.md +0 -10
  77. data/docs/InlineResponse2001.md +0 -21
  78. data/docs/InlineResponse201.md +0 -9
  79. data/docs/InlineResponse2011.md +0 -9
  80. data/docs/InlineResponse201CombinedSubmission.md +0 -14
  81. data/docs/TemplatestemplateIdsubmissionsbatchSubmission.md +0 -14
  82. data/spec/models/create_combined_submission_body_spec.rb +0 -60
  83. data/spec/models/create_submission_batch_body_spec.rb +0 -54
  84. data/spec/models/create_submission_body_spec.rb +0 -54
  85. data/spec/models/inline_response_200_1_spec.rb +0 -124
  86. data/spec/models/inline_response_200_spec.rb +0 -46
  87. data/spec/models/inline_response_201_1_spec.rb +0 -52
  88. data/spec/models/inline_response_201_combined_submission_spec.rb +0 -82
  89. data/spec/models/inline_response_201_spec.rb +0 -52
  90. data/spec/models/inline_response_400_spec.rb +0 -52
  91. data/spec/models/inline_response_401_spec.rb +0 -42
  92. data/spec/models/inline_response_422_spec.rb +0 -52
  93. data/spec/models/templatestemplate_idsubmissionsbatch_submission_spec.rb +0 -82
  94. data/spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml +0 -127
@@ -1,20 +1,19 @@
1
1
  =begin
2
2
  #API V1
3
3
 
4
- #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  OpenAPI spec version: v1
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.0-SNAPSHOT
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module FormAPI
16
-
17
- class InlineResponse400
16
+ class Error
18
17
  attr_accessor :status
19
18
 
20
19
  attr_accessor :error
@@ -50,7 +49,7 @@ module FormAPI
50
49
  end
51
50
 
52
51
  # Attribute type mapping.
53
- def self.swagger_types
52
+ def self.openapi_types
54
53
  {
55
54
  :'status' => :'String',
56
55
  :'error' => :'String'
@@ -63,7 +62,7 @@ module FormAPI
63
62
  return unless attributes.is_a?(Hash)
64
63
 
65
64
  # convert string to symbol for hash key
66
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
67
66
 
68
67
  if attributes.has_key?(:'status')
69
68
  self.status = attributes[:'status']
@@ -72,40 +71,39 @@ module FormAPI
72
71
  if attributes.has_key?(:'error')
73
72
  self.error = attributes[:'error']
74
73
  end
75
-
76
74
  end
77
75
 
78
76
  # Show invalid properties with the reasons. Usually used together with valid?
79
- # @return Array for valid properies with the reasons
77
+ # @return Array for valid properties with the reasons
80
78
  def list_invalid_properties
81
79
  invalid_properties = Array.new
82
80
  if @status.nil?
83
- invalid_properties.push("invalid value for 'status', status cannot be nil.")
81
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
84
82
  end
85
83
 
86
84
  if @error.nil?
87
- invalid_properties.push("invalid value for 'error', error cannot be nil.")
85
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
88
86
  end
89
87
 
90
- return invalid_properties
88
+ invalid_properties
91
89
  end
92
90
 
93
91
  # Check to see if the all the properties in the model are valid
94
92
  # @return true if the model is valid
95
93
  def valid?
96
94
  return false if @status.nil?
97
- status_validator = EnumAttributeValidator.new('String', ["error"])
95
+ status_validator = EnumAttributeValidator.new('String', ['error'])
98
96
  return false unless status_validator.valid?(@status)
99
97
  return false if @error.nil?
100
- return true
98
+ true
101
99
  end
102
100
 
103
101
  # Custom attribute writer method checking allowed values (enum).
104
102
  # @param [Object] status Object to be assigned
105
103
  def status=(status)
106
- validator = EnumAttributeValidator.new('String', ["error"])
104
+ validator = EnumAttributeValidator.new('String', ['error'])
107
105
  unless validator.valid?(status)
108
- fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
106
+ fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
109
107
  end
110
108
  @status = status
111
109
  end
@@ -136,12 +134,12 @@ module FormAPI
136
134
  # @return [Object] Returns the model itself
137
135
  def build_from_hash(attributes)
138
136
  return nil unless attributes.is_a?(Hash)
139
- self.class.swagger_types.each_pair do |key, type|
137
+ self.class.openapi_types.each_pair do |key, type|
140
138
  if type =~ /\AArray<(.*)>/i
141
139
  # check to ensure the input is an array given that the the attribute
142
140
  # is documented as an array but the input is not
143
141
  if attributes[self.class.attribute_map[key]].is_a?(Array)
144
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
143
  end
146
144
  elsif !attributes[self.class.attribute_map[key]].nil?
147
145
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -223,7 +221,7 @@ module FormAPI
223
221
  # @return [Hash] Returns the value in the form of hash
224
222
  def _to_hash(value)
225
223
  if value.is_a?(Array)
226
- value.compact.map{ |v| _to_hash(v) }
224
+ value.compact.map { |v| _to_hash(v) }
227
225
  elsif value.is_a?(Hash)
228
226
  {}.tap do |hash|
229
227
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -234,7 +232,5 @@ module FormAPI
234
232
  value
235
233
  end
236
234
  end
237
-
238
235
  end
239
-
240
236
  end
@@ -1,20 +1,19 @@
1
1
  =begin
2
2
  #API V1
3
3
 
4
- #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  OpenAPI spec version: v1
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.0-SNAPSHOT
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module FormAPI
16
-
17
- class InlineResponse422
16
+ class InvalidRequest
18
17
  attr_accessor :status
19
18
 
20
19
  attr_accessor :errors
@@ -50,7 +49,7 @@ module FormAPI
50
49
  end
51
50
 
52
51
  # Attribute type mapping.
53
- def self.swagger_types
52
+ def self.openapi_types
54
53
  {
55
54
  :'status' => :'String',
56
55
  :'errors' => :'Array<String>'
@@ -63,7 +62,7 @@ module FormAPI
63
62
  return unless attributes.is_a?(Hash)
64
63
 
65
64
  # convert string to symbol for hash key
66
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
67
66
 
68
67
  if attributes.has_key?(:'status')
69
68
  self.status = attributes[:'status']
@@ -74,40 +73,39 @@ module FormAPI
74
73
  self.errors = value
75
74
  end
76
75
  end
77
-
78
76
  end
79
77
 
80
78
  # Show invalid properties with the reasons. Usually used together with valid?
81
- # @return Array for valid properies with the reasons
79
+ # @return Array for valid properties with the reasons
82
80
  def list_invalid_properties
83
81
  invalid_properties = Array.new
84
82
  if @status.nil?
85
- invalid_properties.push("invalid value for 'status', status cannot be nil.")
83
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
86
84
  end
87
85
 
88
86
  if @errors.nil?
89
- invalid_properties.push("invalid value for 'errors', errors cannot be nil.")
87
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
90
88
  end
91
89
 
92
- return invalid_properties
90
+ invalid_properties
93
91
  end
94
92
 
95
93
  # Check to see if the all the properties in the model are valid
96
94
  # @return true if the model is valid
97
95
  def valid?
98
96
  return false if @status.nil?
99
- status_validator = EnumAttributeValidator.new('String', ["error"])
97
+ status_validator = EnumAttributeValidator.new('String', ['error'])
100
98
  return false unless status_validator.valid?(@status)
101
99
  return false if @errors.nil?
102
- return true
100
+ true
103
101
  end
104
102
 
105
103
  # Custom attribute writer method checking allowed values (enum).
106
104
  # @param [Object] status Object to be assigned
107
105
  def status=(status)
108
- validator = EnumAttributeValidator.new('String', ["error"])
106
+ validator = EnumAttributeValidator.new('String', ['error'])
109
107
  unless validator.valid?(status)
110
- fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
108
+ fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
111
109
  end
112
110
  @status = status
113
111
  end
@@ -138,12 +136,12 @@ module FormAPI
138
136
  # @return [Object] Returns the model itself
139
137
  def build_from_hash(attributes)
140
138
  return nil unless attributes.is_a?(Hash)
141
- self.class.swagger_types.each_pair do |key, type|
139
+ self.class.openapi_types.each_pair do |key, type|
142
140
  if type =~ /\AArray<(.*)>/i
143
141
  # check to ensure the input is an array given that the the attribute
144
142
  # is documented as an array but the input is not
145
143
  if attributes[self.class.attribute_map[key]].is_a?(Array)
146
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
147
145
  end
148
146
  elsif !attributes[self.class.attribute_map[key]].nil?
149
147
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -225,7 +223,7 @@ module FormAPI
225
223
  # @return [Hash] Returns the value in the form of hash
226
224
  def _to_hash(value)
227
225
  if value.is_a?(Array)
228
- value.compact.map{ |v| _to_hash(v) }
226
+ value.compact.map { |v| _to_hash(v) }
229
227
  elsif value.is_a?(Hash)
230
228
  {}.tap do |hash|
231
229
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -236,7 +234,5 @@ module FormAPI
236
234
  value
237
235
  end
238
236
  end
239
-
240
237
  end
241
-
242
238
  end
@@ -1,20 +1,19 @@
1
1
  =begin
2
2
  #API V1
3
3
 
4
- #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  OpenAPI spec version: v1
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.0-SNAPSHOT
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module FormAPI
16
-
17
- class TemplatestemplateIdsubmissionsbatchSubmission
16
+ class Submission
18
17
  attr_accessor :id
19
18
 
20
19
  attr_accessor :test
@@ -23,12 +22,16 @@ module FormAPI
23
22
 
24
23
  attr_accessor :expires_at
25
24
 
25
+ attr_accessor :processed_at
26
+
26
27
  attr_accessor :state
27
28
 
28
29
  attr_accessor :metadata
29
30
 
30
31
  attr_accessor :download_url
31
32
 
33
+ attr_accessor :batch_id
34
+
32
35
  class EnumAttributeValidator
33
36
  attr_reader :datatype
34
37
  attr_reader :allowable_values
@@ -58,22 +61,26 @@ module FormAPI
58
61
  :'test' => :'test',
59
62
  :'expired' => :'expired',
60
63
  :'expires_at' => :'expires_at',
64
+ :'processed_at' => :'processed_at',
61
65
  :'state' => :'state',
62
66
  :'metadata' => :'metadata',
63
- :'download_url' => :'download_url'
67
+ :'download_url' => :'download_url',
68
+ :'batch_id' => :'batch_id'
64
69
  }
65
70
  end
66
71
 
67
72
  # Attribute type mapping.
68
- def self.swagger_types
73
+ def self.openapi_types
69
74
  {
70
75
  :'id' => :'String',
71
76
  :'test' => :'BOOLEAN',
72
77
  :'expired' => :'BOOLEAN',
73
78
  :'expires_at' => :'String',
79
+ :'processed_at' => :'String',
74
80
  :'state' => :'String',
75
81
  :'metadata' => :'Object',
76
- :'download_url' => :'String'
82
+ :'download_url' => :'String',
83
+ :'batch_id' => :'String'
77
84
  }
78
85
  end
79
86
 
@@ -83,7 +90,7 @@ module FormAPI
83
90
  return unless attributes.is_a?(Hash)
84
91
 
85
92
  # convert string to symbol for hash key
86
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
93
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
87
94
 
88
95
  if attributes.has_key?(:'id')
89
96
  self.id = attributes[:'id']
@@ -101,6 +108,10 @@ module FormAPI
101
108
  self.expires_at = attributes[:'expires_at']
102
109
  end
103
110
 
111
+ if attributes.has_key?(:'processed_at')
112
+ self.processed_at = attributes[:'processed_at']
113
+ end
114
+
104
115
  if attributes.has_key?(:'state')
105
116
  self.state = attributes[:'state']
106
117
  end
@@ -113,29 +124,32 @@ module FormAPI
113
124
  self.download_url = attributes[:'download_url']
114
125
  end
115
126
 
127
+ if attributes.has_key?(:'batch_id')
128
+ self.batch_id = attributes[:'batch_id']
129
+ end
116
130
  end
117
131
 
118
132
  # Show invalid properties with the reasons. Usually used together with valid?
119
- # @return Array for valid properies with the reasons
133
+ # @return Array for valid properties with the reasons
120
134
  def list_invalid_properties
121
135
  invalid_properties = Array.new
122
136
  if @id.nil?
123
- invalid_properties.push("invalid value for 'id', id cannot be nil.")
137
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
124
138
  end
125
139
 
126
140
  if @test.nil?
127
- invalid_properties.push("invalid value for 'test', test cannot be nil.")
141
+ invalid_properties.push('invalid value for "test", test cannot be nil.')
128
142
  end
129
143
 
130
144
  if @expired.nil?
131
- invalid_properties.push("invalid value for 'expired', expired cannot be nil.")
145
+ invalid_properties.push('invalid value for "expired", expired cannot be nil.')
132
146
  end
133
147
 
134
148
  if @state.nil?
135
- invalid_properties.push("invalid value for 'state', state cannot be nil.")
149
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
136
150
  end
137
151
 
138
- return invalid_properties
152
+ invalid_properties
139
153
  end
140
154
 
141
155
  # Check to see if the all the properties in the model are valid
@@ -145,17 +159,17 @@ module FormAPI
145
159
  return false if @test.nil?
146
160
  return false if @expired.nil?
147
161
  return false if @state.nil?
148
- state_validator = EnumAttributeValidator.new('String', ["pending", "processed", "invalid_data", "error", "image_download_failed", "image_processing_failed"])
162
+ state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed'])
149
163
  return false unless state_validator.valid?(@state)
150
- return true
164
+ true
151
165
  end
152
166
 
153
167
  # Custom attribute writer method checking allowed values (enum).
154
168
  # @param [Object] state Object to be assigned
155
169
  def state=(state)
156
- validator = EnumAttributeValidator.new('String', ["pending", "processed", "invalid_data", "error", "image_download_failed", "image_processing_failed"])
170
+ validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed'])
157
171
  unless validator.valid?(state)
158
- fail ArgumentError, "invalid value for 'state', must be one of #{validator.allowable_values}."
172
+ fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
159
173
  end
160
174
  @state = state
161
175
  end
@@ -169,9 +183,11 @@ module FormAPI
169
183
  test == o.test &&
170
184
  expired == o.expired &&
171
185
  expires_at == o.expires_at &&
186
+ processed_at == o.processed_at &&
172
187
  state == o.state &&
173
188
  metadata == o.metadata &&
174
- download_url == o.download_url
189
+ download_url == o.download_url &&
190
+ batch_id == o.batch_id
175
191
  end
176
192
 
177
193
  # @see the `==` method
@@ -183,7 +199,7 @@ module FormAPI
183
199
  # Calculates hash code according to all attributes.
184
200
  # @return [Fixnum] Hash code
185
201
  def hash
186
- [id, test, expired, expires_at, state, metadata, download_url].hash
202
+ [id, test, expired, expires_at, processed_at, state, metadata, download_url, batch_id].hash
187
203
  end
188
204
 
189
205
  # Builds the object from hash
@@ -191,12 +207,12 @@ module FormAPI
191
207
  # @return [Object] Returns the model itself
192
208
  def build_from_hash(attributes)
193
209
  return nil unless attributes.is_a?(Hash)
194
- self.class.swagger_types.each_pair do |key, type|
210
+ self.class.openapi_types.each_pair do |key, type|
195
211
  if type =~ /\AArray<(.*)>/i
196
212
  # check to ensure the input is an array given that the the attribute
197
213
  # is documented as an array but the input is not
198
214
  if attributes[self.class.attribute_map[key]].is_a?(Array)
199
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
200
216
  end
201
217
  elsif !attributes[self.class.attribute_map[key]].nil?
202
218
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -278,7 +294,7 @@ module FormAPI
278
294
  # @return [Hash] Returns the value in the form of hash
279
295
  def _to_hash(value)
280
296
  if value.is_a?(Array)
281
- value.compact.map{ |v| _to_hash(v) }
297
+ value.compact.map { |v| _to_hash(v) }
282
298
  elsif value.is_a?(Hash)
283
299
  {}.tap do |hash|
284
300
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -289,7 +305,5 @@ module FormAPI
289
305
  value
290
306
  end
291
307
  end
292
-
293
308
  end
294
-
295
309
  end
@@ -0,0 +1,291 @@
1
+ =begin
2
+ #API V1
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
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 SubmissionBatch
17
+ attr_accessor :pending_count
18
+
19
+ attr_accessor :completion_percentage
20
+
21
+ attr_accessor :metadata
22
+
23
+ attr_accessor :total_count
24
+
25
+ attr_accessor :submissions
26
+
27
+ attr_accessor :processed_at
28
+
29
+ attr_accessor :id
30
+
31
+ attr_accessor :state
32
+
33
+ attr_accessor :error_count
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'pending_count' => :'pending_count',
61
+ :'completion_percentage' => :'completion_percentage',
62
+ :'metadata' => :'metadata',
63
+ :'total_count' => :'total_count',
64
+ :'submissions' => :'submissions',
65
+ :'processed_at' => :'processed_at',
66
+ :'id' => :'id',
67
+ :'state' => :'state',
68
+ :'error_count' => :'error_count'
69
+ }
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'pending_count' => :'Integer',
76
+ :'completion_percentage' => :'Integer',
77
+ :'metadata' => :'Object',
78
+ :'total_count' => :'Integer',
79
+ :'submissions' => :'Array<Submission>',
80
+ :'processed_at' => :'String',
81
+ :'id' => :'String',
82
+ :'state' => :'String',
83
+ :'error_count' => :'Integer'
84
+ }
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ return unless attributes.is_a?(Hash)
91
+
92
+ # convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
94
+
95
+ if attributes.has_key?(:'pending_count')
96
+ self.pending_count = attributes[:'pending_count']
97
+ end
98
+
99
+ if attributes.has_key?(:'completion_percentage')
100
+ self.completion_percentage = attributes[:'completion_percentage']
101
+ end
102
+
103
+ if attributes.has_key?(:'metadata')
104
+ self.metadata = attributes[:'metadata']
105
+ end
106
+
107
+ if attributes.has_key?(:'total_count')
108
+ self.total_count = attributes[:'total_count']
109
+ end
110
+
111
+ if attributes.has_key?(:'submissions')
112
+ if (value = attributes[:'submissions']).is_a?(Array)
113
+ self.submissions = value
114
+ end
115
+ end
116
+
117
+ if attributes.has_key?(:'processed_at')
118
+ self.processed_at = attributes[:'processed_at']
119
+ end
120
+
121
+ if attributes.has_key?(:'id')
122
+ self.id = attributes[:'id']
123
+ end
124
+
125
+ if attributes.has_key?(:'state')
126
+ self.state = attributes[:'state']
127
+ end
128
+
129
+ if attributes.has_key?(:'error_count')
130
+ self.error_count = attributes[:'error_count']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'error'])
145
+ return false unless state_validator.valid?(@state)
146
+ true
147
+ end
148
+
149
+ # Custom attribute writer method checking allowed values (enum).
150
+ # @param [Object] state Object to be assigned
151
+ def state=(state)
152
+ validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'error'])
153
+ unless validator.valid?(state)
154
+ fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
155
+ end
156
+ @state = state
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ pending_count == o.pending_count &&
165
+ completion_percentage == o.completion_percentage &&
166
+ metadata == o.metadata &&
167
+ total_count == o.total_count &&
168
+ submissions == o.submissions &&
169
+ processed_at == o.processed_at &&
170
+ id == o.id &&
171
+ state == o.state &&
172
+ error_count == o.error_count
173
+ end
174
+
175
+ # @see the `==` method
176
+ # @param [Object] Object to be compared
177
+ def eql?(o)
178
+ self == o
179
+ end
180
+
181
+ # Calculates hash code according to all attributes.
182
+ # @return [Fixnum] Hash code
183
+ def hash
184
+ [pending_count, completion_percentage, metadata, total_count, submissions, processed_at, id, state, error_count].hash
185
+ end
186
+
187
+ # Builds the object from hash
188
+ # @param [Hash] attributes Model attributes in the form of hash
189
+ # @return [Object] Returns the model itself
190
+ def build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ self.class.openapi_types.each_pair do |key, type|
193
+ if type =~ /\AArray<(.*)>/i
194
+ # check to ensure the input is an array given that the the attribute
195
+ # is documented as an array but the input is not
196
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
197
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
198
+ end
199
+ elsif !attributes[self.class.attribute_map[key]].nil?
200
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
201
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
202
+ end
203
+
204
+ self
205
+ end
206
+
207
+ # Deserializes the data based on type
208
+ # @param string type Data type
209
+ # @param string value Value to be deserialized
210
+ # @return [Object] Deserialized data
211
+ def _deserialize(type, value)
212
+ case type.to_sym
213
+ when :DateTime
214
+ DateTime.parse(value)
215
+ when :Date
216
+ Date.parse(value)
217
+ when :String
218
+ value.to_s
219
+ when :Integer
220
+ value.to_i
221
+ when :Float
222
+ value.to_f
223
+ when :BOOLEAN
224
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
225
+ true
226
+ else
227
+ false
228
+ end
229
+ when :Object
230
+ # generic object (usually a Hash), return directly
231
+ value
232
+ when /\AArray<(?<inner_type>.+)>\z/
233
+ inner_type = Regexp.last_match[:inner_type]
234
+ value.map { |v| _deserialize(inner_type, v) }
235
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
236
+ k_type = Regexp.last_match[:k_type]
237
+ v_type = Regexp.last_match[:v_type]
238
+ {}.tap do |hash|
239
+ value.each do |k, v|
240
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
241
+ end
242
+ end
243
+ else # model
244
+ temp_model = FormAPI.const_get(type).new
245
+ temp_model.build_from_hash(value)
246
+ end
247
+ end
248
+
249
+ # Returns the string representation of the object
250
+ # @return [String] String presentation of the object
251
+ def to_s
252
+ to_hash.to_s
253
+ end
254
+
255
+ # to_body is an alias to to_hash (backward compatibility)
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_body
258
+ to_hash
259
+ end
260
+
261
+ # Returns the object in the form of hash
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_hash
264
+ hash = {}
265
+ self.class.attribute_map.each_pair do |attr, param|
266
+ value = self.send(attr)
267
+ next if value.nil?
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+ end
291
+ end