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,230 @@
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 Email
14
+ attr_accessor :email
15
+
16
+ attr_accessor :email_type
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'email' => :'email',
22
+ :'email_type' => :'email_type'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'email' => :'String',
35
+ :'email_type' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ :'email_type'
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::Email` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::Email`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'email')
62
+ self.email = attributes[:'email']
63
+ end
64
+
65
+ if attributes.key?(:'email_type')
66
+ self.email_type = attributes[:'email_type']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @email.nil?
75
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
76
+ end
77
+
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ return false if @email.nil?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ email == o.email &&
94
+ email_type == o.email_type
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [email, email_type].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ self.class.openapi_types.each_pair do |key, type|
123
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
124
+ self.send("#{key}=", nil)
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :Time
146
+ Time.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ # models (e.g. Pet) or oneOf
177
+ klass = Carbon.const_get(type)
178
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end
@@ -0,0 +1,370 @@
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 Event
14
+ attr_accessor :description
15
+
16
+ attr_accessor :id
17
+
18
+ attr_accessor :owner
19
+
20
+ attr_accessor :subject
21
+
22
+ attr_accessor :location
23
+
24
+ attr_accessor :is_all_day
25
+
26
+ attr_accessor :start_date
27
+
28
+ attr_accessor :end_date
29
+
30
+ attr_accessor :account
31
+
32
+ attr_accessor :contact
33
+
34
+ attr_accessor :created_at
35
+
36
+ attr_accessor :updated_at
37
+
38
+ attr_accessor :is_deleted
39
+
40
+ attr_accessor :remote_data
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'description' => :'description',
46
+ :'id' => :'id',
47
+ :'owner' => :'owner',
48
+ :'subject' => :'subject',
49
+ :'location' => :'location',
50
+ :'is_all_day' => :'is_all_day',
51
+ :'start_date' => :'start_date',
52
+ :'end_date' => :'end_date',
53
+ :'account' => :'account',
54
+ :'contact' => :'contact',
55
+ :'created_at' => :'created_at',
56
+ :'updated_at' => :'updated_at',
57
+ :'is_deleted' => :'is_deleted',
58
+ :'remote_data' => :'remote_data'
59
+ }
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'description' => :'String',
71
+ :'id' => :'String',
72
+ :'owner' => :'PartialOwner',
73
+ :'subject' => :'String',
74
+ :'location' => :'String',
75
+ :'is_all_day' => :'Boolean',
76
+ :'start_date' => :'String',
77
+ :'end_date' => :'String',
78
+ :'account' => :'PartialAccountNullable',
79
+ :'contact' => :'PartialContactNullable',
80
+ :'created_at' => :'String',
81
+ :'updated_at' => :'String',
82
+ :'is_deleted' => :'Boolean',
83
+ :'remote_data' => :'Object'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ :'description',
91
+ :'subject',
92
+ :'location',
93
+ :'start_date',
94
+ :'end_date',
95
+ :'account',
96
+ :'contact',
97
+ :'remote_data'
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::Event` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::Event`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'description')
117
+ self.description = attributes[:'description']
118
+ end
119
+
120
+ if attributes.key?(:'id')
121
+ self.id = attributes[:'id']
122
+ end
123
+
124
+ if attributes.key?(:'owner')
125
+ self.owner = attributes[:'owner']
126
+ end
127
+
128
+ if attributes.key?(:'subject')
129
+ self.subject = attributes[:'subject']
130
+ end
131
+
132
+ if attributes.key?(:'location')
133
+ self.location = attributes[:'location']
134
+ end
135
+
136
+ if attributes.key?(:'is_all_day')
137
+ self.is_all_day = attributes[:'is_all_day']
138
+ end
139
+
140
+ if attributes.key?(:'start_date')
141
+ self.start_date = attributes[:'start_date']
142
+ end
143
+
144
+ if attributes.key?(:'end_date')
145
+ self.end_date = attributes[:'end_date']
146
+ end
147
+
148
+ if attributes.key?(:'account')
149
+ self.account = attributes[:'account']
150
+ end
151
+
152
+ if attributes.key?(:'contact')
153
+ self.contact = attributes[:'contact']
154
+ end
155
+
156
+ if attributes.key?(:'created_at')
157
+ self.created_at = attributes[:'created_at']
158
+ end
159
+
160
+ if attributes.key?(:'updated_at')
161
+ self.updated_at = attributes[:'updated_at']
162
+ end
163
+
164
+ if attributes.key?(:'is_deleted')
165
+ self.is_deleted = attributes[:'is_deleted']
166
+ end
167
+
168
+ if attributes.key?(:'remote_data')
169
+ self.remote_data = attributes[:'remote_data']
170
+ end
171
+ end
172
+
173
+ # Show invalid properties with the reasons. Usually used together with valid?
174
+ # @return Array for valid properties with the reasons
175
+ def list_invalid_properties
176
+ invalid_properties = Array.new
177
+ if @id.nil?
178
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
179
+ end
180
+
181
+ if @owner.nil?
182
+ invalid_properties.push('invalid value for "owner", owner cannot be nil.')
183
+ end
184
+
185
+ if @is_all_day.nil?
186
+ invalid_properties.push('invalid value for "is_all_day", is_all_day cannot be nil.')
187
+ end
188
+
189
+ if @created_at.nil?
190
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
191
+ end
192
+
193
+ if @updated_at.nil?
194
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
195
+ end
196
+
197
+ if @is_deleted.nil?
198
+ invalid_properties.push('invalid value for "is_deleted", is_deleted cannot be nil.')
199
+ end
200
+
201
+ invalid_properties
202
+ end
203
+
204
+ # Check to see if the all the properties in the model are valid
205
+ # @return true if the model is valid
206
+ def valid?
207
+ return false if @id.nil?
208
+ return false if @owner.nil?
209
+ return false if @is_all_day.nil?
210
+ return false if @created_at.nil?
211
+ return false if @updated_at.nil?
212
+ return false if @is_deleted.nil?
213
+ true
214
+ end
215
+
216
+ # Checks equality by comparing each attribute.
217
+ # @param [Object] Object to be compared
218
+ def ==(o)
219
+ return true if self.equal?(o)
220
+ self.class == o.class &&
221
+ description == o.description &&
222
+ id == o.id &&
223
+ owner == o.owner &&
224
+ subject == o.subject &&
225
+ location == o.location &&
226
+ is_all_day == o.is_all_day &&
227
+ start_date == o.start_date &&
228
+ end_date == o.end_date &&
229
+ account == o.account &&
230
+ contact == o.contact &&
231
+ created_at == o.created_at &&
232
+ updated_at == o.updated_at &&
233
+ is_deleted == o.is_deleted &&
234
+ remote_data == o.remote_data
235
+ end
236
+
237
+ # @see the `==` method
238
+ # @param [Object] Object to be compared
239
+ def eql?(o)
240
+ self == o
241
+ end
242
+
243
+ # Calculates hash code according to all attributes.
244
+ # @return [Integer] Hash code
245
+ def hash
246
+ [description, id, owner, subject, location, is_all_day, start_date, end_date, account, contact, created_at, updated_at, is_deleted, remote_data].hash
247
+ end
248
+
249
+ # Builds the object from hash
250
+ # @param [Hash] attributes Model attributes in the form of hash
251
+ # @return [Object] Returns the model itself
252
+ def self.build_from_hash(attributes)
253
+ new.build_from_hash(attributes)
254
+ end
255
+
256
+ # Builds the object from hash
257
+ # @param [Hash] attributes Model attributes in the form of hash
258
+ # @return [Object] Returns the model itself
259
+ def build_from_hash(attributes)
260
+ return nil unless attributes.is_a?(Hash)
261
+ attributes = attributes.transform_keys(&:to_sym)
262
+ self.class.openapi_types.each_pair do |key, type|
263
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
264
+ self.send("#{key}=", nil)
265
+ elsif type =~ /\AArray<(.*)>/i
266
+ # check to ensure the input is an array given that the attribute
267
+ # is documented as an array but the input is not
268
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
269
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
270
+ end
271
+ elsif !attributes[self.class.attribute_map[key]].nil?
272
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
273
+ end
274
+ end
275
+
276
+ self
277
+ end
278
+
279
+ # Deserializes the data based on type
280
+ # @param string type Data type
281
+ # @param string value Value to be deserialized
282
+ # @return [Object] Deserialized data
283
+ def _deserialize(type, value)
284
+ case type.to_sym
285
+ when :Time
286
+ Time.parse(value)
287
+ when :Date
288
+ Date.parse(value)
289
+ when :String
290
+ value.to_s
291
+ when :Integer
292
+ value.to_i
293
+ when :Float
294
+ value.to_f
295
+ when :Boolean
296
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
297
+ true
298
+ else
299
+ false
300
+ end
301
+ when :Object
302
+ # generic object (usually a Hash), return directly
303
+ value
304
+ when /\AArray<(?<inner_type>.+)>\z/
305
+ inner_type = Regexp.last_match[:inner_type]
306
+ value.map { |v| _deserialize(inner_type, v) }
307
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
308
+ k_type = Regexp.last_match[:k_type]
309
+ v_type = Regexp.last_match[:v_type]
310
+ {}.tap do |hash|
311
+ value.each do |k, v|
312
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
313
+ end
314
+ end
315
+ else # model
316
+ # models (e.g. Pet) or oneOf
317
+ klass = Carbon.const_get(type)
318
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
319
+ end
320
+ end
321
+
322
+ # Returns the string representation of the object
323
+ # @return [String] String presentation of the object
324
+ def to_s
325
+ to_hash.to_s
326
+ end
327
+
328
+ # to_body is an alias to to_hash (backward compatibility)
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_body
331
+ to_hash
332
+ end
333
+
334
+ # Returns the object in the form of hash
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_hash
337
+ hash = {}
338
+ self.class.attribute_map.each_pair do |attr, param|
339
+ value = self.send(attr)
340
+ if value.nil?
341
+ is_nullable = self.class.openapi_nullable.include?(attr)
342
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
343
+ end
344
+
345
+ hash[param] = _to_hash(value)
346
+ end
347
+ hash
348
+ end
349
+
350
+ # Outputs non-array value in the form of hash
351
+ # For object, use to_hash. Otherwise, just return the value
352
+ # @param [Object] value Any valid value
353
+ # @return [Hash] Returns the value in the form of hash
354
+ def _to_hash(value)
355
+ if value.is_a?(Array)
356
+ value.compact.map { |v| _to_hash(v) }
357
+ elsif value.is_a?(Hash)
358
+ {}.tap do |hash|
359
+ value.each { |k, v| hash[k] = _to_hash(v) }
360
+ end
361
+ elsif value.respond_to? :to_hash
362
+ value.to_hash
363
+ else
364
+ value
365
+ end
366
+ end
367
+
368
+ end
369
+
370
+ end
@@ -18,6 +18,7 @@ module Carbon
18
18
  DOCX = "DOCX".freeze
19
19
  PPTX = "PPTX".freeze
20
20
  XLSX = "XLSX".freeze
21
+ XLSM = "XLSM".freeze
21
22
  MD = "MD".freeze
22
23
  RTF = "RTF".freeze
23
24
  JSON = "JSON".freeze
@@ -65,7 +66,7 @@ module Carbon
65
66
  MSG = "MSG".freeze
66
67
 
67
68
  def self.all_vars
68
- @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, SERVICENOW, GONG, JPG, PNG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
69
+ @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, XLSM, MD, RTF, JSON, HTML, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, SERVICENOW, GONG, JPG, PNG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
69
70
  end
70
71
 
71
72
  # Builds the enum from string
@@ -18,6 +18,7 @@ module Carbon
18
18
  DOCX = "DOCX".freeze
19
19
  PPTX = "PPTX".freeze
20
20
  XLSX = "XLSX".freeze
21
+ XLSM = "XLSM".freeze
21
22
  MD = "MD".freeze
22
23
  RTF = "RTF".freeze
23
24
  JSON = "JSON".freeze
@@ -65,7 +66,7 @@ module Carbon
65
66
  MSG = "MSG".freeze
66
67
 
67
68
  def self.all_vars
68
- @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, SERVICENOW, GONG, JPG, PNG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
69
+ @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, XLSM, MD, RTF, JSON, HTML, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, SERVICENOW, GONG, JPG, PNG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
69
70
  end
70
71
 
71
72
  # Builds the enum from string