hubspot-api-client 16.2.1 → 16.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +33 -1
  5. data/lib/hubspot/codegen/crm/associations/v4/api/batch_api.rb +428 -0
  6. data/lib/hubspot/codegen/crm/associations/v4/api/definitions_api.rb +332 -0
  7. data/lib/hubspot/codegen/crm/associations/v4/api_client.rb +412 -0
  8. data/lib/hubspot/codegen/crm/associations/v4/api_error.rb +63 -0
  9. data/lib/hubspot/codegen/crm/associations/v4/configuration.rb +296 -0
  10. data/lib/hubspot/codegen/crm/associations/v4/models/association_spec.rb +278 -0
  11. data/lib/hubspot/codegen/crm/associations/v4/models/association_spec_with_label.rb +287 -0
  12. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_association_multi_archive.rb +232 -0
  13. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_association_multi_post.rb +232 -0
  14. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_default_association_multi_post.rb +232 -0
  15. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_fetch_associations_batch_request.rb +232 -0
  16. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_labels_between_object_pair.rb +328 -0
  17. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_labels_between_object_pair_with_errors.rb +348 -0
  18. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_public_association_multi_with_label.rb +328 -0
  19. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_public_association_multi_with_label_with_errors.rb +348 -0
  20. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_public_default_association.rb +348 -0
  21. data/lib/hubspot/codegen/crm/associations/v4/models/collection_response_association_spec_with_label_no_paging.rb +232 -0
  22. data/lib/hubspot/codegen/crm/associations/v4/models/error.rb +307 -0
  23. data/lib/hubspot/codegen/crm/associations/v4/models/error_category.rb +278 -0
  24. data/lib/hubspot/codegen/crm/associations/v4/models/error_detail.rb +273 -0
  25. data/lib/hubspot/codegen/crm/associations/v4/models/labels_between_object_pair.rb +288 -0
  26. data/lib/hubspot/codegen/crm/associations/v4/models/multi_associated_object_with_label.rb +246 -0
  27. data/lib/hubspot/codegen/crm/associations/v4/models/next_page.rb +239 -0
  28. data/lib/hubspot/codegen/crm/associations/v4/models/paging.rb +234 -0
  29. data/lib/hubspot/codegen/crm/associations/v4/models/previous_page.rb +239 -0
  30. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_definition_create_request.rb +244 -0
  31. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_definition_update_request.rb +244 -0
  32. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_multi_archive.rb +246 -0
  33. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_multi_post.rb +260 -0
  34. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_multi_with_label.rb +255 -0
  35. data/lib/hubspot/codegen/crm/associations/v4/models/public_default_association.rb +258 -0
  36. data/lib/hubspot/codegen/crm/associations/v4/models/public_default_association_multi_post.rb +244 -0
  37. data/lib/hubspot/codegen/crm/associations/v4/models/public_fetch_associations_batch_request.rb +239 -0
  38. data/lib/hubspot/codegen/crm/associations/v4/models/public_object_id.rb +230 -0
  39. data/lib/hubspot/codegen/crm/associations/v4/models/standard_error.rb +324 -0
  40. data/lib/hubspot/codegen/crm/properties/models/property.rb +14 -4
  41. data/lib/hubspot/codegen/crm/properties/models/property_create.rb +38 -8
  42. data/lib/hubspot/codegen/crm/properties/models/property_update.rb +18 -8
  43. data/lib/hubspot/codegen/oauth/api/access_tokens_api.rb +0 -2
  44. data/lib/hubspot/codegen/oauth/api/refresh_tokens_api.rb +5 -7
  45. data/lib/hubspot/codegen/oauth/api/tokens_api.rb +0 -2
  46. data/lib/hubspot/codegen/oauth/api_client.rb +0 -2
  47. data/lib/hubspot/codegen/oauth/api_error.rb +0 -2
  48. data/lib/hubspot/codegen/oauth/configuration.rb +0 -2
  49. data/lib/hubspot/codegen/oauth/models/access_token_info_response.rb +0 -2
  50. data/lib/hubspot/codegen/oauth/models/error.rb +0 -2
  51. data/lib/hubspot/codegen/oauth/models/error_detail.rb +0 -2
  52. data/lib/hubspot/codegen/oauth/models/refresh_token_info_response.rb +0 -2
  53. data/lib/hubspot/codegen/oauth/models/token_response_if.rb +31 -33
  54. data/lib/hubspot/discovery/crm/associations/client.rb +3 -1
  55. data/lib/hubspot/discovery/crm/associations/v4/api/batch_api.rb +15 -0
  56. data/lib/hubspot/discovery/crm/associations/v4/api/definitions_api.rb +15 -0
  57. data/lib/hubspot/discovery/crm/associations/v4/client.rb +21 -0
  58. data/lib/hubspot/helpers/get_all_helper.rb +2 -1
  59. data/lib/hubspot/version.rb +1 -1
  60. data/spec/discovery/cms/blogs/client_spec.rb +9 -0
  61. data/spec/discovery/cms/client_spec.rb +13 -0
  62. data/spec/discovery/crm/associations/client_spec.rb +7 -0
  63. data/spec/discovery/crm/associations/v4/batch_api_spec.rb +11 -0
  64. data/spec/discovery/crm/associations/v4/definitions_api_spec.rb +10 -0
  65. data/spec/discovery/crm/client_spec.rb +21 -0
  66. data/spec/discovery/crm/extensions/client_spec.rb +11 -0
  67. data/spec/discovery/crm/objects/client_spec.rb +13 -0
  68. data/spec/discovery/marketing/client_spec.rb +9 -0
  69. metadata +58 -2
@@ -0,0 +1,307 @@
1
+ =begin
2
+ #CrmPublicAssociationsServiceV4
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v4
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Crm
18
+ module Associations
19
+ module V4
20
+ class Error
21
+ # A human readable message describing the error along with remediation steps where appropriate
22
+ attr_accessor :message
23
+
24
+ # A unique identifier for the request. Include this value with any error reports or support tickets
25
+ attr_accessor :correlation_id
26
+
27
+ # The error category
28
+ attr_accessor :category
29
+
30
+ # A specific category that contains more specific detail about the error
31
+ attr_accessor :sub_category
32
+
33
+ # further information about the error
34
+ attr_accessor :errors
35
+
36
+ # Context about the error condition
37
+ attr_accessor :context
38
+
39
+ # A map of link names to associated URIs containing documentation about the error or recommended remediation steps
40
+ attr_accessor :links
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'message' => :'message',
46
+ :'correlation_id' => :'correlationId',
47
+ :'category' => :'category',
48
+ :'sub_category' => :'subCategory',
49
+ :'errors' => :'errors',
50
+ :'context' => :'context',
51
+ :'links' => :'links'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'message' => :'String',
64
+ :'correlation_id' => :'String',
65
+ :'category' => :'String',
66
+ :'sub_category' => :'String',
67
+ :'errors' => :'Array<ErrorDetail>',
68
+ :'context' => :'Hash<String, Array<String>>',
69
+ :'links' => :'Hash<String, String>'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Associations::V4::Error` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Associations::V4::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'message')
95
+ self.message = attributes[:'message']
96
+ end
97
+
98
+ if attributes.key?(:'correlation_id')
99
+ self.correlation_id = attributes[:'correlation_id']
100
+ end
101
+
102
+ if attributes.key?(:'category')
103
+ self.category = attributes[:'category']
104
+ end
105
+
106
+ if attributes.key?(:'sub_category')
107
+ self.sub_category = attributes[:'sub_category']
108
+ end
109
+
110
+ if attributes.key?(:'errors')
111
+ if (value = attributes[:'errors']).is_a?(Array)
112
+ self.errors = value
113
+ end
114
+ end
115
+
116
+ if attributes.key?(:'context')
117
+ if (value = attributes[:'context']).is_a?(Hash)
118
+ self.context = value
119
+ end
120
+ end
121
+
122
+ if attributes.key?(:'links')
123
+ if (value = attributes[:'links']).is_a?(Hash)
124
+ self.links = value
125
+ end
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ if @message.nil?
134
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
135
+ end
136
+
137
+ if @correlation_id.nil?
138
+ invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.')
139
+ end
140
+
141
+ if @category.nil?
142
+ invalid_properties.push('invalid value for "category", category cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ return false if @message.nil?
152
+ return false if @correlation_id.nil?
153
+ return false if @category.nil?
154
+ true
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ message == o.message &&
163
+ correlation_id == o.correlation_id &&
164
+ category == o.category &&
165
+ sub_category == o.sub_category &&
166
+ errors == o.errors &&
167
+ context == o.context &&
168
+ links == o.links
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [message, correlation_id, category, sub_category, errors, context, links].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ self.class.openapi_types.each_pair do |key, type|
197
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
198
+ self.send("#{key}=", nil)
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :Time
220
+ Time.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :Boolean
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ # models (e.g. Pet) or oneOf
251
+ klass = Hubspot::Crm::Associations::V4.const_get(type)
252
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+
302
+ end
303
+
304
+ end
305
+ end
306
+ end
307
+ end
@@ -0,0 +1,278 @@
1
+ =begin
2
+ #CrmPublicAssociationsServiceV4
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v4
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Crm
18
+ module Associations
19
+ module V4
20
+ class ErrorCategory
21
+ attr_accessor :name
22
+
23
+ attr_accessor :http_status
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'name' => :'name',
51
+ :'http_status' => :'httpStatus'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'name' => :'String',
64
+ :'http_status' => :'String'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Associations::V4::ErrorCategory` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!self.class.attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Associations::V4::ErrorCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'name')
90
+ self.name = attributes[:'name']
91
+ end
92
+
93
+ if attributes.key?(:'http_status')
94
+ self.http_status = attributes[:'http_status']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ if @name.nil?
103
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
104
+ end
105
+
106
+ if @http_status.nil?
107
+ invalid_properties.push('invalid value for "http_status", http_status cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ return false if @name.nil?
117
+ return false if @http_status.nil?
118
+ http_status_validator = EnumAttributeValidator.new('String', ["CONTINUE", "SWITCHING_PROTOCOLS", "PROCESSING", "OK", "CREATED", "ACCEPTED", "NON_AUTHORITATIVE_INFORMATION", "NO_CONTENT", "RESET_CONTENT", "PARTIAL_CONTENT", "MULTI_STATUS", "ALREADY_REPORTED", "IM_USED", "MULTIPLE_CHOICES", "MOVED_PERMANENTLY", "FOUND", "SEE_OTHER", "NOT_MODIFIED", "USE_PROXY", "TEMPORARY_REDIRECT", "PERMANENT_REDIRECT", "BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "PROXY_AUTHENTICATION_REQUIRED", "REQUEST_TIMEOUT", "CONFLICT", "GONE", "LENGTH_REQUIRED", "PRECONDITION_FAILED", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_URI_TOO_LONG", "UNSUPPORTED_MEDIA_TYPE", "REQUESTED_RANGE_NOT_SATISFIABLE", "EXPECTATION_FAILED", "IM_A_TEAPOT", "MISDIRECTED_REQUEST", "UNPROCESSABLE_ENTITY", "LOCKED", "FAILED_DEPENDENCY", "UPGRADE_REQUIRED", "PRECONDITION_REQUIRED", "TOO_MANY_REQUESTS", "REQUEST_HEADERS_FIELDS_TOO_LARGE", "INTERNAL_STALE_SERVICE_DISCOVERY", "UNAVAILABLE_FOR_LEGAL_REASONS", "MIGRATION_IN_PROGRESS", "INTERNAL_SERVER_ERROR", "NOT_IMPLEMENTED", "BAD_GATEWAY", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT", "HTTP_VERSION_NOT_SUPPORTED", "VARIANT_ALSO_NEGOTIATES", "INSUFFICIENT_STORAGE", "LOOP_DETECTED", "NOT_EXTENDED", "NETWORK_AUTHENTICATION_REQUIRED"])
119
+ return false unless http_status_validator.valid?(@http_status)
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method checking allowed values (enum).
124
+ # @param [Object] http_status Object to be assigned
125
+ def http_status=(http_status)
126
+ validator = EnumAttributeValidator.new('String', ["CONTINUE", "SWITCHING_PROTOCOLS", "PROCESSING", "OK", "CREATED", "ACCEPTED", "NON_AUTHORITATIVE_INFORMATION", "NO_CONTENT", "RESET_CONTENT", "PARTIAL_CONTENT", "MULTI_STATUS", "ALREADY_REPORTED", "IM_USED", "MULTIPLE_CHOICES", "MOVED_PERMANENTLY", "FOUND", "SEE_OTHER", "NOT_MODIFIED", "USE_PROXY", "TEMPORARY_REDIRECT", "PERMANENT_REDIRECT", "BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "PROXY_AUTHENTICATION_REQUIRED", "REQUEST_TIMEOUT", "CONFLICT", "GONE", "LENGTH_REQUIRED", "PRECONDITION_FAILED", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_URI_TOO_LONG", "UNSUPPORTED_MEDIA_TYPE", "REQUESTED_RANGE_NOT_SATISFIABLE", "EXPECTATION_FAILED", "IM_A_TEAPOT", "MISDIRECTED_REQUEST", "UNPROCESSABLE_ENTITY", "LOCKED", "FAILED_DEPENDENCY", "UPGRADE_REQUIRED", "PRECONDITION_REQUIRED", "TOO_MANY_REQUESTS", "REQUEST_HEADERS_FIELDS_TOO_LARGE", "INTERNAL_STALE_SERVICE_DISCOVERY", "UNAVAILABLE_FOR_LEGAL_REASONS", "MIGRATION_IN_PROGRESS", "INTERNAL_SERVER_ERROR", "NOT_IMPLEMENTED", "BAD_GATEWAY", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT", "HTTP_VERSION_NOT_SUPPORTED", "VARIANT_ALSO_NEGOTIATES", "INSUFFICIENT_STORAGE", "LOOP_DETECTED", "NOT_EXTENDED", "NETWORK_AUTHENTICATION_REQUIRED"])
127
+ unless validator.valid?(http_status)
128
+ fail ArgumentError, "invalid value for \"http_status\", must be one of #{validator.allowable_values}."
129
+ end
130
+ @http_status = http_status
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(o)
136
+ return true if self.equal?(o)
137
+ self.class == o.class &&
138
+ name == o.name &&
139
+ http_status == o.http_status
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Integer] Hash code
150
+ def hash
151
+ [name, http_status].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ new.build_from_hash(attributes)
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ self.class.openapi_types.each_pair do |key, type|
168
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = Hubspot::Crm::Associations::V4.const_get(type)
223
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
276
+ end
277
+ end
278
+ end