carbon_ruby_sdk 0.2.41 → 0.2.43

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +273 -3
  4. data/lib/carbon_ruby_sdk/api/data_sources_api.rb +196 -0
  5. data/lib/carbon_ruby_sdk/api/files_api.rb +4 -4
  6. data/lib/carbon_ruby_sdk/api/integrations_api.rb +48 -16
  7. data/lib/carbon_ruby_sdk/api/users_api.rb +71 -0
  8. data/lib/carbon_ruby_sdk/api/white_label_api.rb +393 -0
  9. data/lib/carbon_ruby_sdk/models/add_data_source_tags_input.rb +234 -0
  10. data/lib/carbon_ruby_sdk/models/azure_blob_auth_request.rb +14 -4
  11. data/lib/carbon_ruby_sdk/models/cold_storage_props.rb +1 -1
  12. data/lib/carbon_ruby_sdk/models/credentials.rb +244 -0
  13. data/lib/carbon_ruby_sdk/models/delete_white_label_request.rb +222 -0
  14. data/lib/carbon_ruby_sdk/models/external_source_item.rb +11 -1
  15. data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +15 -5
  16. data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +15 -5
  17. data/lib/carbon_ruby_sdk/models/github_connect_request.rb +14 -4
  18. data/lib/carbon_ruby_sdk/models/google_drive_credentials.rb +254 -0
  19. data/lib/carbon_ruby_sdk/models/google_drive_white_label_input.rb +230 -0
  20. data/lib/carbon_ruby_sdk/models/guru_connect_request.rb +15 -5
  21. data/lib/carbon_ruby_sdk/models/list_white_label_request.rb +246 -0
  22. data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +15 -5
  23. data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_credentials.rb +264 -0
  24. data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_white_label_input.rb +234 -0
  25. data/lib/carbon_ruby_sdk/models/one_drive_sharepoint_white_label_input_data_source_type.rb +36 -0
  26. data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +15 -1
  27. data/lib/carbon_ruby_sdk/models/organization_user_data_source_filters.rb +12 -1
  28. data/lib/carbon_ruby_sdk/models/remove_data_source_tags_input.rb +242 -0
  29. data/lib/carbon_ruby_sdk/models/rss_feed_input.rb +15 -5
  30. data/lib/carbon_ruby_sdk/models/s3_auth_request.rb +15 -5
  31. data/lib/carbon_ruby_sdk/models/sync_options.rb +15 -5
  32. data/lib/carbon_ruby_sdk/models/user_response.rb +18 -4
  33. data/lib/carbon_ruby_sdk/models/white_label_create_request_inner.rb +255 -0
  34. data/lib/carbon_ruby_sdk/models/white_label_filters.rb +230 -0
  35. data/lib/carbon_ruby_sdk/models/white_label_input.rb +234 -0
  36. data/lib/carbon_ruby_sdk/models/white_label_input_data_source_type.rb +48 -0
  37. data/lib/carbon_ruby_sdk/models/white_label_order_by_columns.rb +36 -0
  38. data/lib/carbon_ruby_sdk/models/white_label_update_request.rb +255 -0
  39. data/lib/carbon_ruby_sdk/models/white_labeling_response.rb +18 -4
  40. data/lib/carbon_ruby_sdk/version.rb +1 -1
  41. data/lib/carbon_ruby_sdk.rb +19 -0
  42. data/spec/api/data_sources_api_spec.rb +22 -0
  43. data/spec/api/files_api_spec.rb +1 -1
  44. data/spec/api/users_api_spec.rb +10 -0
  45. data/spec/api/white_label_api_spec.rb +73 -0
  46. data/spec/models/add_data_source_tags_input_spec.rb +34 -0
  47. data/spec/models/azure_blob_auth_request_spec.rb +6 -0
  48. data/spec/models/credentials_spec.rb +40 -0
  49. data/spec/models/delete_white_label_request_spec.rb +28 -0
  50. data/spec/models/external_source_item_spec.rb +6 -0
  51. data/spec/models/fresh_desk_connect_request_spec.rb +6 -0
  52. data/spec/models/gitbook_connect_request_spec.rb +6 -0
  53. data/spec/models/github_connect_request_spec.rb +6 -0
  54. data/spec/models/google_drive_credentials_spec.rb +46 -0
  55. data/spec/models/google_drive_white_label_input_spec.rb +34 -0
  56. data/spec/models/guru_connect_request_spec.rb +6 -0
  57. data/spec/models/list_white_label_request_spec.rb +46 -0
  58. data/spec/models/o_auth_url_request_spec.rb +6 -0
  59. data/spec/models/one_drive_sharepoint_credentials_spec.rb +52 -0
  60. data/spec/models/one_drive_sharepoint_white_label_input_data_source_type_spec.rb +22 -0
  61. data/spec/models/one_drive_sharepoint_white_label_input_spec.rb +34 -0
  62. data/spec/models/organization_user_data_source_api_spec.rb +6 -0
  63. data/spec/models/organization_user_data_source_filters_spec.rb +6 -0
  64. data/spec/models/remove_data_source_tags_input_spec.rb +40 -0
  65. data/spec/models/rss_feed_input_spec.rb +6 -0
  66. data/spec/models/s3_auth_request_spec.rb +6 -0
  67. data/spec/models/sync_options_spec.rb +6 -0
  68. data/spec/models/user_response_spec.rb +6 -0
  69. data/spec/models/white_label_create_request_inner_spec.rb +34 -0
  70. data/spec/models/white_label_filters_spec.rb +34 -0
  71. data/spec/models/white_label_input_data_source_type_spec.rb +22 -0
  72. data/spec/models/white_label_input_spec.rb +34 -0
  73. data/spec/models/white_label_order_by_columns_spec.rb +22 -0
  74. data/spec/models/white_label_update_request_spec.rb +34 -0
  75. data/spec/models/white_labeling_response_spec.rb +6 -0
  76. metadata +53 -2
@@ -0,0 +1,234 @@
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 OneDriveSharepointWhiteLabelInput
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' => :'OneDriveSharepointWhiteLabelInputDataSourceType',
35
+ :'credentials' => :'OneDriveSharepointCredentials'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::OneDriveSharepointWhiteLabelInput` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::OneDriveSharepointWhiteLabelInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'data_source_type')
61
+ self.data_source_type = attributes[:'data_source_type']
62
+ end
63
+
64
+ if attributes.key?(:'credentials')
65
+ self.credentials = attributes[:'credentials']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @data_source_type.nil?
74
+ invalid_properties.push('invalid value for "data_source_type", data_source_type cannot be nil.')
75
+ end
76
+
77
+ if @credentials.nil?
78
+ invalid_properties.push('invalid value for "credentials", credentials cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @data_source_type.nil?
88
+ return false if @credentials.nil?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ data_source_type == o.data_source_type &&
98
+ credentials == o.credentials
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [data_source_type, credentials].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = Carbon.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -0,0 +1,36 @@
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 OneDriveSharepointWhiteLabelInputDataSourceType
14
+ ONEDRIVE = "ONEDRIVE".freeze
15
+ SHAREPOINT = "SHAREPOINT".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [ONEDRIVE, SHAREPOINT].freeze
19
+ end
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ return value if OneDriveSharepointWhiteLabelInputDataSourceType.all_vars.include?(value)
33
+ raise "Invalid ENUM value #{value} for class #OneDriveSharepointWhiteLabelInputDataSourceType"
34
+ end
35
+ end
36
+ end
@@ -11,6 +11,8 @@ require 'time'
11
11
 
12
12
  module Carbon
13
13
  class OrganizationUserDataSourceAPI
14
+ attr_accessor :tags
15
+
14
16
  attr_accessor :id
15
17
 
16
18
  attr_accessor :data_source_external_id
@@ -48,6 +50,7 @@ module Carbon
48
50
  # Attribute mapping from ruby-style variable name to JSON key.
49
51
  def self.attribute_map
50
52
  {
53
+ :'tags' => :'tags',
51
54
  :'id' => :'id',
52
55
  :'data_source_external_id' => :'data_source_external_id',
53
56
  :'data_source_type' => :'data_source_type',
@@ -76,6 +79,7 @@ module Carbon
76
79
  # Attribute type mapping.
77
80
  def self.openapi_types
78
81
  {
82
+ :'tags' => :'Object',
79
83
  :'id' => :'Integer',
80
84
  :'data_source_external_id' => :'String',
81
85
  :'data_source_type' => :'DataSourceType',
@@ -122,6 +126,10 @@ module Carbon
122
126
  h[k.to_sym] = v
123
127
  }
124
128
 
129
+ if attributes.key?(:'tags')
130
+ self.tags = attributes[:'tags']
131
+ end
132
+
125
133
  if attributes.key?(:'id')
126
134
  self.id = attributes[:'id']
127
135
  end
@@ -195,6 +203,10 @@ module Carbon
195
203
  # @return Array for valid properties with the reasons
196
204
  def list_invalid_properties
197
205
  invalid_properties = Array.new
206
+ if @tags.nil?
207
+ invalid_properties.push('invalid value for "tags", tags cannot be nil.')
208
+ end
209
+
198
210
  if @id.nil?
199
211
  invalid_properties.push('invalid value for "id", id cannot be nil.')
200
212
  end
@@ -249,6 +261,7 @@ module Carbon
249
261
  # Check to see if the all the properties in the model are valid
250
262
  # @return true if the model is valid
251
263
  def valid?
264
+ return false if @tags.nil?
252
265
  return false if @id.nil?
253
266
  return false if @data_source_type.nil?
254
267
  return false if @sync_status.nil?
@@ -269,6 +282,7 @@ module Carbon
269
282
  def ==(o)
270
283
  return true if self.equal?(o)
271
284
  self.class == o.class &&
285
+ tags == o.tags &&
272
286
  id == o.id &&
273
287
  data_source_external_id == o.data_source_external_id &&
274
288
  data_source_type == o.data_source_type &&
@@ -297,7 +311,7 @@ module Carbon
297
311
  # Calculates hash code according to all attributes.
298
312
  # @return [Integer] Hash code
299
313
  def hash
300
- [id, data_source_external_id, data_source_type, token, sync_status, source_items_synced_at, organization_user_id, organization_id, organization_supplied_user_id, revoked_access, last_synced_at, last_sync_action, enable_auto_sync, created_at, updated_at, files_synced_at, data_source_metadata].hash
314
+ [tags, id, data_source_external_id, data_source_type, token, sync_status, source_items_synced_at, organization_user_id, organization_id, organization_supplied_user_id, revoked_access, last_synced_at, last_sync_action, enable_auto_sync, created_at, updated_at, files_synced_at, data_source_metadata].hash
301
315
  end
302
316
 
303
317
  # Builds the object from hash
@@ -11,6 +11,9 @@ require 'time'
11
11
 
12
12
  module Carbon
13
13
  class OrganizationUserDataSourceFilters
14
+ # Tags to filter by. Supports logical AND and OR operations. Input should be like below: { \"OR\": [ { \"key\": \"subject\", \"value\": \"holy-bible\", \"negate\": false }, { \"key\": \"person-of-interest\", \"value\": \"jesus christ\", \"negate\": false }, { \"key\": \"genre\", \"value\": \"fiction\", \"negate\": true } { \"AND\": [ { \"key\": \"subject\", \"value\": \"tao-te-ching\", \"negate\": true }, { \"key\": \"author\", \"value\": \"lao-tzu\", \"negate\": false } ] } ] } For a single filter, the filter block can be placed within either an \"AND\" or \"OR\" block.
15
+ attr_accessor :tags
16
+
14
17
  attr_accessor :source
15
18
 
16
19
  attr_accessor :ids
@@ -20,6 +23,7 @@ module Carbon
20
23
  # Attribute mapping from ruby-style variable name to JSON key.
21
24
  def self.attribute_map
22
25
  {
26
+ :'tags' => :'tags',
23
27
  :'source' => :'source',
24
28
  :'ids' => :'ids',
25
29
  :'revoked_access' => :'revoked_access'
@@ -34,6 +38,7 @@ module Carbon
34
38
  # Attribute type mapping.
35
39
  def self.openapi_types
36
40
  {
41
+ :'tags' => :'Object',
37
42
  :'source' => :'DataSourceTypeNullable',
38
43
  :'ids' => :'Array<Integer>',
39
44
  :'revoked_access' => :'Boolean'
@@ -43,6 +48,7 @@ module Carbon
43
48
  # List of attributes with nullable: true
44
49
  def self.openapi_nullable
45
50
  Set.new([
51
+ :'tags',
46
52
  :'source',
47
53
  :'ids',
48
54
  :'revoked_access'
@@ -64,6 +70,10 @@ module Carbon
64
70
  h[k.to_sym] = v
65
71
  }
66
72
 
73
+ if attributes.key?(:'tags')
74
+ self.tags = attributes[:'tags']
75
+ end
76
+
67
77
  if attributes.key?(:'source')
68
78
  self.source = attributes[:'source']
69
79
  end
@@ -97,6 +107,7 @@ module Carbon
97
107
  def ==(o)
98
108
  return true if self.equal?(o)
99
109
  self.class == o.class &&
110
+ tags == o.tags &&
100
111
  source == o.source &&
101
112
  ids == o.ids &&
102
113
  revoked_access == o.revoked_access
@@ -111,7 +122,7 @@ module Carbon
111
122
  # Calculates hash code according to all attributes.
112
123
  # @return [Integer] Hash code
113
124
  def hash
114
- [source, ids, revoked_access].hash
125
+ [tags, source, ids, revoked_access].hash
115
126
  end
116
127
 
117
128
  # Builds the object from hash
@@ -0,0 +1,242 @@
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 RemoveDataSourceTagsInput
14
+ attr_accessor :data_source_id
15
+
16
+ attr_accessor :tags_to_remove
17
+
18
+ attr_accessor :remove_all_tags
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data_source_id' => :'data_source_id',
24
+ :'tags_to_remove' => :'tags_to_remove',
25
+ :'remove_all_tags' => :'remove_all_tags'
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
+ :'data_source_id' => :'Integer',
38
+ :'tags_to_remove' => :'Array<String>',
39
+ :'remove_all_tags' => :'Boolean'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::RemoveDataSourceTagsInput` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::RemoveDataSourceTagsInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'data_source_id')
65
+ self.data_source_id = attributes[:'data_source_id']
66
+ end
67
+
68
+ if attributes.key?(:'tags_to_remove')
69
+ if (value = attributes[:'tags_to_remove']).is_a?(Array)
70
+ self.tags_to_remove = value
71
+ end
72
+ end
73
+
74
+ if attributes.key?(:'remove_all_tags')
75
+ self.remove_all_tags = attributes[:'remove_all_tags']
76
+ else
77
+ self.remove_all_tags = false
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ if @data_source_id.nil?
86
+ invalid_properties.push('invalid value for "data_source_id", data_source_id cannot be nil.')
87
+ end
88
+
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ return false if @data_source_id.nil?
96
+ true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ data_source_id == o.data_source_id &&
105
+ tags_to_remove == o.tags_to_remove &&
106
+ remove_all_tags == o.remove_all_tags
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Integer] Hash code
117
+ def hash
118
+ [data_source_id, tags_to_remove, remove_all_tags].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ new.build_from_hash(attributes)
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ attributes = attributes.transform_keys(&:to_sym)
134
+ self.class.openapi_types.each_pair do |key, type|
135
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
136
+ self.send("#{key}=", nil)
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ # models (e.g. Pet) or oneOf
189
+ klass = Carbon.const_get(type)
190
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+
242
+ end