carbon_ruby_sdk 0.2.35 → 0.2.36

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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +335 -2
  4. data/lib/carbon_ruby_sdk/api/crm_api.rb +909 -0
  5. data/lib/carbon_ruby_sdk/models/account.rb +398 -0
  6. data/lib/carbon_ruby_sdk/models/account_filters.rb +226 -0
  7. data/lib/carbon_ruby_sdk/models/account_response.rb +246 -0
  8. data/lib/carbon_ruby_sdk/models/accounts_order_by.rb +39 -0
  9. data/lib/carbon_ruby_sdk/models/accounts_order_by_nullable.rb +39 -0
  10. data/lib/carbon_ruby_sdk/models/accounts_request.rb +293 -0
  11. data/lib/carbon_ruby_sdk/models/address.rb +276 -0
  12. data/lib/carbon_ruby_sdk/models/base_includes.rb +36 -0
  13. data/lib/carbon_ruby_sdk/models/contact.rb +434 -0
  14. data/lib/carbon_ruby_sdk/models/contact_filters.rb +236 -0
  15. data/lib/carbon_ruby_sdk/models/contacts_order_by.rb +39 -0
  16. data/lib/carbon_ruby_sdk/models/contacts_order_by_nullable.rb +39 -0
  17. data/lib/carbon_ruby_sdk/models/contacts_request.rb +293 -0
  18. data/lib/carbon_ruby_sdk/models/contacts_response.rb +246 -0
  19. data/lib/carbon_ruby_sdk/models/email.rb +230 -0
  20. data/lib/carbon_ruby_sdk/models/event.rb +370 -0
  21. data/lib/carbon_ruby_sdk/models/lead.rb +468 -0
  22. data/lib/carbon_ruby_sdk/models/lead_filters.rb +246 -0
  23. data/lib/carbon_ruby_sdk/models/leads_order_by.rb +38 -0
  24. data/lib/carbon_ruby_sdk/models/leads_order_by_nullable.rb +38 -0
  25. data/lib/carbon_ruby_sdk/models/leads_request.rb +293 -0
  26. data/lib/carbon_ruby_sdk/models/leads_response.rb +246 -0
  27. data/lib/carbon_ruby_sdk/models/opportunities_order_by.rb +40 -0
  28. data/lib/carbon_ruby_sdk/models/opportunities_order_by_nullable.rb +40 -0
  29. data/lib/carbon_ruby_sdk/models/opportunities_request.rb +293 -0
  30. data/lib/carbon_ruby_sdk/models/opportunities_response.rb +246 -0
  31. data/lib/carbon_ruby_sdk/models/opportunity.rb +400 -0
  32. data/lib/carbon_ruby_sdk/models/opportunity_filters.rb +246 -0
  33. data/lib/carbon_ruby_sdk/models/opportunity_status.rb +36 -0
  34. data/lib/carbon_ruby_sdk/models/opportunity_status_nullable.rb +36 -0
  35. data/lib/carbon_ruby_sdk/models/order_dir_v2_nullable.rb +36 -0
  36. data/lib/carbon_ruby_sdk/models/partial_account.rb +216 -0
  37. data/lib/carbon_ruby_sdk/models/partial_account_nullable.rb +216 -0
  38. data/lib/carbon_ruby_sdk/models/partial_contact.rb +216 -0
  39. data/lib/carbon_ruby_sdk/models/partial_contact_nullable.rb +216 -0
  40. data/lib/carbon_ruby_sdk/models/partial_owner.rb +216 -0
  41. data/lib/carbon_ruby_sdk/models/partial_owner_nullable.rb +216 -0
  42. data/lib/carbon_ruby_sdk/models/phone_number.rb +230 -0
  43. data/lib/carbon_ruby_sdk/models/sent_webhook_payload.rb +2 -2
  44. data/lib/carbon_ruby_sdk/models/task.rb +346 -0
  45. data/lib/carbon_ruby_sdk/version.rb +1 -1
  46. data/lib/carbon_ruby_sdk.rb +42 -0
  47. data/spec/api/crm_api_spec.rb +129 -0
  48. data/spec/models/account_filters_spec.rb +34 -0
  49. data/spec/models/account_response_spec.rb +40 -0
  50. data/spec/models/account_spec.rb +118 -0
  51. data/spec/models/accounts_order_by_nullable_spec.rb +22 -0
  52. data/spec/models/accounts_order_by_spec.rb +22 -0
  53. data/spec/models/accounts_request_spec.rb +70 -0
  54. data/spec/models/address_spec.rb +64 -0
  55. data/spec/models/base_includes_spec.rb +22 -0
  56. data/spec/models/contact_filters_spec.rb +40 -0
  57. data/spec/models/contact_spec.rb +136 -0
  58. data/spec/models/contacts_order_by_nullable_spec.rb +22 -0
  59. data/spec/models/contacts_order_by_spec.rb +22 -0
  60. data/spec/models/contacts_request_spec.rb +70 -0
  61. data/spec/models/contacts_response_spec.rb +40 -0
  62. data/spec/models/email_spec.rb +34 -0
  63. data/spec/models/event_spec.rb +106 -0
  64. data/spec/models/lead_filters_spec.rb +46 -0
  65. data/spec/models/lead_spec.rb +154 -0
  66. data/spec/models/leads_order_by_nullable_spec.rb +22 -0
  67. data/spec/models/leads_order_by_spec.rb +22 -0
  68. data/spec/models/leads_request_spec.rb +70 -0
  69. data/spec/models/leads_response_spec.rb +40 -0
  70. data/spec/models/opportunities_order_by_nullable_spec.rb +22 -0
  71. data/spec/models/opportunities_order_by_spec.rb +22 -0
  72. data/spec/models/opportunities_request_spec.rb +70 -0
  73. data/spec/models/opportunities_response_spec.rb +40 -0
  74. data/spec/models/opportunity_filters_spec.rb +46 -0
  75. data/spec/models/opportunity_spec.rb +124 -0
  76. data/spec/models/opportunity_status_nullable_spec.rb +22 -0
  77. data/spec/models/opportunity_status_spec.rb +22 -0
  78. data/spec/models/order_dir_v2_nullable_spec.rb +22 -0
  79. data/spec/models/partial_account_nullable_spec.rb +28 -0
  80. data/spec/models/partial_account_spec.rb +28 -0
  81. data/spec/models/partial_contact_nullable_spec.rb +28 -0
  82. data/spec/models/partial_contact_spec.rb +28 -0
  83. data/spec/models/partial_owner_nullable_spec.rb +28 -0
  84. data/spec/models/partial_owner_spec.rb +28 -0
  85. data/spec/models/phone_number_spec.rb +34 -0
  86. data/spec/models/sent_webhook_payload_spec.rb +1 -1
  87. data/spec/models/task_spec.rb +94 -0
  88. metadata +122 -2
@@ -0,0 +1,434 @@
1
+ =begin
2
+ #Carbon
3
+
4
+ #Connect external data to LLMs, no matter the source.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Carbon
13
+ class Contact
14
+ attr_accessor :title
15
+
16
+ attr_accessor :description
17
+
18
+ attr_accessor :id
19
+
20
+ attr_accessor :owner
21
+
22
+ attr_accessor :first_name
23
+
24
+ attr_accessor :last_name
25
+
26
+ attr_accessor :name
27
+
28
+ attr_accessor :department
29
+
30
+ attr_accessor :addresses
31
+
32
+ attr_accessor :phone_numbers
33
+
34
+ attr_accessor :emails
35
+
36
+ attr_accessor :account
37
+
38
+ attr_accessor :last_activity_at
39
+
40
+ attr_accessor :created_at
41
+
42
+ attr_accessor :updated_at
43
+
44
+ attr_accessor :is_deleted
45
+
46
+ attr_accessor :tasks
47
+
48
+ attr_accessor :events
49
+
50
+ attr_accessor :remote_data
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'title' => :'title',
56
+ :'description' => :'description',
57
+ :'id' => :'id',
58
+ :'owner' => :'owner',
59
+ :'first_name' => :'first_name',
60
+ :'last_name' => :'last_name',
61
+ :'name' => :'name',
62
+ :'department' => :'department',
63
+ :'addresses' => :'addresses',
64
+ :'phone_numbers' => :'phone_numbers',
65
+ :'emails' => :'emails',
66
+ :'account' => :'account',
67
+ :'last_activity_at' => :'last_activity_at',
68
+ :'created_at' => :'created_at',
69
+ :'updated_at' => :'updated_at',
70
+ :'is_deleted' => :'is_deleted',
71
+ :'tasks' => :'tasks',
72
+ :'events' => :'events',
73
+ :'remote_data' => :'remote_data'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'title' => :'String',
86
+ :'description' => :'String',
87
+ :'id' => :'String',
88
+ :'owner' => :'PartialOwnerNullable',
89
+ :'first_name' => :'String',
90
+ :'last_name' => :'String',
91
+ :'name' => :'String',
92
+ :'department' => :'String',
93
+ :'addresses' => :'Array<Address>',
94
+ :'phone_numbers' => :'Array<PhoneNumber>',
95
+ :'emails' => :'Array<Email>',
96
+ :'account' => :'PartialAccountNullable',
97
+ :'last_activity_at' => :'String',
98
+ :'created_at' => :'String',
99
+ :'updated_at' => :'String',
100
+ :'is_deleted' => :'Boolean',
101
+ :'tasks' => :'Array<Task>',
102
+ :'events' => :'Array<Event>',
103
+ :'remote_data' => :'Object'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ :'title',
111
+ :'description',
112
+ :'owner',
113
+ :'first_name',
114
+ :'last_name',
115
+ :'name',
116
+ :'department',
117
+ :'account',
118
+ :'last_activity_at',
119
+ :'tasks',
120
+ :'events',
121
+ :'remote_data'
122
+ ])
123
+ end
124
+
125
+ # Initializes the object
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ def initialize(attributes = {})
128
+ if (!attributes.is_a?(Hash))
129
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::Contact` initialize method"
130
+ end
131
+
132
+ # check to see if the attribute exists and convert string to symbol for hash key
133
+ attributes = attributes.each_with_object({}) { |(k, v), h|
134
+ if (!self.class.attribute_map.key?(k.to_sym))
135
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::Contact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
136
+ end
137
+ h[k.to_sym] = v
138
+ }
139
+
140
+ if attributes.key?(:'title')
141
+ self.title = attributes[:'title']
142
+ end
143
+
144
+ if attributes.key?(:'description')
145
+ self.description = attributes[:'description']
146
+ end
147
+
148
+ if attributes.key?(:'id')
149
+ self.id = attributes[:'id']
150
+ end
151
+
152
+ if attributes.key?(:'owner')
153
+ self.owner = attributes[:'owner']
154
+ end
155
+
156
+ if attributes.key?(:'first_name')
157
+ self.first_name = attributes[:'first_name']
158
+ end
159
+
160
+ if attributes.key?(:'last_name')
161
+ self.last_name = attributes[:'last_name']
162
+ end
163
+
164
+ if attributes.key?(:'name')
165
+ self.name = attributes[:'name']
166
+ end
167
+
168
+ if attributes.key?(:'department')
169
+ self.department = attributes[:'department']
170
+ end
171
+
172
+ if attributes.key?(:'addresses')
173
+ if (value = attributes[:'addresses']).is_a?(Array)
174
+ self.addresses = value
175
+ end
176
+ end
177
+
178
+ if attributes.key?(:'phone_numbers')
179
+ if (value = attributes[:'phone_numbers']).is_a?(Array)
180
+ self.phone_numbers = value
181
+ end
182
+ end
183
+
184
+ if attributes.key?(:'emails')
185
+ if (value = attributes[:'emails']).is_a?(Array)
186
+ self.emails = value
187
+ end
188
+ end
189
+
190
+ if attributes.key?(:'account')
191
+ self.account = attributes[:'account']
192
+ end
193
+
194
+ if attributes.key?(:'last_activity_at')
195
+ self.last_activity_at = attributes[:'last_activity_at']
196
+ end
197
+
198
+ if attributes.key?(:'created_at')
199
+ self.created_at = attributes[:'created_at']
200
+ end
201
+
202
+ if attributes.key?(:'updated_at')
203
+ self.updated_at = attributes[:'updated_at']
204
+ end
205
+
206
+ if attributes.key?(:'is_deleted')
207
+ self.is_deleted = attributes[:'is_deleted']
208
+ end
209
+
210
+ if attributes.key?(:'tasks')
211
+ if (value = attributes[:'tasks']).is_a?(Array)
212
+ self.tasks = value
213
+ end
214
+ end
215
+
216
+ if attributes.key?(:'events')
217
+ if (value = attributes[:'events']).is_a?(Array)
218
+ self.events = value
219
+ end
220
+ end
221
+
222
+ if attributes.key?(:'remote_data')
223
+ self.remote_data = attributes[:'remote_data']
224
+ end
225
+ end
226
+
227
+ # Show invalid properties with the reasons. Usually used together with valid?
228
+ # @return Array for valid properties with the reasons
229
+ def list_invalid_properties
230
+ invalid_properties = Array.new
231
+ if @id.nil?
232
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
233
+ end
234
+
235
+ if @addresses.nil?
236
+ invalid_properties.push('invalid value for "addresses", addresses cannot be nil.')
237
+ end
238
+
239
+ if @phone_numbers.nil?
240
+ invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
241
+ end
242
+
243
+ if @emails.nil?
244
+ invalid_properties.push('invalid value for "emails", emails cannot be nil.')
245
+ end
246
+
247
+ if @created_at.nil?
248
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
249
+ end
250
+
251
+ if @updated_at.nil?
252
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
253
+ end
254
+
255
+ if @is_deleted.nil?
256
+ invalid_properties.push('invalid value for "is_deleted", is_deleted cannot be nil.')
257
+ end
258
+
259
+ invalid_properties
260
+ end
261
+
262
+ # Check to see if the all the properties in the model are valid
263
+ # @return true if the model is valid
264
+ def valid?
265
+ return false if @id.nil?
266
+ return false if @addresses.nil?
267
+ return false if @phone_numbers.nil?
268
+ return false if @emails.nil?
269
+ return false if @created_at.nil?
270
+ return false if @updated_at.nil?
271
+ return false if @is_deleted.nil?
272
+ true
273
+ end
274
+
275
+ # Checks equality by comparing each attribute.
276
+ # @param [Object] Object to be compared
277
+ def ==(o)
278
+ return true if self.equal?(o)
279
+ self.class == o.class &&
280
+ title == o.title &&
281
+ description == o.description &&
282
+ id == o.id &&
283
+ owner == o.owner &&
284
+ first_name == o.first_name &&
285
+ last_name == o.last_name &&
286
+ name == o.name &&
287
+ department == o.department &&
288
+ addresses == o.addresses &&
289
+ phone_numbers == o.phone_numbers &&
290
+ emails == o.emails &&
291
+ account == o.account &&
292
+ last_activity_at == o.last_activity_at &&
293
+ created_at == o.created_at &&
294
+ updated_at == o.updated_at &&
295
+ is_deleted == o.is_deleted &&
296
+ tasks == o.tasks &&
297
+ events == o.events &&
298
+ remote_data == o.remote_data
299
+ end
300
+
301
+ # @see the `==` method
302
+ # @param [Object] Object to be compared
303
+ def eql?(o)
304
+ self == o
305
+ end
306
+
307
+ # Calculates hash code according to all attributes.
308
+ # @return [Integer] Hash code
309
+ def hash
310
+ [title, description, id, owner, first_name, last_name, name, department, addresses, phone_numbers, emails, account, last_activity_at, created_at, updated_at, is_deleted, tasks, events, remote_data].hash
311
+ end
312
+
313
+ # Builds the object from hash
314
+ # @param [Hash] attributes Model attributes in the form of hash
315
+ # @return [Object] Returns the model itself
316
+ def self.build_from_hash(attributes)
317
+ new.build_from_hash(attributes)
318
+ end
319
+
320
+ # Builds the object from hash
321
+ # @param [Hash] attributes Model attributes in the form of hash
322
+ # @return [Object] Returns the model itself
323
+ def build_from_hash(attributes)
324
+ return nil unless attributes.is_a?(Hash)
325
+ attributes = attributes.transform_keys(&:to_sym)
326
+ self.class.openapi_types.each_pair do |key, type|
327
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
328
+ self.send("#{key}=", nil)
329
+ elsif type =~ /\AArray<(.*)>/i
330
+ # check to ensure the input is an array given that the attribute
331
+ # is documented as an array but the input is not
332
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
333
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
334
+ end
335
+ elsif !attributes[self.class.attribute_map[key]].nil?
336
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
337
+ end
338
+ end
339
+
340
+ self
341
+ end
342
+
343
+ # Deserializes the data based on type
344
+ # @param string type Data type
345
+ # @param string value Value to be deserialized
346
+ # @return [Object] Deserialized data
347
+ def _deserialize(type, value)
348
+ case type.to_sym
349
+ when :Time
350
+ Time.parse(value)
351
+ when :Date
352
+ Date.parse(value)
353
+ when :String
354
+ value.to_s
355
+ when :Integer
356
+ value.to_i
357
+ when :Float
358
+ value.to_f
359
+ when :Boolean
360
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
361
+ true
362
+ else
363
+ false
364
+ end
365
+ when :Object
366
+ # generic object (usually a Hash), return directly
367
+ value
368
+ when /\AArray<(?<inner_type>.+)>\z/
369
+ inner_type = Regexp.last_match[:inner_type]
370
+ value.map { |v| _deserialize(inner_type, v) }
371
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
372
+ k_type = Regexp.last_match[:k_type]
373
+ v_type = Regexp.last_match[:v_type]
374
+ {}.tap do |hash|
375
+ value.each do |k, v|
376
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
377
+ end
378
+ end
379
+ else # model
380
+ # models (e.g. Pet) or oneOf
381
+ klass = Carbon.const_get(type)
382
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
383
+ end
384
+ end
385
+
386
+ # Returns the string representation of the object
387
+ # @return [String] String presentation of the object
388
+ def to_s
389
+ to_hash.to_s
390
+ end
391
+
392
+ # to_body is an alias to to_hash (backward compatibility)
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_body
395
+ to_hash
396
+ end
397
+
398
+ # Returns the object in the form of hash
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_hash
401
+ hash = {}
402
+ self.class.attribute_map.each_pair do |attr, param|
403
+ value = self.send(attr)
404
+ if value.nil?
405
+ is_nullable = self.class.openapi_nullable.include?(attr)
406
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
407
+ end
408
+
409
+ hash[param] = _to_hash(value)
410
+ end
411
+ hash
412
+ end
413
+
414
+ # Outputs non-array value in the form of hash
415
+ # For object, use to_hash. Otherwise, just return the value
416
+ # @param [Object] value Any valid value
417
+ # @return [Hash] Returns the value in the form of hash
418
+ def _to_hash(value)
419
+ if value.is_a?(Array)
420
+ value.compact.map { |v| _to_hash(v) }
421
+ elsif value.is_a?(Hash)
422
+ {}.tap do |hash|
423
+ value.each { |k, v| hash[k] = _to_hash(v) }
424
+ end
425
+ elsif value.respond_to? :to_hash
426
+ value.to_hash
427
+ else
428
+ value
429
+ end
430
+ end
431
+
432
+ end
433
+
434
+ end
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #Carbon
3
+
4
+ #Connect external data to LLMs, no matter the source.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Carbon
13
+ class ContactFilters
14
+ attr_accessor :owner_id
15
+
16
+ attr_accessor :name
17
+
18
+ attr_accessor :account_id
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'owner_id' => :'owner_id',
24
+ :'name' => :'name',
25
+ :'account_id' => :'account_id'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'owner_id' => :'String',
38
+ :'name' => :'String',
39
+ :'account_id' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ :'owner_id',
47
+ :'name',
48
+ :'account_id'
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::ContactFilters` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::ContactFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'owner_id')
68
+ self.owner_id = attributes[:'owner_id']
69
+ end
70
+
71
+ if attributes.key?(:'name')
72
+ self.name = attributes[:'name']
73
+ end
74
+
75
+ if attributes.key?(:'account_id')
76
+ self.account_id = attributes[:'account_id']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ owner_id == o.owner_id &&
99
+ name == o.name &&
100
+ account_id == o.account_id
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [owner_id, name, account_id].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ new.build_from_hash(attributes)
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ attributes = attributes.transform_keys(&:to_sym)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
+ self.send("#{key}=", nil)
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ # models (e.g. Pet) or oneOf
183
+ klass = Carbon.const_get(type)
184
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -0,0 +1,39 @@
1
+ =begin
2
+ #Carbon
3
+
4
+ #Connect external data to LLMs, no matter the source.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Carbon
13
+ class ContactsOrderBy
14
+ CREATED_AT = "created_at".freeze
15
+ UPDATED_AT = "updated_at".freeze
16
+ TITLE = "title".freeze
17
+ NAME = "name".freeze
18
+ LAST_ACTIVITY_AT = "last_activity_at".freeze
19
+
20
+ def self.all_vars
21
+ @all_vars ||= [CREATED_AT, UPDATED_AT, TITLE, NAME, LAST_ACTIVITY_AT].freeze
22
+ end
23
+
24
+ # Builds the enum from string
25
+ # @param [String] The enum value in the form of the string
26
+ # @return [String] The enum value
27
+ def self.build_from_hash(value)
28
+ new.build_from_hash(value)
29
+ end
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def build_from_hash(value)
35
+ return value if ContactsOrderBy.all_vars.include?(value)
36
+ raise "Invalid ENUM value #{value} for class #ContactsOrderBy"
37
+ end
38
+ end
39
+ end