late-sdk 0.0.571 → 0.0.573

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/docs/CheckPhoneNumberAvailability200Response.md +1 -1
  4. data/docs/CheckPhoneNumberAvailability200ResponseAreaOptionsInner.md +2 -2
  5. data/docs/CreateLeadFormRequest.md +13 -11
  6. data/docs/CreateLeadFormRequestPlatformSpecificData.md +49 -0
  7. data/docs/LeadGenApi.md +25 -21
  8. data/docs/LinkedInLeadFormPlatformData.md +30 -0
  9. data/docs/LinkedInLeadFormPlatformDataConsentsInner.md +20 -0
  10. data/docs/LinkedInLeadFormPlatformDataLocale.md +20 -0
  11. data/docs/LinkedInLeadFormPlatformDataQuestionsInner.md +49 -0
  12. data/docs/LinkedInLeadFormPlatformDataQuestionsInnerOneOf.md +28 -0
  13. data/docs/LinkedInLeadFormPlatformDataQuestionsInnerOneOf1.md +28 -0
  14. data/docs/LinkedInLeadFormPlatformDataQuestionsInnerOneOf1ChoicesInner.md +20 -0
  15. data/docs/MetaLeadFormPlatformData.md +46 -0
  16. data/docs/MetaLeadFormPlatformDataContextCard.md +26 -0
  17. data/lib/zernio-sdk/api/lead_gen_api.rb +30 -24
  18. data/lib/zernio-sdk/models/check_phone_number_availability200_response.rb +1 -1
  19. data/lib/zernio-sdk/models/check_phone_number_availability200_response_area_options_inner.rb +2 -2
  20. data/lib/zernio-sdk/models/create_lead_form_request.rb +25 -13
  21. data/lib/zernio-sdk/models/create_lead_form_request_platform_specific_data.rb +105 -0
  22. data/lib/zernio-sdk/models/linked_in_lead_form_platform_data.rb +336 -0
  23. data/lib/zernio-sdk/models/linked_in_lead_form_platform_data_consents_inner.rb +176 -0
  24. data/lib/zernio-sdk/models/linked_in_lead_form_platform_data_locale.rb +156 -0
  25. data/lib/zernio-sdk/models/linked_in_lead_form_platform_data_questions_inner.rb +104 -0
  26. data/lib/zernio-sdk/models/linked_in_lead_form_platform_data_questions_inner_one_of.rb +268 -0
  27. data/lib/zernio-sdk/models/linked_in_lead_form_platform_data_questions_inner_one_of1.rb +295 -0
  28. data/lib/zernio-sdk/models/linked_in_lead_form_platform_data_questions_inner_one_of1_choices_inner.rb +190 -0
  29. data/lib/zernio-sdk/models/meta_lead_form_platform_data.rb +354 -0
  30. data/lib/zernio-sdk/models/meta_lead_form_platform_data_context_card.rb +219 -0
  31. data/lib/zernio-sdk/version.rb +1 -1
  32. data/lib/zernio-sdk.rb +10 -0
  33. data/openapi.yaml +158 -40
  34. data/spec/api/lead_gen_api_spec.rb +14 -12
  35. data/spec/models/create_lead_form_request_platform_specific_data_spec.rb +32 -0
  36. data/spec/models/create_lead_form_request_spec.rb +6 -0
  37. data/spec/models/linked_in_lead_form_platform_data_consents_inner_spec.rb +42 -0
  38. data/spec/models/linked_in_lead_form_platform_data_locale_spec.rb +42 -0
  39. data/spec/models/linked_in_lead_form_platform_data_questions_inner_one_of1_choices_inner_spec.rb +42 -0
  40. data/spec/models/linked_in_lead_form_platform_data_questions_inner_one_of1_spec.rb +70 -0
  41. data/spec/models/linked_in_lead_form_platform_data_questions_inner_one_of_spec.rb +70 -0
  42. data/spec/models/linked_in_lead_form_platform_data_questions_inner_spec.rb +32 -0
  43. data/spec/models/linked_in_lead_form_platform_data_spec.rb +76 -0
  44. data/spec/models/meta_lead_form_platform_data_context_card_spec.rb +64 -0
  45. data/spec/models/meta_lead_form_platform_data_spec.rb +124 -0
  46. data/zernio-sdk-0.0.573.gem +0 -0
  47. metadata +42 -2
  48. data/zernio-sdk-0.0.571.gem +0 -0
@@ -0,0 +1,104 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ module LinkedInLeadFormPlatformDataQuestionsInner
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'LinkedInLeadFormPlatformDataQuestionsInnerOneOf',
23
+ :'LinkedInLeadFormPlatformDataQuestionsInnerOneOf1'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_one_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = Zernio.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1,268 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class LinkedInLeadFormPlatformDataQuestionsInnerOneOf < ApiModelBase
18
+ attr_accessor :kind
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :question
23
+
24
+ attr_accessor :required
25
+
26
+ attr_accessor :response_editable
27
+
28
+ # Defaults to 300 on LinkedIn's side.
29
+ attr_accessor :max_response_length
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'kind' => :'kind',
57
+ :'name' => :'name',
58
+ :'question' => :'question',
59
+ :'required' => :'required',
60
+ :'response_editable' => :'responseEditable',
61
+ :'max_response_length' => :'maxResponseLength'
62
+ }
63
+ end
64
+
65
+ # Returns attribute mapping this model knows about
66
+ def self.acceptable_attribute_map
67
+ attribute_map
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ acceptable_attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'kind' => :'String',
79
+ :'name' => :'String',
80
+ :'question' => :'String',
81
+ :'required' => :'Boolean',
82
+ :'response_editable' => :'Boolean',
83
+ :'max_response_length' => :'Integer'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::LinkedInLeadFormPlatformDataQuestionsInnerOneOf` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ acceptable_attribute_map = self.class.acceptable_attribute_map
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!acceptable_attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::LinkedInLeadFormPlatformDataQuestionsInnerOneOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'kind')
110
+ self.kind = attributes[:'kind']
111
+ else
112
+ self.kind = nil
113
+ end
114
+
115
+ if attributes.key?(:'name')
116
+ self.name = attributes[:'name']
117
+ else
118
+ self.name = nil
119
+ end
120
+
121
+ if attributes.key?(:'question')
122
+ self.question = attributes[:'question']
123
+ else
124
+ self.question = nil
125
+ end
126
+
127
+ if attributes.key?(:'required')
128
+ self.required = attributes[:'required']
129
+ end
130
+
131
+ if attributes.key?(:'response_editable')
132
+ self.response_editable = attributes[:'response_editable']
133
+ end
134
+
135
+ if attributes.key?(:'max_response_length')
136
+ self.max_response_length = attributes[:'max_response_length']
137
+ end
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
144
+ invalid_properties = Array.new
145
+ if @kind.nil?
146
+ invalid_properties.push('invalid value for "kind", kind cannot be nil.')
147
+ end
148
+
149
+ if @name.nil?
150
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
151
+ end
152
+
153
+ if @question.nil?
154
+ invalid_properties.push('invalid value for "question", question cannot be nil.')
155
+ end
156
+
157
+ invalid_properties
158
+ end
159
+
160
+ # Check to see if the all the properties in the model are valid
161
+ # @return true if the model is valid
162
+ def valid?
163
+ warn '[DEPRECATED] the `valid?` method is obsolete'
164
+ return false if @kind.nil?
165
+ kind_validator = EnumAttributeValidator.new('String', ["text"])
166
+ return false unless kind_validator.valid?(@kind)
167
+ return false if @name.nil?
168
+ return false if @question.nil?
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method checking allowed values (enum).
173
+ # @param [Object] kind Object to be assigned
174
+ def kind=(kind)
175
+ validator = EnumAttributeValidator.new('String', ["text"])
176
+ unless validator.valid?(kind)
177
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
178
+ end
179
+ @kind = kind
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] name Value to be assigned
184
+ def name=(name)
185
+ if name.nil?
186
+ fail ArgumentError, 'name cannot be nil'
187
+ end
188
+
189
+ @name = name
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] question Value to be assigned
194
+ def question=(question)
195
+ if question.nil?
196
+ fail ArgumentError, 'question cannot be nil'
197
+ end
198
+
199
+ @question = question
200
+ end
201
+
202
+ # Checks equality by comparing each attribute.
203
+ # @param [Object] Object to be compared
204
+ def ==(o)
205
+ return true if self.equal?(o)
206
+ self.class == o.class &&
207
+ kind == o.kind &&
208
+ name == o.name &&
209
+ question == o.question &&
210
+ required == o.required &&
211
+ response_editable == o.response_editable &&
212
+ max_response_length == o.max_response_length
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [kind, name, question, required, response_editable, max_response_length].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ attributes = attributes.transform_keys(&:to_sym)
233
+ transformed_hash = {}
234
+ openapi_types.each_pair do |key, type|
235
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = nil
237
+ elsif type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[attribute_map[key]].is_a?(Array)
241
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
242
+ end
243
+ elsif !attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
245
+ end
246
+ end
247
+ new(transformed_hash)
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ if value.nil?
257
+ is_nullable = self.class.openapi_nullable.include?(attr)
258
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
+ end
260
+
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ end
267
+
268
+ end
@@ -0,0 +1,295 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class LinkedInLeadFormPlatformDataQuestionsInnerOneOf1 < ApiModelBase
18
+ attr_accessor :kind
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :question
23
+
24
+ attr_accessor :required
25
+
26
+ attr_accessor :response_editable
27
+
28
+ attr_accessor :choices
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'kind' => :'kind',
56
+ :'name' => :'name',
57
+ :'question' => :'question',
58
+ :'required' => :'required',
59
+ :'response_editable' => :'responseEditable',
60
+ :'choices' => :'choices'
61
+ }
62
+ end
63
+
64
+ # Returns attribute mapping this model knows about
65
+ def self.acceptable_attribute_map
66
+ attribute_map
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ acceptable_attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'kind' => :'String',
78
+ :'name' => :'String',
79
+ :'question' => :'String',
80
+ :'required' => :'Boolean',
81
+ :'response_editable' => :'Boolean',
82
+ :'choices' => :'Array<LinkedInLeadFormPlatformDataQuestionsInnerOneOf1ChoicesInner>'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ ])
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::LinkedInLeadFormPlatformDataQuestionsInnerOneOf1` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ acceptable_attribute_map = self.class.acceptable_attribute_map
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!acceptable_attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::LinkedInLeadFormPlatformDataQuestionsInnerOneOf1`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'kind')
109
+ self.kind = attributes[:'kind']
110
+ else
111
+ self.kind = nil
112
+ end
113
+
114
+ if attributes.key?(:'name')
115
+ self.name = attributes[:'name']
116
+ else
117
+ self.name = nil
118
+ end
119
+
120
+ if attributes.key?(:'question')
121
+ self.question = attributes[:'question']
122
+ else
123
+ self.question = nil
124
+ end
125
+
126
+ if attributes.key?(:'required')
127
+ self.required = attributes[:'required']
128
+ end
129
+
130
+ if attributes.key?(:'response_editable')
131
+ self.response_editable = attributes[:'response_editable']
132
+ end
133
+
134
+ if attributes.key?(:'choices')
135
+ if (value = attributes[:'choices']).is_a?(Array)
136
+ self.choices = value
137
+ end
138
+ else
139
+ self.choices = nil
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
147
+ invalid_properties = Array.new
148
+ if @kind.nil?
149
+ invalid_properties.push('invalid value for "kind", kind cannot be nil.')
150
+ end
151
+
152
+ if @name.nil?
153
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
154
+ end
155
+
156
+ if @question.nil?
157
+ invalid_properties.push('invalid value for "question", question cannot be nil.')
158
+ end
159
+
160
+ if @choices.nil?
161
+ invalid_properties.push('invalid value for "choices", choices cannot be nil.')
162
+ end
163
+
164
+ if @choices.length < 1
165
+ invalid_properties.push('invalid value for "choices", number of items must be greater than or equal to 1.')
166
+ end
167
+
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ warn '[DEPRECATED] the `valid?` method is obsolete'
175
+ return false if @kind.nil?
176
+ kind_validator = EnumAttributeValidator.new('String', ["multipleChoice"])
177
+ return false unless kind_validator.valid?(@kind)
178
+ return false if @name.nil?
179
+ return false if @question.nil?
180
+ return false if @choices.nil?
181
+ return false if @choices.length < 1
182
+ true
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] kind Object to be assigned
187
+ def kind=(kind)
188
+ validator = EnumAttributeValidator.new('String', ["multipleChoice"])
189
+ unless validator.valid?(kind)
190
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @kind = kind
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] name Value to be assigned
197
+ def name=(name)
198
+ if name.nil?
199
+ fail ArgumentError, 'name cannot be nil'
200
+ end
201
+
202
+ @name = name
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] question Value to be assigned
207
+ def question=(question)
208
+ if question.nil?
209
+ fail ArgumentError, 'question cannot be nil'
210
+ end
211
+
212
+ @question = question
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] choices Value to be assigned
217
+ def choices=(choices)
218
+ if choices.nil?
219
+ fail ArgumentError, 'choices cannot be nil'
220
+ end
221
+
222
+ if choices.length < 1
223
+ fail ArgumentError, 'invalid value for "choices", number of items must be greater than or equal to 1.'
224
+ end
225
+
226
+ @choices = choices
227
+ end
228
+
229
+ # Checks equality by comparing each attribute.
230
+ # @param [Object] Object to be compared
231
+ def ==(o)
232
+ return true if self.equal?(o)
233
+ self.class == o.class &&
234
+ kind == o.kind &&
235
+ name == o.name &&
236
+ question == o.question &&
237
+ required == o.required &&
238
+ response_editable == o.response_editable &&
239
+ choices == o.choices
240
+ end
241
+
242
+ # @see the `==` method
243
+ # @param [Object] Object to be compared
244
+ def eql?(o)
245
+ self == o
246
+ end
247
+
248
+ # Calculates hash code according to all attributes.
249
+ # @return [Integer] Hash code
250
+ def hash
251
+ [kind, name, question, required, response_editable, choices].hash
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def self.build_from_hash(attributes)
258
+ return nil unless attributes.is_a?(Hash)
259
+ attributes = attributes.transform_keys(&:to_sym)
260
+ transformed_hash = {}
261
+ openapi_types.each_pair do |key, type|
262
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
263
+ transformed_hash["#{key}"] = nil
264
+ elsif type =~ /\AArray<(.*)>/i
265
+ # check to ensure the input is an array given that the attribute
266
+ # is documented as an array but the input is not
267
+ if attributes[attribute_map[key]].is_a?(Array)
268
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
269
+ end
270
+ elsif !attributes[attribute_map[key]].nil?
271
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
272
+ end
273
+ end
274
+ new(transformed_hash)
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ if value.nil?
284
+ is_nullable = self.class.openapi_nullable.include?(attr)
285
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
286
+ end
287
+
288
+ hash[param] = _to_hash(value)
289
+ end
290
+ hash
291
+ end
292
+
293
+ end
294
+
295
+ end