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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/{.swagger-codegen-ignore → .openapi-generator-ignore} +3 -3
- data/.openapi-generator/VERSION +1 -0
- data/.rubocop.yml +154 -0
- data/Gemfile.lock +15 -16
- data/README.md +30 -28
- data/Rakefile +2 -0
- data/docs/{InlineResponse422.md → AuthenticationError.md} +3 -3
- data/docs/{InlineResponse401.md → AuthenticationSuccessResponse.md} +2 -2
- data/docs/CombinedSubmission.md +14 -0
- data/docs/CombinedSubmissionData.md +11 -0
- data/docs/CreateCombinedSubmissionResponse.md +10 -0
- data/docs/CreateSubmissionBatchResponse.md +12 -0
- data/docs/CreateSubmissionData.md +12 -0
- data/docs/CreateSubmissionDataBatchRequest.md +13 -0
- data/docs/CreateSubmissionResponse.md +10 -0
- data/docs/CreateSubmissionResponse1.md +10 -0
- data/docs/{InlineResponse200.md → Error.md} +3 -2
- data/docs/{InlineResponse400.md → InvalidRequest.md} +3 -3
- data/docs/PDFApi.md +148 -64
- data/docs/Submission.md +16 -0
- data/docs/SubmissionBatch.md +16 -0
- data/docs/SubmissionBatchData.md +11 -0
- data/docs/Template.md +21 -0
- data/form_api.gemspec +6 -11
- data/git_push.sh +3 -3
- data/lib/form_api.rb +22 -15
- data/lib/form_api/api/client.rb +91 -38
- data/lib/form_api/api/pdf_api.rb +222 -109
- data/lib/form_api/api_client.rb +13 -13
- data/lib/form_api/api_error.rb +3 -3
- data/lib/form_api/configuration.rb +26 -5
- data/lib/form_api/models/{inline_response_201_1.rb → authentication_error.rb} +25 -29
- data/lib/form_api/models/{inline_response_200.rb → authentication_success_response.rb} +15 -24
- data/lib/form_api/models/{inline_response_201_combined_submission.rb → combined_submission.rb} +42 -66
- data/lib/form_api/models/{create_combined_submission_body.rb → combined_submission_data.rb} +13 -18
- data/lib/form_api/models/{inline_response_201.rb → create_combined_submission_response.rb} +37 -35
- data/lib/form_api/models/create_submission_batch_response.rb +257 -0
- data/lib/form_api/models/{create_submission_batch_body.rb → create_submission_data.rb} +32 -19
- data/lib/form_api/models/{create_submission_body.rb → create_submission_data_batch_request.rb} +45 -18
- data/lib/form_api/models/create_submission_response.rb +237 -0
- data/lib/form_api/models/create_submission_response1.rb +237 -0
- data/lib/form_api/models/{inline_response_400.rb → error.rb} +17 -21
- data/lib/form_api/models/{inline_response_422.rb → invalid_request.rb} +17 -21
- data/lib/form_api/models/{templatestemplate_idsubmissionsbatch_submission.rb → submission.rb} +40 -26
- data/lib/form_api/models/submission_batch.rb +291 -0
- data/lib/form_api/models/{inline_response_401.rb → submission_batch_data.rb} +48 -24
- data/lib/form_api/models/{inline_response_200_1.rb → template.rb} +88 -152
- data/lib/form_api/version.rb +4 -4
- data/spec/api/client_spec.rb +197 -23
- data/spec/api/pdf_api_spec.rb +168 -63
- data/spec/api_client_spec.rb +37 -37
- data/spec/configuration_spec.rb +11 -11
- data/spec/models/authentication_error_spec.rb +51 -0
- data/spec/models/authentication_success_response_spec.rb +45 -0
- data/spec/models/combined_submission_data_spec.rb +59 -0
- data/spec/models/combined_submission_spec.rb +81 -0
- data/spec/models/create_combined_submission_response_spec.rb +57 -0
- data/spec/models/create_submission_batch_response_spec.rb +69 -0
- data/spec/models/create_submission_data_batch_request_spec.rb +71 -0
- data/spec/models/create_submission_data_spec.rb +65 -0
- data/spec/models/create_submission_response1_spec.rb +57 -0
- data/spec/models/create_submission_response_spec.rb +57 -0
- data/spec/models/error_spec.rb +51 -0
- data/spec/models/invalid_request_spec.rb +51 -0
- data/spec/models/submission_batch_data_spec.rb +59 -0
- data/spec/models/submission_batch_spec.rb +93 -0
- data/spec/models/submission_spec.rb +93 -0
- data/spec/models/template_spec.rb +123 -0
- data/spec/spec_helper.rb +3 -14
- metadata +70 -95
- data/.swagger-codegen/VERSION +0 -1
- data/docs/CreateCombinedSubmissionBody.md +0 -11
- data/docs/CreateSubmissionBatchBody.md +0 -10
- data/docs/CreateSubmissionBody.md +0 -10
- data/docs/InlineResponse2001.md +0 -21
- data/docs/InlineResponse201.md +0 -9
- data/docs/InlineResponse2011.md +0 -9
- data/docs/InlineResponse201CombinedSubmission.md +0 -14
- data/docs/TemplatestemplateIdsubmissionsbatchSubmission.md +0 -14
- data/spec/models/create_combined_submission_body_spec.rb +0 -60
- data/spec/models/create_submission_batch_body_spec.rb +0 -54
- data/spec/models/create_submission_body_spec.rb +0 -54
- data/spec/models/inline_response_200_1_spec.rb +0 -124
- data/spec/models/inline_response_200_spec.rb +0 -46
- data/spec/models/inline_response_201_1_spec.rb +0 -52
- data/spec/models/inline_response_201_combined_submission_spec.rb +0 -82
- data/spec/models/inline_response_201_spec.rb +0 -52
- data/spec/models/inline_response_400_spec.rb +0 -52
- data/spec/models/inline_response_401_spec.rb +0 -42
- data/spec/models/inline_response_422_spec.rb +0 -52
- data/spec/models/templatestemplate_idsubmissionsbatch_submission_spec.rb +0 -82
- data/spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml +0 -127
data/lib/form_api/api_client.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#API V1
|
3
3
|
|
4
|
-
#No description provided (generated by
|
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://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 3.3.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -33,7 +33,7 @@ module FormAPI
|
|
33
33
|
@config = config
|
34
34
|
@user_agent = "ruby-swagger-#{VERSION}"
|
35
35
|
@default_headers = {
|
36
|
-
'Content-Type' =>
|
36
|
+
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
38
38
|
}
|
39
39
|
end
|
@@ -137,7 +137,7 @@ module FormAPI
|
|
137
137
|
# @param [String] mime MIME
|
138
138
|
# @return [Boolean] True if the MIME is application/json
|
139
139
|
def json_mime?(mime)
|
140
|
-
|
140
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
141
141
|
end
|
142
142
|
|
143
143
|
# Deserialize the response to the given return type.
|
@@ -201,12 +201,12 @@ module FormAPI
|
|
201
201
|
when /\AArray<(.+)>\z/
|
202
202
|
# e.g. Array<Pet>
|
203
203
|
sub_type = $1
|
204
|
-
data.map {|item| convert_to_type(item, sub_type) }
|
204
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
205
205
|
when /\AHash\<String, (.+)\>\z/
|
206
206
|
# e.g. Hash<String, Integer>
|
207
207
|
sub_type = $1
|
208
208
|
{}.tap do |hash|
|
209
|
-
data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
|
209
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
210
210
|
end
|
211
211
|
else
|
212
212
|
# models, e.g. Pet
|
@@ -228,7 +228,7 @@ module FormAPI
|
|
228
228
|
encoding = nil
|
229
229
|
request.on_headers do |response|
|
230
230
|
content_disposition = response.headers['Content-Disposition']
|
231
|
-
if content_disposition
|
231
|
+
if content_disposition && content_disposition =~ /filename=/i
|
232
232
|
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
233
233
|
prefix = sanitize_filename(filename)
|
234
234
|
else
|
@@ -244,7 +244,7 @@ module FormAPI
|
|
244
244
|
tempfile.write(chunk)
|
245
245
|
end
|
246
246
|
request.on_complete do |response|
|
247
|
-
tempfile.close
|
247
|
+
tempfile.close if tempfile
|
248
248
|
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
249
249
|
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
250
250
|
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
@@ -314,7 +314,7 @@ module FormAPI
|
|
314
314
|
|
315
315
|
# Sets user agent in HTTP header
|
316
316
|
#
|
317
|
-
# @param [String] user_agent User agent (e.g.
|
317
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
318
318
|
def user_agent=(user_agent)
|
319
319
|
@user_agent = user_agent
|
320
320
|
@default_headers['User-Agent'] = @user_agent
|
@@ -327,7 +327,7 @@ module FormAPI
|
|
327
327
|
return nil if accepts.nil? || accepts.empty?
|
328
328
|
# use JSON when present, otherwise use all of the provided
|
329
329
|
json_accept = accepts.find { |s| json_mime?(s) }
|
330
|
-
|
330
|
+
json_accept || accepts.join(',')
|
331
331
|
end
|
332
332
|
|
333
333
|
# Return Content-Type header based on an array of content types provided.
|
@@ -338,7 +338,7 @@ module FormAPI
|
|
338
338
|
return 'application/json' if content_types.nil? || content_types.empty?
|
339
339
|
# use JSON when present, otherwise use the first one
|
340
340
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
341
|
-
|
341
|
+
json_content_type || content_types.first
|
342
342
|
end
|
343
343
|
|
344
344
|
# Convert object (array, hash, object, etc) to JSON string.
|
@@ -348,7 +348,7 @@ module FormAPI
|
|
348
348
|
return model if model.nil? || model.is_a?(String)
|
349
349
|
local_body = nil
|
350
350
|
if model.is_a?(Array)
|
351
|
-
local_body = model.map{|m| object_to_hash(m) }
|
351
|
+
local_body = model.map { |m| object_to_hash(m) }
|
352
352
|
else
|
353
353
|
local_body = object_to_hash(model)
|
354
354
|
end
|
data/lib/form_api/api_error.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#API V1
|
3
3
|
|
4
|
-
#No description provided (generated by
|
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://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 3.3.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#API V1
|
3
3
|
|
4
|
-
#No description provided (generated by
|
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://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 3.3.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,6 +14,8 @@ require 'uri'
|
|
14
14
|
|
15
15
|
module FormAPI
|
16
16
|
class Configuration
|
17
|
+
SCHEME_REGEX = /^(https?):\/\//
|
18
|
+
|
17
19
|
# Defines url scheme
|
18
20
|
attr_accessor :scheme
|
19
21
|
|
@@ -40,11 +42,13 @@ module FormAPI
|
|
40
42
|
attr_accessor :api_key_prefix
|
41
43
|
|
42
44
|
# Defines the username used with HTTP basic authentication.
|
45
|
+
# (FormAPI override: We also add a getter/setter for api_token_id)
|
43
46
|
#
|
44
47
|
# @return [String]
|
45
48
|
attr_accessor :username
|
46
49
|
|
47
50
|
# Defines the password used with HTTP basic authentication.
|
51
|
+
# (FormAPI override: We also add a getter/setter for api_token_secret)
|
48
52
|
#
|
49
53
|
# @return [String]
|
50
54
|
attr_accessor :password
|
@@ -145,9 +149,24 @@ module FormAPI
|
|
145
149
|
@force_ending_format = false
|
146
150
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
147
151
|
|
152
|
+
# Use ENV variables by default if they are provided.
|
153
|
+
@username = ENV['FORMAPI_TOKEN_ID']
|
154
|
+
@password = ENV['FORMAPI_TOKEN_SECRET']
|
155
|
+
|
148
156
|
yield(self) if block_given?
|
149
157
|
end
|
150
158
|
|
159
|
+
def api_token_id=(api_token_id)
|
160
|
+
@username = api_token_id
|
161
|
+
end
|
162
|
+
alias api_token_id username
|
163
|
+
|
164
|
+
def api_token_secret=(api_token_secret)
|
165
|
+
@password = api_token_secret
|
166
|
+
end
|
167
|
+
alias api_token_secret password
|
168
|
+
|
169
|
+
|
151
170
|
# The default Configuration object.
|
152
171
|
def self.default
|
153
172
|
@@default ||= Configuration.new
|
@@ -163,14 +182,16 @@ module FormAPI
|
|
163
182
|
end
|
164
183
|
|
165
184
|
def host=(host)
|
185
|
+
# Also set scheme when setting host.
|
186
|
+
@scheme = host[SCHEME_REGEX, 1] if host.match?(SCHEME_REGEX)
|
166
187
|
# remove http(s):// and anything after a slash
|
167
|
-
@host = host.sub(
|
188
|
+
@host = host.sub(SCHEME_REGEX, '').split('/').first
|
168
189
|
end
|
169
190
|
|
170
191
|
def base_path=(base_path)
|
171
192
|
# Add leading and trailing slashes to base_path
|
172
193
|
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
173
|
-
@base_path =
|
194
|
+
@base_path = '' if @base_path == '/'
|
174
195
|
end
|
175
196
|
|
176
197
|
def base_url
|
@@ -1,23 +1,22 @@
|
|
1
1
|
=begin
|
2
2
|
#API V1
|
3
3
|
|
4
|
-
#No description provided (generated by
|
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://
|
9
|
-
|
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 InlineResponse2011
|
16
|
+
class AuthenticationError
|
18
17
|
attr_accessor :status
|
19
18
|
|
20
|
-
attr_accessor :
|
19
|
+
attr_accessor :error
|
21
20
|
|
22
21
|
class EnumAttributeValidator
|
23
22
|
attr_reader :datatype
|
@@ -45,15 +44,15 @@ module FormAPI
|
|
45
44
|
def self.attribute_map
|
46
45
|
{
|
47
46
|
:'status' => :'status',
|
48
|
-
:'
|
47
|
+
:'error' => :'error'
|
49
48
|
}
|
50
49
|
end
|
51
50
|
|
52
51
|
# Attribute type mapping.
|
53
|
-
def self.
|
52
|
+
def self.openapi_types
|
54
53
|
{
|
55
54
|
:'status' => :'String',
|
56
|
-
:'
|
55
|
+
:'error' => :'String'
|
57
56
|
}
|
58
57
|
end
|
59
58
|
|
@@ -63,44 +62,43 @@ 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']
|
70
69
|
end
|
71
70
|
|
72
|
-
if attributes.has_key?(:'
|
73
|
-
self.
|
71
|
+
if attributes.has_key?(:'error')
|
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
|
77
|
+
# @return Array for valid properties with the reasons
|
80
78
|
def list_invalid_properties
|
81
79
|
invalid_properties = Array.new
|
82
|
-
if @
|
83
|
-
invalid_properties.push(
|
80
|
+
if @error.nil?
|
81
|
+
invalid_properties.push('invalid value for "error", error cannot be nil.')
|
84
82
|
end
|
85
83
|
|
86
|
-
|
84
|
+
invalid_properties
|
87
85
|
end
|
88
86
|
|
89
87
|
# Check to see if the all the properties in the model are valid
|
90
88
|
# @return true if the model is valid
|
91
89
|
def valid?
|
92
|
-
|
93
|
-
status_validator = EnumAttributeValidator.new('String', ["success", "error"])
|
90
|
+
status_validator = EnumAttributeValidator.new('String', ['error'])
|
94
91
|
return false unless status_validator.valid?(@status)
|
95
|
-
return
|
92
|
+
return false if @error.nil?
|
93
|
+
true
|
96
94
|
end
|
97
95
|
|
98
96
|
# Custom attribute writer method checking allowed values (enum).
|
99
97
|
# @param [Object] status Object to be assigned
|
100
98
|
def status=(status)
|
101
|
-
validator = EnumAttributeValidator.new('String', [
|
99
|
+
validator = EnumAttributeValidator.new('String', ['error'])
|
102
100
|
unless validator.valid?(status)
|
103
|
-
fail ArgumentError,
|
101
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
104
102
|
end
|
105
103
|
@status = status
|
106
104
|
end
|
@@ -111,7 +109,7 @@ module FormAPI
|
|
111
109
|
return true if self.equal?(o)
|
112
110
|
self.class == o.class &&
|
113
111
|
status == o.status &&
|
114
|
-
|
112
|
+
error == o.error
|
115
113
|
end
|
116
114
|
|
117
115
|
# @see the `==` method
|
@@ -123,7 +121,7 @@ module FormAPI
|
|
123
121
|
# Calculates hash code according to all attributes.
|
124
122
|
# @return [Fixnum] Hash code
|
125
123
|
def hash
|
126
|
-
[status,
|
124
|
+
[status, error].hash
|
127
125
|
end
|
128
126
|
|
129
127
|
# Builds the object from hash
|
@@ -131,12 +129,12 @@ module FormAPI
|
|
131
129
|
# @return [Object] Returns the model itself
|
132
130
|
def build_from_hash(attributes)
|
133
131
|
return nil unless attributes.is_a?(Hash)
|
134
|
-
self.class.
|
132
|
+
self.class.openapi_types.each_pair do |key, type|
|
135
133
|
if type =~ /\AArray<(.*)>/i
|
136
134
|
# check to ensure the input is an array given that the the attribute
|
137
135
|
# is documented as an array but the input is not
|
138
136
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
139
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
137
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
140
138
|
end
|
141
139
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
142
140
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -218,7 +216,7 @@ module FormAPI
|
|
218
216
|
# @return [Hash] Returns the value in the form of hash
|
219
217
|
def _to_hash(value)
|
220
218
|
if value.is_a?(Array)
|
221
|
-
value.compact.map{ |v| _to_hash(v) }
|
219
|
+
value.compact.map { |v| _to_hash(v) }
|
222
220
|
elsif value.is_a?(Hash)
|
223
221
|
{}.tap do |hash|
|
224
222
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -229,7 +227,5 @@ module FormAPI
|
|
229
227
|
value
|
230
228
|
end
|
231
229
|
end
|
232
|
-
|
233
230
|
end
|
234
|
-
|
235
231
|
end
|
@@ -1,20 +1,19 @@
|
|
1
1
|
=begin
|
2
2
|
#API V1
|
3
3
|
|
4
|
-
#No description provided (generated by
|
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://
|
9
|
-
|
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 InlineResponse200
|
16
|
+
class AuthenticationSuccessResponse
|
18
17
|
attr_accessor :status
|
19
18
|
|
20
19
|
class EnumAttributeValidator
|
@@ -47,7 +46,7 @@ module FormAPI
|
|
47
46
|
end
|
48
47
|
|
49
48
|
# Attribute type mapping.
|
50
|
-
def self.
|
49
|
+
def self.openapi_types
|
51
50
|
{
|
52
51
|
:'status' => :'String'
|
53
52
|
}
|
@@ -59,40 +58,34 @@ module FormAPI
|
|
59
58
|
return unless attributes.is_a?(Hash)
|
60
59
|
|
61
60
|
# convert string to symbol for hash key
|
62
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
63
62
|
|
64
63
|
if attributes.has_key?(:'status')
|
65
64
|
self.status = attributes[:'status']
|
66
65
|
end
|
67
|
-
|
68
66
|
end
|
69
67
|
|
70
68
|
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
-
# @return Array for valid
|
69
|
+
# @return Array for valid properties with the reasons
|
72
70
|
def list_invalid_properties
|
73
71
|
invalid_properties = Array.new
|
74
|
-
|
75
|
-
invalid_properties.push("invalid value for 'status', status cannot be nil.")
|
76
|
-
end
|
77
|
-
|
78
|
-
return invalid_properties
|
72
|
+
invalid_properties
|
79
73
|
end
|
80
74
|
|
81
75
|
# Check to see if the all the properties in the model are valid
|
82
76
|
# @return true if the model is valid
|
83
77
|
def valid?
|
84
|
-
|
85
|
-
status_validator = EnumAttributeValidator.new('String', ["success"])
|
78
|
+
status_validator = EnumAttributeValidator.new('String', ['success'])
|
86
79
|
return false unless status_validator.valid?(@status)
|
87
|
-
|
80
|
+
true
|
88
81
|
end
|
89
82
|
|
90
83
|
# Custom attribute writer method checking allowed values (enum).
|
91
84
|
# @param [Object] status Object to be assigned
|
92
85
|
def status=(status)
|
93
|
-
validator = EnumAttributeValidator.new('String', [
|
86
|
+
validator = EnumAttributeValidator.new('String', ['success'])
|
94
87
|
unless validator.valid?(status)
|
95
|
-
fail ArgumentError,
|
88
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
96
89
|
end
|
97
90
|
@status = status
|
98
91
|
end
|
@@ -122,12 +115,12 @@ module FormAPI
|
|
122
115
|
# @return [Object] Returns the model itself
|
123
116
|
def build_from_hash(attributes)
|
124
117
|
return nil unless attributes.is_a?(Hash)
|
125
|
-
self.class.
|
118
|
+
self.class.openapi_types.each_pair do |key, type|
|
126
119
|
if type =~ /\AArray<(.*)>/i
|
127
120
|
# check to ensure the input is an array given that the the attribute
|
128
121
|
# is documented as an array but the input is not
|
129
122
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
123
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
131
124
|
end
|
132
125
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
126
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -209,7 +202,7 @@ module FormAPI
|
|
209
202
|
# @return [Hash] Returns the value in the form of hash
|
210
203
|
def _to_hash(value)
|
211
204
|
if value.is_a?(Array)
|
212
|
-
value.compact.map{ |v| _to_hash(v) }
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
213
206
|
elsif value.is_a?(Hash)
|
214
207
|
{}.tap do |hash|
|
215
208
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -220,7 +213,5 @@ module FormAPI
|
|
220
213
|
value
|
221
214
|
end
|
222
215
|
end
|
223
|
-
|
224
216
|
end
|
225
|
-
|
226
217
|
end
|