carbon_ruby_sdk 0.2.35 → 0.2.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  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/data_source_type.rb +2 -1
  20. data/lib/carbon_ruby_sdk/models/data_source_type_nullable.rb +2 -1
  21. data/lib/carbon_ruby_sdk/models/email.rb +230 -0
  22. data/lib/carbon_ruby_sdk/models/event.rb +370 -0
  23. data/lib/carbon_ruby_sdk/models/file_formats.rb +2 -1
  24. data/lib/carbon_ruby_sdk/models/file_formats_nullable.rb +2 -1
  25. data/lib/carbon_ruby_sdk/models/lead.rb +468 -0
  26. data/lib/carbon_ruby_sdk/models/lead_filters.rb +246 -0
  27. data/lib/carbon_ruby_sdk/models/leads_order_by.rb +38 -0
  28. data/lib/carbon_ruby_sdk/models/leads_order_by_nullable.rb +38 -0
  29. data/lib/carbon_ruby_sdk/models/leads_request.rb +293 -0
  30. data/lib/carbon_ruby_sdk/models/leads_response.rb +246 -0
  31. data/lib/carbon_ruby_sdk/models/opportunities_order_by.rb +40 -0
  32. data/lib/carbon_ruby_sdk/models/opportunities_order_by_nullable.rb +40 -0
  33. data/lib/carbon_ruby_sdk/models/opportunities_request.rb +293 -0
  34. data/lib/carbon_ruby_sdk/models/opportunities_response.rb +246 -0
  35. data/lib/carbon_ruby_sdk/models/opportunity.rb +400 -0
  36. data/lib/carbon_ruby_sdk/models/opportunity_filters.rb +246 -0
  37. data/lib/carbon_ruby_sdk/models/opportunity_status.rb +36 -0
  38. data/lib/carbon_ruby_sdk/models/opportunity_status_nullable.rb +36 -0
  39. data/lib/carbon_ruby_sdk/models/order_dir_v2_nullable.rb +36 -0
  40. data/lib/carbon_ruby_sdk/models/partial_account.rb +216 -0
  41. data/lib/carbon_ruby_sdk/models/partial_account_nullable.rb +216 -0
  42. data/lib/carbon_ruby_sdk/models/partial_contact.rb +216 -0
  43. data/lib/carbon_ruby_sdk/models/partial_contact_nullable.rb +216 -0
  44. data/lib/carbon_ruby_sdk/models/partial_owner.rb +216 -0
  45. data/lib/carbon_ruby_sdk/models/partial_owner_nullable.rb +216 -0
  46. data/lib/carbon_ruby_sdk/models/phone_number.rb +230 -0
  47. data/lib/carbon_ruby_sdk/models/sent_webhook_payload.rb +2 -2
  48. data/lib/carbon_ruby_sdk/models/task.rb +346 -0
  49. data/lib/carbon_ruby_sdk/version.rb +1 -1
  50. data/lib/carbon_ruby_sdk.rb +42 -0
  51. data/spec/api/crm_api_spec.rb +129 -0
  52. data/spec/models/account_filters_spec.rb +34 -0
  53. data/spec/models/account_response_spec.rb +40 -0
  54. data/spec/models/account_spec.rb +118 -0
  55. data/spec/models/accounts_order_by_nullable_spec.rb +22 -0
  56. data/spec/models/accounts_order_by_spec.rb +22 -0
  57. data/spec/models/accounts_request_spec.rb +70 -0
  58. data/spec/models/address_spec.rb +64 -0
  59. data/spec/models/base_includes_spec.rb +22 -0
  60. data/spec/models/contact_filters_spec.rb +40 -0
  61. data/spec/models/contact_spec.rb +136 -0
  62. data/spec/models/contacts_order_by_nullable_spec.rb +22 -0
  63. data/spec/models/contacts_order_by_spec.rb +22 -0
  64. data/spec/models/contacts_request_spec.rb +70 -0
  65. data/spec/models/contacts_response_spec.rb +40 -0
  66. data/spec/models/email_spec.rb +34 -0
  67. data/spec/models/event_spec.rb +106 -0
  68. data/spec/models/lead_filters_spec.rb +46 -0
  69. data/spec/models/lead_spec.rb +154 -0
  70. data/spec/models/leads_order_by_nullable_spec.rb +22 -0
  71. data/spec/models/leads_order_by_spec.rb +22 -0
  72. data/spec/models/leads_request_spec.rb +70 -0
  73. data/spec/models/leads_response_spec.rb +40 -0
  74. data/spec/models/opportunities_order_by_nullable_spec.rb +22 -0
  75. data/spec/models/opportunities_order_by_spec.rb +22 -0
  76. data/spec/models/opportunities_request_spec.rb +70 -0
  77. data/spec/models/opportunities_response_spec.rb +40 -0
  78. data/spec/models/opportunity_filters_spec.rb +46 -0
  79. data/spec/models/opportunity_spec.rb +124 -0
  80. data/spec/models/opportunity_status_nullable_spec.rb +22 -0
  81. data/spec/models/opportunity_status_spec.rb +22 -0
  82. data/spec/models/order_dir_v2_nullable_spec.rb +22 -0
  83. data/spec/models/partial_account_nullable_spec.rb +28 -0
  84. data/spec/models/partial_account_spec.rb +28 -0
  85. data/spec/models/partial_contact_nullable_spec.rb +28 -0
  86. data/spec/models/partial_contact_spec.rb +28 -0
  87. data/spec/models/partial_owner_nullable_spec.rb +28 -0
  88. data/spec/models/partial_owner_spec.rb +28 -0
  89. data/spec/models/phone_number_spec.rb +34 -0
  90. data/spec/models/sent_webhook_payload_spec.rb +1 -1
  91. data/spec/models/task_spec.rb +94 -0
  92. metadata +122 -2
@@ -0,0 +1,38 @@
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 LeadsOrderBy
14
+ CREATED_AT = "created_at".freeze
15
+ UPDATED_AT = "updated_at".freeze
16
+ NAME = "name".freeze
17
+ LAST_ACTIVITY_AT = "last_activity_at".freeze
18
+
19
+ def self.all_vars
20
+ @all_vars ||= [CREATED_AT, UPDATED_AT, NAME, LAST_ACTIVITY_AT].freeze
21
+ end
22
+
23
+ # Builds the enum from string
24
+ # @param [String] The enum value in the form of the string
25
+ # @return [String] The enum value
26
+ def self.build_from_hash(value)
27
+ new.build_from_hash(value)
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ return value if LeadsOrderBy.all_vars.include?(value)
35
+ raise "Invalid ENUM value #{value} for class #LeadsOrderBy"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
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 LeadsOrderByNullable
14
+ CREATED_AT = "created_at".freeze
15
+ UPDATED_AT = "updated_at".freeze
16
+ NAME = "name".freeze
17
+ LAST_ACTIVITY_AT = "last_activity_at".freeze
18
+
19
+ def self.all_vars
20
+ @all_vars ||= [CREATED_AT, UPDATED_AT, NAME, LAST_ACTIVITY_AT].freeze
21
+ end
22
+
23
+ # Builds the enum from string
24
+ # @param [String] The enum value in the form of the string
25
+ # @return [String] The enum value
26
+ def self.build_from_hash(value)
27
+ new.build_from_hash(value)
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ return value if LeadsOrderByNullable.all_vars.include?(value)
35
+ raise "Invalid ENUM value #{value} for class #LeadsOrderByNullable"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,293 @@
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 LeadsRequest
14
+ attr_accessor :data_source_id
15
+
16
+ attr_accessor :include_remote_data
17
+
18
+ attr_accessor :next_cursor
19
+
20
+ attr_accessor :page_size
21
+
22
+ attr_accessor :order_dir
23
+
24
+ attr_accessor :includes
25
+
26
+ attr_accessor :filters
27
+
28
+ attr_accessor :order_by
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'data_source_id' => :'data_source_id',
34
+ :'include_remote_data' => :'include_remote_data',
35
+ :'next_cursor' => :'next_cursor',
36
+ :'page_size' => :'page_size',
37
+ :'order_dir' => :'order_dir',
38
+ :'includes' => :'includes',
39
+ :'filters' => :'filters',
40
+ :'order_by' => :'order_by'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'data_source_id' => :'Integer',
53
+ :'include_remote_data' => :'Boolean',
54
+ :'next_cursor' => :'String',
55
+ :'page_size' => :'Integer',
56
+ :'order_dir' => :'OrderDirV2Nullable',
57
+ :'includes' => :'Array<BaseIncludes>',
58
+ :'filters' => :'LeadFilters',
59
+ :'order_by' => :'LeadsOrderByNullable'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ :'next_cursor',
67
+ :'page_size',
68
+ :'order_dir',
69
+ :'order_by'
70
+ ])
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 `Carbon::LeadsRequest` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::LeadsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'data_source_id')
89
+ self.data_source_id = attributes[:'data_source_id']
90
+ end
91
+
92
+ if attributes.key?(:'include_remote_data')
93
+ self.include_remote_data = attributes[:'include_remote_data']
94
+ else
95
+ self.include_remote_data = false
96
+ end
97
+
98
+ if attributes.key?(:'next_cursor')
99
+ self.next_cursor = attributes[:'next_cursor']
100
+ end
101
+
102
+ if attributes.key?(:'page_size')
103
+ self.page_size = attributes[:'page_size']
104
+ end
105
+
106
+ if attributes.key?(:'order_dir')
107
+ self.order_dir = attributes[:'order_dir']
108
+ else
109
+ self.order_dir = 'asc'
110
+ end
111
+
112
+ if attributes.key?(:'includes')
113
+ if (value = attributes[:'includes']).is_a?(Array)
114
+ self.includes = value
115
+ end
116
+ end
117
+
118
+ if attributes.key?(:'filters')
119
+ self.filters = attributes[:'filters']
120
+ end
121
+
122
+ if attributes.key?(:'order_by')
123
+ self.order_by = attributes[:'order_by']
124
+ end
125
+ end
126
+
127
+ # Show invalid properties with the reasons. Usually used together with valid?
128
+ # @return Array for valid properties with the reasons
129
+ def list_invalid_properties
130
+ invalid_properties = Array.new
131
+ if @data_source_id.nil?
132
+ invalid_properties.push('invalid value for "data_source_id", data_source_id cannot be nil.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return false if @data_source_id.nil?
142
+ true
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ data_source_id == o.data_source_id &&
151
+ include_remote_data == o.include_remote_data &&
152
+ next_cursor == o.next_cursor &&
153
+ page_size == o.page_size &&
154
+ order_dir == o.order_dir &&
155
+ includes == o.includes &&
156
+ filters == o.filters &&
157
+ order_by == o.order_by
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [data_source_id, include_remote_data, next_cursor, page_size, order_dir, includes, filters, order_by].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ new.build_from_hash(attributes)
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ self.class.openapi_types.each_pair do |key, type|
186
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
187
+ self.send("#{key}=", nil)
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
192
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
193
+ end
194
+ elsif !attributes[self.class.attribute_map[key]].nil?
195
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
196
+ end
197
+ end
198
+
199
+ self
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def _deserialize(type, value)
207
+ case type.to_sym
208
+ when :Time
209
+ Time.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :Boolean
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ # models (e.g. Pet) or oneOf
240
+ klass = Carbon.const_get(type)
241
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
242
+ end
243
+ end
244
+
245
+ # Returns the string representation of the object
246
+ # @return [String] String presentation of the object
247
+ def to_s
248
+ to_hash.to_s
249
+ end
250
+
251
+ # to_body is an alias to to_hash (backward compatibility)
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_body
254
+ to_hash
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = self.send(attr)
263
+ if value.nil?
264
+ is_nullable = self.class.openapi_nullable.include?(attr)
265
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
+ end
267
+
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+
291
+ end
292
+
293
+ end
@@ -0,0 +1,246 @@
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 LeadsResponse
14
+ attr_accessor :count
15
+
16
+ attr_accessor :next_cursor
17
+
18
+ attr_accessor :data
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'count' => :'count',
24
+ :'next_cursor' => :'next_cursor',
25
+ :'data' => :'data'
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
+ :'count' => :'Integer',
38
+ :'next_cursor' => :'String',
39
+ :'data' => :'Array<Lead>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ :'next_cursor',
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::LeadsResponse` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::LeadsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'count')
66
+ self.count = attributes[:'count']
67
+ end
68
+
69
+ if attributes.key?(:'next_cursor')
70
+ self.next_cursor = attributes[:'next_cursor']
71
+ end
72
+
73
+ if attributes.key?(:'data')
74
+ if (value = attributes[:'data']).is_a?(Array)
75
+ self.data = value
76
+ end
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
+ if @count.nil?
85
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
86
+ end
87
+
88
+ if @data.nil?
89
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return false if @count.nil?
99
+ return false if @data.nil?
100
+ true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ count == o.count &&
109
+ next_cursor == o.next_cursor &&
110
+ data == o.data
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [count, next_cursor, data].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ attributes = attributes.transform_keys(&:to_sym)
138
+ self.class.openapi_types.each_pair do |key, type|
139
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
140
+ self.send("#{key}=", nil)
141
+ elsif type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :Time
162
+ Time.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ # models (e.g. Pet) or oneOf
193
+ klass = Carbon.const_get(type)
194
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+
244
+ end
245
+
246
+ end
@@ -0,0 +1,40 @@
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 OpportunitiesOrderBy
14
+ CREATED_AT = "created_at".freeze
15
+ UPDATED_AT = "updated_at".freeze
16
+ AMOUNT = "amount".freeze
17
+ NAME = "name".freeze
18
+ LAST_ACTIVITY_AT = "last_activity_at".freeze
19
+ CLOSE_DATE = "close_date".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [CREATED_AT, UPDATED_AT, AMOUNT, NAME, LAST_ACTIVITY_AT, CLOSE_DATE].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if OpportunitiesOrderBy.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #OpportunitiesOrderBy"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
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 OpportunitiesOrderByNullable
14
+ CREATED_AT = "created_at".freeze
15
+ UPDATED_AT = "updated_at".freeze
16
+ AMOUNT = "amount".freeze
17
+ NAME = "name".freeze
18
+ LAST_ACTIVITY_AT = "last_activity_at".freeze
19
+ CLOSE_DATE = "close_date".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [CREATED_AT, UPDATED_AT, AMOUNT, NAME, LAST_ACTIVITY_AT, CLOSE_DATE].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if OpportunitiesOrderByNullable.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #OpportunitiesOrderByNullable"
38
+ end
39
+ end
40
+ end