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