carbon_ruby_sdk 0.2.41 → 0.2.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +273 -3
- data/lib/carbon_ruby_sdk/api/data_sources_api.rb +196 -0
- data/lib/carbon_ruby_sdk/api/files_api.rb +4 -4
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +48 -16
- data/lib/carbon_ruby_sdk/api/users_api.rb +71 -0
- data/lib/carbon_ruby_sdk/api/white_label_api.rb +393 -0
- data/lib/carbon_ruby_sdk/models/add_data_source_tags_input.rb +234 -0
- data/lib/carbon_ruby_sdk/models/azure_blob_auth_request.rb +14 -4
- data/lib/carbon_ruby_sdk/models/cold_storage_props.rb +1 -1
- data/lib/carbon_ruby_sdk/models/credentials.rb +244 -0
- data/lib/carbon_ruby_sdk/models/delete_white_label_request.rb +222 -0
- data/lib/carbon_ruby_sdk/models/external_source_item.rb +11 -1
- data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/github_connect_request.rb +14 -4
- data/lib/carbon_ruby_sdk/models/google_drive_credentials.rb +254 -0
- data/lib/carbon_ruby_sdk/models/google_drive_white_label_input.rb +230 -0
- data/lib/carbon_ruby_sdk/models/guru_connect_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/list_white_label_request.rb +246 -0
- data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_credentials.rb +264 -0
- data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_white_label_input.rb +234 -0
- data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_white_label_input_data_source_type.rb +36 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +15 -1
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_filters.rb +12 -1
- data/lib/carbon_ruby_sdk/models/remove_data_source_tags_input.rb +242 -0
- data/lib/carbon_ruby_sdk/models/rss_feed_input.rb +15 -5
- data/lib/carbon_ruby_sdk/models/s3_auth_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/sync_options.rb +15 -5
- data/lib/carbon_ruby_sdk/models/user_response.rb +18 -4
- data/lib/carbon_ruby_sdk/models/white_label_create_request_inner.rb +255 -0
- data/lib/carbon_ruby_sdk/models/white_label_filters.rb +230 -0
- data/lib/carbon_ruby_sdk/models/white_label_input.rb +234 -0
- data/lib/carbon_ruby_sdk/models/white_label_input_data_source_type.rb +48 -0
- data/lib/carbon_ruby_sdk/models/white_label_order_by_columns.rb +36 -0
- data/lib/carbon_ruby_sdk/models/white_label_update_request.rb +255 -0
- data/lib/carbon_ruby_sdk/models/white_labeling_response.rb +18 -4
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +19 -0
- data/spec/api/data_sources_api_spec.rb +22 -0
- data/spec/api/files_api_spec.rb +1 -1
- data/spec/api/users_api_spec.rb +10 -0
- data/spec/api/white_label_api_spec.rb +73 -0
- data/spec/models/add_data_source_tags_input_spec.rb +34 -0
- data/spec/models/azure_blob_auth_request_spec.rb +6 -0
- data/spec/models/credentials_spec.rb +40 -0
- data/spec/models/delete_white_label_request_spec.rb +28 -0
- data/spec/models/external_source_item_spec.rb +6 -0
- data/spec/models/fresh_desk_connect_request_spec.rb +6 -0
- data/spec/models/gitbook_connect_request_spec.rb +6 -0
- data/spec/models/github_connect_request_spec.rb +6 -0
- data/spec/models/google_drive_credentials_spec.rb +46 -0
- data/spec/models/google_drive_white_label_input_spec.rb +34 -0
- data/spec/models/guru_connect_request_spec.rb +6 -0
- data/spec/models/list_white_label_request_spec.rb +46 -0
- data/spec/models/o_auth_url_request_spec.rb +6 -0
- data/spec/models/one_drive_sharepoint_credentials_spec.rb +52 -0
- data/spec/models/one_drive_sharepoint_white_label_input_data_source_type_spec.rb +22 -0
- data/spec/models/one_drive_sharepoint_white_label_input_spec.rb +34 -0
- data/spec/models/organization_user_data_source_api_spec.rb +6 -0
- data/spec/models/organization_user_data_source_filters_spec.rb +6 -0
- data/spec/models/remove_data_source_tags_input_spec.rb +40 -0
- data/spec/models/rss_feed_input_spec.rb +6 -0
- data/spec/models/s3_auth_request_spec.rb +6 -0
- data/spec/models/sync_options_spec.rb +6 -0
- data/spec/models/user_response_spec.rb +6 -0
- data/spec/models/white_label_create_request_inner_spec.rb +34 -0
- data/spec/models/white_label_filters_spec.rb +34 -0
- data/spec/models/white_label_input_data_source_type_spec.rb +22 -0
- data/spec/models/white_label_input_spec.rb +34 -0
- data/spec/models/white_label_order_by_columns_spec.rb +22 -0
- data/spec/models/white_label_update_request_spec.rb +34 -0
- data/spec/models/white_labeling_response_spec.rb +6 -0
- metadata +53 -2
@@ -29,6 +29,9 @@ module Carbon
|
|
29
29
|
|
30
30
|
attr_accessor :request_id
|
31
31
|
|
32
|
+
# Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
|
33
|
+
attr_accessor :data_source_tags
|
34
|
+
|
32
35
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
36
|
def self.attribute_map
|
34
37
|
{
|
@@ -40,7 +43,8 @@ module Carbon
|
|
40
43
|
:'embedding_model' => :'embedding_model',
|
41
44
|
:'generate_sparse_vectors' => :'generate_sparse_vectors',
|
42
45
|
:'prepend_filename_to_chunks' => :'prepend_filename_to_chunks',
|
43
|
-
:'request_id' => :'request_id'
|
46
|
+
:'request_id' => :'request_id',
|
47
|
+
:'data_source_tags' => :'data_source_tags'
|
44
48
|
}
|
45
49
|
end
|
46
50
|
|
@@ -60,7 +64,8 @@ module Carbon
|
|
60
64
|
:'embedding_model' => :'EmbeddingGenerators',
|
61
65
|
:'generate_sparse_vectors' => :'Boolean',
|
62
66
|
:'prepend_filename_to_chunks' => :'Boolean',
|
63
|
-
:'request_id' => :'String'
|
67
|
+
:'request_id' => :'String',
|
68
|
+
:'data_source_tags' => :'Object'
|
64
69
|
}
|
65
70
|
end
|
66
71
|
|
@@ -73,7 +78,7 @@ module Carbon
|
|
73
78
|
:'skip_embedding_generation',
|
74
79
|
:'generate_sparse_vectors',
|
75
80
|
:'prepend_filename_to_chunks',
|
76
|
-
:'request_id'
|
81
|
+
:'request_id',
|
77
82
|
])
|
78
83
|
end
|
79
84
|
|
@@ -139,6 +144,10 @@ module Carbon
|
|
139
144
|
if attributes.key?(:'request_id')
|
140
145
|
self.request_id = attributes[:'request_id']
|
141
146
|
end
|
147
|
+
|
148
|
+
if attributes.key?(:'data_source_tags')
|
149
|
+
self.data_source_tags = attributes[:'data_source_tags']
|
150
|
+
end
|
142
151
|
end
|
143
152
|
|
144
153
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -172,7 +181,8 @@ module Carbon
|
|
172
181
|
embedding_model == o.embedding_model &&
|
173
182
|
generate_sparse_vectors == o.generate_sparse_vectors &&
|
174
183
|
prepend_filename_to_chunks == o.prepend_filename_to_chunks &&
|
175
|
-
request_id == o.request_id
|
184
|
+
request_id == o.request_id &&
|
185
|
+
data_source_tags == o.data_source_tags
|
176
186
|
end
|
177
187
|
|
178
188
|
# @see the `==` method
|
@@ -184,7 +194,7 @@ module Carbon
|
|
184
194
|
# Calculates hash code according to all attributes.
|
185
195
|
# @return [Integer] Hash code
|
186
196
|
def hash
|
187
|
-
[tags, url, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, request_id].hash
|
197
|
+
[tags, url, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, request_id, data_source_tags].hash
|
188
198
|
end
|
189
199
|
|
190
200
|
# Builds the object from hash
|
@@ -21,13 +21,17 @@ module Carbon
|
|
21
21
|
# You can specify a Digital Ocean endpoint URL to connect a Digital Ocean Space through this endpoint. The URL should be of format <region>.digitaloceanspaces.com. It's not required for S3 buckets.
|
22
22
|
attr_accessor :endpoint_url
|
23
23
|
|
24
|
+
# Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
|
25
|
+
attr_accessor :data_source_tags
|
26
|
+
|
24
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
25
28
|
def self.attribute_map
|
26
29
|
{
|
27
30
|
:'access_key' => :'access_key',
|
28
31
|
:'access_key_secret' => :'access_key_secret',
|
29
32
|
:'sync_source_items' => :'sync_source_items',
|
30
|
-
:'endpoint_url' => :'endpoint_url'
|
33
|
+
:'endpoint_url' => :'endpoint_url',
|
34
|
+
:'data_source_tags' => :'data_source_tags'
|
31
35
|
}
|
32
36
|
end
|
33
37
|
|
@@ -42,14 +46,15 @@ module Carbon
|
|
42
46
|
:'access_key' => :'String',
|
43
47
|
:'access_key_secret' => :'String',
|
44
48
|
:'sync_source_items' => :'Boolean',
|
45
|
-
:'endpoint_url' => :'String'
|
49
|
+
:'endpoint_url' => :'String',
|
50
|
+
:'data_source_tags' => :'Object'
|
46
51
|
}
|
47
52
|
end
|
48
53
|
|
49
54
|
# List of attributes with nullable: true
|
50
55
|
def self.openapi_nullable
|
51
56
|
Set.new([
|
52
|
-
:'endpoint_url'
|
57
|
+
:'endpoint_url',
|
53
58
|
])
|
54
59
|
end
|
55
60
|
|
@@ -85,6 +90,10 @@ module Carbon
|
|
85
90
|
if attributes.key?(:'endpoint_url')
|
86
91
|
self.endpoint_url = attributes[:'endpoint_url']
|
87
92
|
end
|
93
|
+
|
94
|
+
if attributes.key?(:'data_source_tags')
|
95
|
+
self.data_source_tags = attributes[:'data_source_tags']
|
96
|
+
end
|
88
97
|
end
|
89
98
|
|
90
99
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -118,7 +127,8 @@ module Carbon
|
|
118
127
|
access_key == o.access_key &&
|
119
128
|
access_key_secret == o.access_key_secret &&
|
120
129
|
sync_source_items == o.sync_source_items &&
|
121
|
-
endpoint_url == o.endpoint_url
|
130
|
+
endpoint_url == o.endpoint_url &&
|
131
|
+
data_source_tags == o.data_source_tags
|
122
132
|
end
|
123
133
|
|
124
134
|
# @see the `==` method
|
@@ -130,7 +140,7 @@ module Carbon
|
|
130
140
|
# Calculates hash code according to all attributes.
|
131
141
|
# @return [Integer] Hash code
|
132
142
|
def hash
|
133
|
-
[access_key, access_key_secret, sync_source_items, endpoint_url].hash
|
143
|
+
[access_key, access_key_secret, sync_source_items, endpoint_url, data_source_tags].hash
|
134
144
|
end
|
135
145
|
|
136
146
|
# Builds the object from hash
|
@@ -48,6 +48,9 @@ module Carbon
|
|
48
48
|
# Automatically open source file picker after the OAuth flow is complete. This flag is currently supported by BOX, DROPBOX, GOOGLE_DRIVE, ONEDRIVE, SHAREPOINT. It will be ignored for other data sources.
|
49
49
|
attr_accessor :automatically_open_file_picker
|
50
50
|
|
51
|
+
# Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
|
52
|
+
attr_accessor :data_source_tags
|
53
|
+
|
51
54
|
# Attribute mapping from ruby-style variable name to JSON key.
|
52
55
|
def self.attribute_map
|
53
56
|
{
|
@@ -66,7 +69,8 @@ module Carbon
|
|
66
69
|
:'sync_source_items' => :'sync_source_items',
|
67
70
|
:'incremental_sync' => :'incremental_sync',
|
68
71
|
:'file_sync_config' => :'file_sync_config',
|
69
|
-
:'automatically_open_file_picker' => :'automatically_open_file_picker'
|
72
|
+
:'automatically_open_file_picker' => :'automatically_open_file_picker',
|
73
|
+
:'data_source_tags' => :'data_source_tags'
|
70
74
|
}
|
71
75
|
end
|
72
76
|
|
@@ -93,7 +97,8 @@ module Carbon
|
|
93
97
|
:'sync_source_items' => :'Boolean',
|
94
98
|
:'incremental_sync' => :'Boolean',
|
95
99
|
:'file_sync_config' => :'FileSyncConfigNullable',
|
96
|
-
:'automatically_open_file_picker' => :'Boolean'
|
100
|
+
:'automatically_open_file_picker' => :'Boolean',
|
101
|
+
:'data_source_tags' => :'Object'
|
97
102
|
}
|
98
103
|
end
|
99
104
|
|
@@ -111,7 +116,7 @@ module Carbon
|
|
111
116
|
:'sync_files_on_connection',
|
112
117
|
:'request_id',
|
113
118
|
:'file_sync_config',
|
114
|
-
:'automatically_open_file_picker'
|
119
|
+
:'automatically_open_file_picker',
|
115
120
|
])
|
116
121
|
end
|
117
122
|
|
@@ -215,6 +220,10 @@ module Carbon
|
|
215
220
|
if attributes.key?(:'automatically_open_file_picker')
|
216
221
|
self.automatically_open_file_picker = attributes[:'automatically_open_file_picker']
|
217
222
|
end
|
223
|
+
|
224
|
+
if attributes.key?(:'data_source_tags')
|
225
|
+
self.data_source_tags = attributes[:'data_source_tags']
|
226
|
+
end
|
218
227
|
end
|
219
228
|
|
220
229
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -250,7 +259,8 @@ module Carbon
|
|
250
259
|
sync_source_items == o.sync_source_items &&
|
251
260
|
incremental_sync == o.incremental_sync &&
|
252
261
|
file_sync_config == o.file_sync_config &&
|
253
|
-
automatically_open_file_picker == o.automatically_open_file_picker
|
262
|
+
automatically_open_file_picker == o.automatically_open_file_picker &&
|
263
|
+
data_source_tags == o.data_source_tags
|
254
264
|
end
|
255
265
|
|
256
266
|
# @see the `==` method
|
@@ -262,7 +272,7 @@ module Carbon
|
|
262
272
|
# Calculates hash code according to all attributes.
|
263
273
|
# @return [Integer] Hash code
|
264
274
|
def hash
|
265
|
-
[tags, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, max_items_per_chunk, sync_files_on_connection, set_page_as_boundary, request_id, enable_file_picker, sync_source_items, incremental_sync, file_sync_config, automatically_open_file_picker].hash
|
275
|
+
[tags, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, max_items_per_chunk, sync_files_on_connection, set_page_as_boundary, request_id, enable_file_picker, sync_source_items, incremental_sync, file_sync_config, automatically_open_file_picker, data_source_tags].hash
|
266
276
|
end
|
267
277
|
|
268
278
|
# Builds the object from hash
|
@@ -49,6 +49,8 @@ module Carbon
|
|
49
49
|
|
50
50
|
attr_accessor :auto_sync_enabled_sources
|
51
51
|
|
52
|
+
attr_accessor :connector_settings
|
53
|
+
|
52
54
|
# Attribute mapping from ruby-style variable name to JSON key.
|
53
55
|
def self.attribute_map
|
54
56
|
{
|
@@ -70,7 +72,8 @@ module Carbon
|
|
70
72
|
:'unique_file_tags' => :'unique_file_tags',
|
71
73
|
:'enabled_features' => :'enabled_features',
|
72
74
|
:'custom_limits' => :'custom_limits',
|
73
|
-
:'auto_sync_enabled_sources' => :'auto_sync_enabled_sources'
|
75
|
+
:'auto_sync_enabled_sources' => :'auto_sync_enabled_sources',
|
76
|
+
:'connector_settings' => :'connector_settings'
|
74
77
|
}
|
75
78
|
end
|
76
79
|
|
@@ -100,7 +103,8 @@ module Carbon
|
|
100
103
|
:'unique_file_tags' => :'Array<Object>',
|
101
104
|
:'enabled_features' => :'Object',
|
102
105
|
:'custom_limits' => :'Object',
|
103
|
-
:'auto_sync_enabled_sources' => :'Array<Object>'
|
106
|
+
:'auto_sync_enabled_sources' => :'Array<Object>',
|
107
|
+
:'connector_settings' => :'Object'
|
104
108
|
}
|
105
109
|
end
|
106
110
|
|
@@ -206,6 +210,10 @@ module Carbon
|
|
206
210
|
self.auto_sync_enabled_sources = value
|
207
211
|
end
|
208
212
|
end
|
213
|
+
|
214
|
+
if attributes.key?(:'connector_settings')
|
215
|
+
self.connector_settings = attributes[:'connector_settings']
|
216
|
+
end
|
209
217
|
end
|
210
218
|
|
211
219
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -280,6 +288,10 @@ module Carbon
|
|
280
288
|
invalid_properties.push('invalid value for "auto_sync_enabled_sources", auto_sync_enabled_sources cannot be nil.')
|
281
289
|
end
|
282
290
|
|
291
|
+
if @connector_settings.nil?
|
292
|
+
invalid_properties.push('invalid value for "connector_settings", connector_settings cannot be nil.')
|
293
|
+
end
|
294
|
+
|
283
295
|
invalid_properties
|
284
296
|
end
|
285
297
|
|
@@ -303,6 +315,7 @@ module Carbon
|
|
303
315
|
return false if @unique_file_tags.nil?
|
304
316
|
return false if @custom_limits.nil?
|
305
317
|
return false if @auto_sync_enabled_sources.nil?
|
318
|
+
return false if @connector_settings.nil?
|
306
319
|
true
|
307
320
|
end
|
308
321
|
|
@@ -329,7 +342,8 @@ module Carbon
|
|
329
342
|
unique_file_tags == o.unique_file_tags &&
|
330
343
|
enabled_features == o.enabled_features &&
|
331
344
|
custom_limits == o.custom_limits &&
|
332
|
-
auto_sync_enabled_sources == o.auto_sync_enabled_sources
|
345
|
+
auto_sync_enabled_sources == o.auto_sync_enabled_sources &&
|
346
|
+
connector_settings == o.connector_settings
|
333
347
|
end
|
334
348
|
|
335
349
|
# @see the `==` method
|
@@ -341,7 +355,7 @@ module Carbon
|
|
341
355
|
# Calculates hash code according to all attributes.
|
342
356
|
# @return [Integer] Hash code
|
343
357
|
def hash
|
344
|
-
[id, organization_id, organization_supplied_user_id, created_at, updated_at, deleted_at, num_files_synced, num_characters_synced, num_tokens_synced, aggregate_file_size, aggregate_num_characters, aggregate_num_tokens, aggregate_num_embeddings, aggregate_num_files_by_source, aggregate_num_files_by_file_format, unique_file_tags, enabled_features, custom_limits, auto_sync_enabled_sources].hash
|
358
|
+
[id, organization_id, organization_supplied_user_id, created_at, updated_at, deleted_at, num_files_synced, num_characters_synced, num_tokens_synced, aggregate_file_size, aggregate_num_characters, aggregate_num_tokens, aggregate_num_embeddings, aggregate_num_files_by_source, aggregate_num_files_by_file_format, unique_file_tags, enabled_features, custom_limits, auto_sync_enabled_sources, connector_settings].hash
|
345
359
|
end
|
346
360
|
|
347
361
|
# Builds the object from hash
|
@@ -0,0 +1,255 @@
|
|
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 WhiteLabelCreateRequestInner
|
14
|
+
attr_accessor :data_source_type
|
15
|
+
|
16
|
+
attr_accessor :credentials
|
17
|
+
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
:'data_source_type' => :'data_source_type',
|
22
|
+
:'credentials' => :'credentials'
|
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
|
+
:'data_source_type' => :'WhiteLabelInputDataSourceType',
|
35
|
+
:'credentials' => :'Credentials'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of class defined in anyOf (OpenAPI v3)
|
46
|
+
def self.openapi_any_of
|
47
|
+
[
|
48
|
+
:'GoogleDriveWhiteLabelInput',
|
49
|
+
:'OneDriveSharepointWhiteLabelInput',
|
50
|
+
:'WhiteLabelInput'
|
51
|
+
]
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::WhiteLabelCreateRequestInner` initialize method"
|
59
|
+
end
|
60
|
+
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::WhiteLabelCreateRequestInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:'data_source_type')
|
70
|
+
self.data_source_type = attributes[:'data_source_type']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'credentials')
|
74
|
+
self.credentials = attributes[:'credentials']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properties with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = Array.new
|
82
|
+
if @data_source_type.nil?
|
83
|
+
invalid_properties.push('invalid value for "data_source_type", data_source_type cannot be nil.')
|
84
|
+
end
|
85
|
+
|
86
|
+
if @credentials.nil?
|
87
|
+
invalid_properties.push('invalid value for "credentials", credentials cannot be nil.')
|
88
|
+
end
|
89
|
+
|
90
|
+
invalid_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check to see if the all the properties in the model are valid
|
94
|
+
# @return true if the model is valid
|
95
|
+
def valid?
|
96
|
+
return false if @data_source_type.nil?
|
97
|
+
return false if @credentials.nil?
|
98
|
+
_any_of_found = false
|
99
|
+
self.class.openapi_any_of.each do |_class|
|
100
|
+
_any_of = Carbon.const_get(_class).build_from_hash(self.to_hash)
|
101
|
+
if _any_of.valid?
|
102
|
+
_any_of_found = true
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if !_any_of_found
|
107
|
+
return false
|
108
|
+
end
|
109
|
+
|
110
|
+
true
|
111
|
+
end
|
112
|
+
|
113
|
+
# Checks equality by comparing each attribute.
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def ==(o)
|
116
|
+
return true if self.equal?(o)
|
117
|
+
self.class == o.class &&
|
118
|
+
data_source_type == o.data_source_type &&
|
119
|
+
credentials == o.credentials
|
120
|
+
end
|
121
|
+
|
122
|
+
# @see the `==` method
|
123
|
+
# @param [Object] Object to be compared
|
124
|
+
def eql?(o)
|
125
|
+
self == o
|
126
|
+
end
|
127
|
+
|
128
|
+
# Calculates hash code according to all attributes.
|
129
|
+
# @return [Integer] Hash code
|
130
|
+
def hash
|
131
|
+
[data_source_type, credentials].hash
|
132
|
+
end
|
133
|
+
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def self.build_from_hash(attributes)
|
138
|
+
new.build_from_hash(attributes)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Builds the object from hash
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
+
# @return [Object] Returns the model itself
|
144
|
+
def build_from_hash(attributes)
|
145
|
+
return nil unless attributes.is_a?(Hash)
|
146
|
+
attributes = attributes.transform_keys(&:to_sym)
|
147
|
+
self.class.openapi_types.each_pair do |key, type|
|
148
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
149
|
+
self.send("#{key}=", nil)
|
150
|
+
elsif type =~ /\AArray<(.*)>/i
|
151
|
+
# check to ensure the input is an array given that the attribute
|
152
|
+
# is documented as an array but the input is not
|
153
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
154
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
155
|
+
end
|
156
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
157
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
164
|
+
# Deserializes the data based on type
|
165
|
+
# @param string type Data type
|
166
|
+
# @param string value Value to be deserialized
|
167
|
+
# @return [Object] Deserialized data
|
168
|
+
def _deserialize(type, value)
|
169
|
+
case type.to_sym
|
170
|
+
when :Time
|
171
|
+
Time.parse(value)
|
172
|
+
when :Date
|
173
|
+
Date.parse(value)
|
174
|
+
when :String
|
175
|
+
value.to_s
|
176
|
+
when :Integer
|
177
|
+
value.to_i
|
178
|
+
when :Float
|
179
|
+
value.to_f
|
180
|
+
when :Boolean
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
182
|
+
true
|
183
|
+
else
|
184
|
+
false
|
185
|
+
end
|
186
|
+
when :Object
|
187
|
+
# generic object (usually a Hash), return directly
|
188
|
+
value
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each do |k, v|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
else # model
|
201
|
+
# models (e.g. Pet) or oneOf
|
202
|
+
klass = Carbon.const_get(type)
|
203
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the string representation of the object
|
208
|
+
# @return [String] String presentation of the object
|
209
|
+
def to_s
|
210
|
+
to_hash.to_s
|
211
|
+
end
|
212
|
+
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_body
|
216
|
+
to_hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the object in the form of hash
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_hash
|
222
|
+
hash = {}
|
223
|
+
self.class.attribute_map.each_pair do |attr, param|
|
224
|
+
value = self.send(attr)
|
225
|
+
if value.nil?
|
226
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
227
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
228
|
+
end
|
229
|
+
|
230
|
+
hash[param] = _to_hash(value)
|
231
|
+
end
|
232
|
+
hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Outputs non-array value in the form of hash
|
236
|
+
# For object, use to_hash. Otherwise, just return the value
|
237
|
+
# @param [Object] value Any valid value
|
238
|
+
# @return [Hash] Returns the value in the form of hash
|
239
|
+
def _to_hash(value)
|
240
|
+
if value.is_a?(Array)
|
241
|
+
value.compact.map { |v| _to_hash(v) }
|
242
|
+
elsif value.is_a?(Hash)
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
245
|
+
end
|
246
|
+
elsif value.respond_to? :to_hash
|
247
|
+
value.to_hash
|
248
|
+
else
|
249
|
+
value
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|