appnigma-sdk 0.1.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 (63) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +359 -0
  4. data/lib/appnigma/checks.rb +90 -0
  5. data/lib/appnigma/client.rb +118 -0
  6. data/lib/appnigma/connections.rb +31 -0
  7. data/lib/appnigma/constants.rb +80 -0
  8. data/lib/appnigma/crm.rb +40 -0
  9. data/lib/appnigma/errors.rb +135 -0
  10. data/lib/appnigma/generated/api/default_api.rb +972 -0
  11. data/lib/appnigma/generated/api_client.rb +441 -0
  12. data/lib/appnigma/generated/api_error.rb +58 -0
  13. data/lib/appnigma/generated/api_model_base.rb +88 -0
  14. data/lib/appnigma/generated/configuration.rb +392 -0
  15. data/lib/appnigma/generated/models/connection_status.rb +41 -0
  16. data/lib/appnigma/generated/models/create_connection_link_input.rb +265 -0
  17. data/lib/appnigma/generated/models/create_connection_link_output.rb +205 -0
  18. data/lib/appnigma/generated/models/crm_company.rb +322 -0
  19. data/lib/appnigma/generated/models/crm_company_get_output.rb +177 -0
  20. data/lib/appnigma/generated/models/crm_company_list_output.rb +192 -0
  21. data/lib/appnigma/generated/models/crm_contact.rb +404 -0
  22. data/lib/appnigma/generated/models/crm_contact_get_output.rb +177 -0
  23. data/lib/appnigma/generated/models/crm_contact_list_output.rb +192 -0
  24. data/lib/appnigma/generated/models/crm_custom_field.rb +189 -0
  25. data/lib/appnigma/generated/models/crm_deal.rb +479 -0
  26. data/lib/appnigma/generated/models/crm_deal_get_output.rb +177 -0
  27. data/lib/appnigma/generated/models/crm_deal_list_output.rb +192 -0
  28. data/lib/appnigma/generated/models/crm_email.rb +249 -0
  29. data/lib/appnigma/generated/models/crm_get_input.rb +272 -0
  30. data/lib/appnigma/generated/models/crm_labelled.rb +190 -0
  31. data/lib/appnigma/generated/models/crm_list_input.rb +303 -0
  32. data/lib/appnigma/generated/models/crm_phone.rb +249 -0
  33. data/lib/appnigma/generated/models/function_entry.rb +346 -0
  34. data/lib/appnigma/generated/models/function_owner.rb +105 -0
  35. data/lib/appnigma/generated/models/function_owner_one_of.rb +201 -0
  36. data/lib/appnigma/generated/models/function_owner_one_of1.rb +227 -0
  37. data/lib/appnigma/generated/models/get_connection_output.rb +251 -0
  38. data/lib/appnigma/generated/models/get_guide_output.rb +178 -0
  39. data/lib/appnigma/generated/models/json_value.rb +106 -0
  40. data/lib/appnigma/generated/models/list_functions_output.rb +179 -0
  41. data/lib/appnigma/generated/models/platform_request_input.rb +314 -0
  42. data/lib/appnigma/generated/models/platform_request_input_body.rb +104 -0
  43. data/lib/appnigma/generated/models/platform_request_output.rb +221 -0
  44. data/lib/appnigma/generated/models/post_input.rb +327 -0
  45. data/lib/appnigma/generated/models/post_input_record_value.rb +104 -0
  46. data/lib/appnigma/generated/models/post_output.rb +203 -0
  47. data/lib/appnigma/generated/models/pull_input.rb +335 -0
  48. data/lib/appnigma/generated/models/pull_output.rb +191 -0
  49. data/lib/appnigma/generated/models/pull_output_records_inner.rb +205 -0
  50. data/lib/appnigma/generated/models/run_input.rb +332 -0
  51. data/lib/appnigma/generated/models/run_output.rb +164 -0
  52. data/lib/appnigma/generated/models/sdk_error.rb +177 -0
  53. data/lib/appnigma/generated/models/sdk_error_error.rb +254 -0
  54. data/lib/appnigma/generated/models/sdk_error_error_details.rb +211 -0
  55. data/lib/appnigma/generated/models/sdk_problem.rb +205 -0
  56. data/lib/appnigma/generated/version.rb +15 -0
  57. data/lib/appnigma/generated.rb +82 -0
  58. data/lib/appnigma/names.rb +62 -0
  59. data/lib/appnigma/retry.rb +80 -0
  60. data/lib/appnigma/transport.rb +138 -0
  61. data/lib/appnigma/version.rb +9 -0
  62. data/lib/appnigma.rb +16 -0
  63. metadata +155 -0
@@ -0,0 +1,314 @@
1
+ =begin
2
+ #Appnigma SDK API
3
+
4
+ #The routes a customer's product calls through an Appnigma SDK. Every answer carries a request id in X-Request-Id; quote it when you write to support.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Appnigma::Generated
17
+ class PlatformRequestInput < ApiModelBase
18
+ # Your own id for the end customer.
19
+ attr_accessor :end_customer_id
20
+
21
+ # The platform key, such as hubspot.
22
+ attr_accessor :platform
23
+
24
+ # A GET reads and may be retried; any other method may change the platform.
25
+ attr_accessor :method
26
+
27
+ # A path on the platform's own API, with its query, such as /crm/v3/objects/notes?limit=10. Never a full address: no scheme, no //host, no backslash, no fragment, and no . or .. step, plain or encoded.
28
+ attr_accessor :path
29
+
30
+ attr_accessor :body
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'end_customer_id' => :'endCustomerId',
58
+ :'platform' => :'platform',
59
+ :'method' => :'method',
60
+ :'path' => :'path',
61
+ :'body' => :'body'
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
+ :'end_customer_id' => :'String',
79
+ :'platform' => :'String',
80
+ :'method' => :'String',
81
+ :'path' => :'String',
82
+ :'body' => :'PlatformRequestInputBody'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ ])
90
+ end
91
+
92
+ # Returns attribute type mapping
93
+ def self.acceptable_openapi_types
94
+ openapi_types
95
+ end
96
+
97
+ # Returns the nullable attributes
98
+ def self.acceptable_openapi_nullable
99
+ openapi_nullable
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Appnigma::Generated::PlatformRequestInput` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ acceptable_attribute_map = self.class.acceptable_attribute_map
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!acceptable_attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Appnigma::Generated::PlatformRequestInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'end_customer_id')
119
+ self.end_customer_id = attributes[:'end_customer_id']
120
+ else
121
+ self.end_customer_id = nil
122
+ end
123
+
124
+ if attributes.key?(:'platform')
125
+ self.platform = attributes[:'platform']
126
+ else
127
+ self.platform = nil
128
+ end
129
+
130
+ if attributes.key?(:'method')
131
+ self.method = attributes[:'method']
132
+ else
133
+ self.method = nil
134
+ end
135
+
136
+ if attributes.key?(:'path')
137
+ self.path = attributes[:'path']
138
+ else
139
+ self.path = nil
140
+ end
141
+
142
+ if attributes.key?(:'body')
143
+ self.body = attributes[:'body']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
151
+ invalid_properties = Array.new
152
+ if @end_customer_id.nil?
153
+ invalid_properties.push('invalid value for "end_customer_id", end_customer_id cannot be nil.')
154
+ end
155
+
156
+ pattern = Regexp.new(/^[A-Za-z0-9._-]{1,100}$/)
157
+ if @end_customer_id !~ pattern
158
+ invalid_properties.push("invalid value for \"end_customer_id\", must conform to the pattern #{pattern}.")
159
+ end
160
+
161
+ if @platform.nil?
162
+ invalid_properties.push('invalid value for "platform", platform cannot be nil.')
163
+ end
164
+
165
+ pattern = Regexp.new(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
166
+ if @platform !~ pattern
167
+ invalid_properties.push("invalid value for \"platform\", must conform to the pattern #{pattern}.")
168
+ end
169
+
170
+ if @method.nil?
171
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
172
+ end
173
+
174
+ if @path.nil?
175
+ invalid_properties.push('invalid value for "path", path cannot be nil.')
176
+ end
177
+
178
+ invalid_properties
179
+ end
180
+
181
+ # Check to see if the all the properties in the model are valid
182
+ # @return true if the model is valid
183
+ def valid?
184
+ warn '[DEPRECATED] the `valid?` method is obsolete'
185
+ return false if @end_customer_id.nil?
186
+ return false if @end_customer_id !~ Regexp.new(/^[A-Za-z0-9._-]{1,100}$/)
187
+ return false if @platform.nil?
188
+ return false if @platform !~ Regexp.new(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
189
+ return false if @method.nil?
190
+ method_validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE"])
191
+ return false unless method_validator.valid?(@method)
192
+ return false if @path.nil?
193
+ true
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] end_customer_id Value to be assigned
198
+ def end_customer_id=(end_customer_id)
199
+ if end_customer_id.nil?
200
+ fail ArgumentError, 'end_customer_id cannot be nil'
201
+ end
202
+
203
+ pattern = Regexp.new(/^[A-Za-z0-9._-]{1,100}$/)
204
+ if end_customer_id !~ pattern
205
+ fail ArgumentError, "invalid value for \"end_customer_id\", must conform to the pattern #{pattern}."
206
+ end
207
+
208
+ @end_customer_id = end_customer_id
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] platform Value to be assigned
213
+ def platform=(platform)
214
+ if platform.nil?
215
+ fail ArgumentError, 'platform cannot be nil'
216
+ end
217
+
218
+ pattern = Regexp.new(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
219
+ if platform !~ pattern
220
+ fail ArgumentError, "invalid value for \"platform\", must conform to the pattern #{pattern}."
221
+ end
222
+
223
+ @platform = platform
224
+ end
225
+
226
+ # Custom attribute writer method checking allowed values (enum).
227
+ # @param [Object] method Object to be assigned
228
+ def method=(method)
229
+ validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE"])
230
+ unless validator.valid?(method)
231
+ fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
232
+ end
233
+ @method = method
234
+ end
235
+
236
+ # Custom attribute writer method with validation
237
+ # @param [Object] path Value to be assigned
238
+ def path=(path)
239
+ if path.nil?
240
+ fail ArgumentError, 'path cannot be nil'
241
+ end
242
+
243
+ @path = path
244
+ end
245
+
246
+ # Checks equality by comparing each attribute.
247
+ # @param [Object] Object to be compared
248
+ def ==(o)
249
+ return true if self.equal?(o)
250
+ self.class == o.class &&
251
+ end_customer_id == o.end_customer_id &&
252
+ platform == o.platform &&
253
+ method == o.method &&
254
+ path == o.path &&
255
+ body == o.body
256
+ end
257
+
258
+ # @see the `==` method
259
+ # @param [Object] Object to be compared
260
+ def eql?(o)
261
+ self == o
262
+ end
263
+
264
+ # Calculates hash code according to all attributes.
265
+ # @return [Integer] Hash code
266
+ def hash
267
+ [end_customer_id, platform, method, path, body].hash
268
+ end
269
+
270
+ # Builds the object from hash
271
+ # @param [Hash] attributes Model attributes in the form of hash
272
+ # @return [Object] Returns the model itself
273
+ def self.build_from_hash(attributes)
274
+ return nil unless attributes.is_a?(Hash)
275
+ attributes = attributes.transform_keys(&:to_sym)
276
+ # include attributes inherited from allOf parents (the nearest declaration wins)
277
+ map = acceptable_attribute_map
278
+ transformed_hash = {}
279
+ acceptable_openapi_types.each_pair do |key, type|
280
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
281
+ transformed_hash["#{key}"] = nil
282
+ elsif type =~ /\AArray<(.*)>/i
283
+ # check to ensure the input is an array given that the attribute
284
+ # is documented as an array but the input is not
285
+ if attributes[map[key]].is_a?(Array)
286
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
287
+ end
288
+ elsif !attributes[map[key]].nil?
289
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
290
+ end
291
+ end
292
+ new(transformed_hash)
293
+ end
294
+
295
+ # Returns the object in the form of hash
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_hash
298
+ hash = {}
299
+ # include attributes inherited from allOf parents (the nearest declaration wins)
300
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
301
+ value = self.send(attr)
302
+ if value.nil?
303
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
304
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
305
+ end
306
+
307
+ hash[param] = _to_hash(value)
308
+ end
309
+ hash
310
+ end
311
+
312
+ end
313
+
314
+ end
@@ -0,0 +1,104 @@
1
+ =begin
2
+ #Appnigma SDK API
3
+
4
+ #The routes a customer's product calls through an Appnigma SDK. Every answer carries a request id in X-Request-Id; quote it when you write to support.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Appnigma::Generated
17
+ # Sent as JSON: an object or a list. Must be left out on a GET.
18
+ module PlatformRequestInputBody
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Array<JsonValue>',
24
+ :'Hash<String, JsonValue>'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
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_any_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_any_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 = Appnigma::Generated.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_any_of) # nested anyOf 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,221 @@
1
+ =begin
2
+ #Appnigma SDK API
3
+
4
+ #The routes a customer's product calls through an Appnigma SDK. Every answer carries a request id in X-Request-Id; quote it when you write to support.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Appnigma::Generated
17
+ # The platform's answer as it gave it, refusals included: check status.
18
+ class PlatformRequestOutput < ApiModelBase
19
+ # The platform's HTTP status
20
+ attr_accessor :status
21
+
22
+ # Content type, paging and rate limit headers, when the platform sent them
23
+ attr_accessor :headers
24
+
25
+ # JSON when the platform answered JSON, text otherwise, null when empty
26
+ attr_accessor :body
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'status' => :'status',
32
+ :'headers' => :'headers',
33
+ :'body' => :'body'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'status' => :'Integer',
51
+ :'headers' => :'Hash<String, String>',
52
+ :'body' => :'JsonValue'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ :'body'
60
+ ])
61
+ end
62
+
63
+ # Returns attribute type mapping
64
+ def self.acceptable_openapi_types
65
+ openapi_types
66
+ end
67
+
68
+ # Returns the nullable attributes
69
+ def self.acceptable_openapi_nullable
70
+ openapi_nullable
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Appnigma::Generated::PlatformRequestOutput` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ acceptable_attribute_map = self.class.acceptable_attribute_map
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!acceptable_attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Appnigma::Generated::PlatformRequestOutput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'status')
90
+ self.status = attributes[:'status']
91
+ else
92
+ self.status = nil
93
+ end
94
+
95
+ if attributes.key?(:'headers')
96
+ if (value = attributes[:'headers']).is_a?(Hash)
97
+ self.headers = value
98
+ end
99
+ else
100
+ self.headers = nil
101
+ end
102
+
103
+ if attributes.key?(:'body')
104
+ self.body = attributes[:'body']
105
+ else
106
+ self.body = nil
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
114
+ invalid_properties = Array.new
115
+ if @status.nil?
116
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
117
+ end
118
+
119
+ if @headers.nil?
120
+ invalid_properties.push('invalid value for "headers", headers cannot be nil.')
121
+ end
122
+
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ warn '[DEPRECATED] the `valid?` method is obsolete'
130
+ return false if @status.nil?
131
+ return false if @headers.nil?
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] status Value to be assigned
137
+ def status=(status)
138
+ if status.nil?
139
+ fail ArgumentError, 'status cannot be nil'
140
+ end
141
+
142
+ @status = status
143
+ end
144
+
145
+ # Custom attribute writer method with validation
146
+ # @param [Object] headers Value to be assigned
147
+ def headers=(headers)
148
+ if headers.nil?
149
+ fail ArgumentError, 'headers cannot be nil'
150
+ end
151
+
152
+ @headers = headers
153
+ end
154
+
155
+ # Checks equality by comparing each attribute.
156
+ # @param [Object] Object to be compared
157
+ def ==(o)
158
+ return true if self.equal?(o)
159
+ self.class == o.class &&
160
+ status == o.status &&
161
+ headers == o.headers &&
162
+ body == o.body
163
+ end
164
+
165
+ # @see the `==` method
166
+ # @param [Object] Object to be compared
167
+ def eql?(o)
168
+ self == o
169
+ end
170
+
171
+ # Calculates hash code according to all attributes.
172
+ # @return [Integer] Hash code
173
+ def hash
174
+ [status, headers, body].hash
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def self.build_from_hash(attributes)
181
+ return nil unless attributes.is_a?(Hash)
182
+ attributes = attributes.transform_keys(&:to_sym)
183
+ # include attributes inherited from allOf parents (the nearest declaration wins)
184
+ map = acceptable_attribute_map
185
+ transformed_hash = {}
186
+ acceptable_openapi_types.each_pair do |key, type|
187
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
188
+ transformed_hash["#{key}"] = nil
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[map[key]].is_a?(Array)
193
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
194
+ end
195
+ elsif !attributes[map[key]].nil?
196
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
197
+ end
198
+ end
199
+ new(transformed_hash)
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ # include attributes inherited from allOf parents (the nearest declaration wins)
207
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ end
220
+
221
+ end