carbon_ruby_sdk 0.1.23 → 0.1.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +135 -9
- data/lib/carbon_ruby_sdk/api/embeddings_api.rb +2 -2
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +252 -18
- data/lib/carbon_ruby_sdk/api/organizations_api.rb +92 -0
- data/lib/carbon_ruby_sdk/api/users_api.rb +2 -2
- data/lib/carbon_ruby_sdk/models/chunks_and_embeddings_upload_input.rb +4 -2
- data/lib/carbon_ruby_sdk/models/custom_credentials_type.rb +39 -0
- data/lib/carbon_ruby_sdk/models/embedding_generators.rb +2 -1
- data/lib/carbon_ruby_sdk/models/embedding_generators_nullable.rb +2 -1
- data/lib/carbon_ruby_sdk/models/external_source_items_order_by.rb +37 -0
- data/lib/carbon_ruby_sdk/models/file_statistics.rb +15 -5
- data/lib/carbon_ruby_sdk/models/file_statistics_nullable.rb +15 -5
- data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +17 -5
- data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +17 -5
- data/lib/carbon_ruby_sdk/models/github_connect_request.rb +16 -4
- data/lib/carbon_ruby_sdk/models/github_fetch_repos_request.rb +260 -0
- data/lib/carbon_ruby_sdk/models/list_data_source_items_request.rb +26 -4
- data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +18 -6
- data/lib/carbon_ruby_sdk/models/order_dir_v2.rb +36 -0
- data/lib/carbon_ruby_sdk/models/organization_response.rb +15 -1
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +19 -5
- data/lib/carbon_ruby_sdk/models/s3_auth_request.rb +16 -4
- data/lib/carbon_ruby_sdk/models/sync_files_request.rb +1 -1
- data/lib/carbon_ruby_sdk/models/sync_options.rb +17 -5
- data/lib/carbon_ruby_sdk/models/text_embedding_generators.rb +7 -1
- data/lib/carbon_ruby_sdk/models/update_organization_input.rb +216 -0
- data/lib/carbon_ruby_sdk/models/update_users_input.rb +41 -41
- data/lib/carbon_ruby_sdk/models/user_configuration.rb +268 -0
- data/lib/carbon_ruby_sdk/models/user_configuration_nullable.rb +269 -0
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +7 -0
- data/spec/api/integrations_api_spec.rb +26 -0
- data/spec/api/organizations_api_spec.rb +11 -0
- data/spec/models/custom_credentials_type_spec.rb +22 -0
- data/spec/models/external_source_items_order_by_spec.rb +22 -0
- data/spec/models/file_statistics_nullable_spec.rb +6 -0
- data/spec/models/file_statistics_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/github_fetch_repos_request_spec.rb +34 -0
- data/spec/models/list_data_source_items_request_spec.rb +12 -0
- data/spec/models/o_auth_url_request_spec.rb +6 -0
- data/spec/models/order_dir_v2_spec.rb +22 -0
- data/spec/models/organization_response_spec.rb +6 -0
- data/spec/models/organization_user_data_source_api_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/update_organization_input_spec.rb +28 -0
- data/spec/models/update_users_input_spec.rb +4 -4
- data/spec/models/user_configuration_nullable_spec.rb +40 -0
- data/spec/models/user_configuration_spec.rb +40 -0
- metadata +23 -2
@@ -0,0 +1,216 @@
|
|
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 UpdateOrganizationInput
|
14
|
+
attr_accessor :global_user_config
|
15
|
+
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:'global_user_config' => :'global_user_config'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns all the JSON keys this model knows about
|
24
|
+
def self.acceptable_attributes
|
25
|
+
attribute_map.values
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.openapi_types
|
30
|
+
{
|
31
|
+
:'global_user_config' => :'UserConfigurationNullable'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# List of attributes with nullable: true
|
36
|
+
def self.openapi_nullable
|
37
|
+
Set.new([
|
38
|
+
:'global_user_config'
|
39
|
+
])
|
40
|
+
end
|
41
|
+
|
42
|
+
# Initializes the object
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
+
def initialize(attributes = {})
|
45
|
+
if (!attributes.is_a?(Hash))
|
46
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::UpdateOrganizationInput` initialize method"
|
47
|
+
end
|
48
|
+
|
49
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
50
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
51
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
52
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::UpdateOrganizationInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
53
|
+
end
|
54
|
+
h[k.to_sym] = v
|
55
|
+
}
|
56
|
+
|
57
|
+
if attributes.key?(:'global_user_config')
|
58
|
+
self.global_user_config = attributes[:'global_user_config']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
63
|
+
# @return Array for valid properties with the reasons
|
64
|
+
def list_invalid_properties
|
65
|
+
invalid_properties = Array.new
|
66
|
+
invalid_properties
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check to see if the all the properties in the model are valid
|
70
|
+
# @return true if the model is valid
|
71
|
+
def valid?
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
# Checks equality by comparing each attribute.
|
76
|
+
# @param [Object] Object to be compared
|
77
|
+
def ==(o)
|
78
|
+
return true if self.equal?(o)
|
79
|
+
self.class == o.class &&
|
80
|
+
global_user_config == o.global_user_config
|
81
|
+
end
|
82
|
+
|
83
|
+
# @see the `==` method
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def eql?(o)
|
86
|
+
self == o
|
87
|
+
end
|
88
|
+
|
89
|
+
# Calculates hash code according to all attributes.
|
90
|
+
# @return [Integer] Hash code
|
91
|
+
def hash
|
92
|
+
[global_user_config].hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# Builds the object from hash
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
# @return [Object] Returns the model itself
|
98
|
+
def self.build_from_hash(attributes)
|
99
|
+
new.build_from_hash(attributes)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Builds the object from hash
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
# @return [Object] Returns the model itself
|
105
|
+
def build_from_hash(attributes)
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
107
|
+
attributes = attributes.transform_keys(&:to_sym)
|
108
|
+
self.class.openapi_types.each_pair do |key, type|
|
109
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
110
|
+
self.send("#{key}=", nil)
|
111
|
+
elsif type =~ /\AArray<(.*)>/i
|
112
|
+
# check to ensure the input is an array given that the attribute
|
113
|
+
# is documented as an array but the input is not
|
114
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
115
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
116
|
+
end
|
117
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
118
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
self
|
123
|
+
end
|
124
|
+
|
125
|
+
# Deserializes the data based on type
|
126
|
+
# @param string type Data type
|
127
|
+
# @param string value Value to be deserialized
|
128
|
+
# @return [Object] Deserialized data
|
129
|
+
def _deserialize(type, value)
|
130
|
+
case type.to_sym
|
131
|
+
when :Time
|
132
|
+
Time.parse(value)
|
133
|
+
when :Date
|
134
|
+
Date.parse(value)
|
135
|
+
when :String
|
136
|
+
value.to_s
|
137
|
+
when :Integer
|
138
|
+
value.to_i
|
139
|
+
when :Float
|
140
|
+
value.to_f
|
141
|
+
when :Boolean
|
142
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
|
+
true
|
144
|
+
else
|
145
|
+
false
|
146
|
+
end
|
147
|
+
when :Object
|
148
|
+
# generic object (usually a Hash), return directly
|
149
|
+
value
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
153
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
156
|
+
{}.tap do |hash|
|
157
|
+
value.each do |k, v|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
else # model
|
162
|
+
# models (e.g. Pet) or oneOf
|
163
|
+
klass = Carbon.const_get(type)
|
164
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the string representation of the object
|
169
|
+
# @return [String] String presentation of the object
|
170
|
+
def to_s
|
171
|
+
to_hash.to_s
|
172
|
+
end
|
173
|
+
|
174
|
+
# to_body is an alias to to_hash (backward compatibility)
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_body
|
177
|
+
to_hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the object in the form of hash
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
182
|
+
def to_hash
|
183
|
+
hash = {}
|
184
|
+
self.class.attribute_map.each_pair do |attr, param|
|
185
|
+
value = self.send(attr)
|
186
|
+
if value.nil?
|
187
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
188
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
189
|
+
end
|
190
|
+
|
191
|
+
hash[param] = _to_hash(value)
|
192
|
+
end
|
193
|
+
hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Outputs non-array value in the form of hash
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
198
|
+
# @param [Object] value Any valid value
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
200
|
+
def _to_hash(value)
|
201
|
+
if value.is_a?(Array)
|
202
|
+
value.compact.map { |v| _to_hash(v) }
|
203
|
+
elsif value.is_a?(Hash)
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
206
|
+
end
|
207
|
+
elsif value.respond_to? :to_hash
|
208
|
+
value.to_hash
|
209
|
+
else
|
210
|
+
value
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
@@ -11,9 +11,6 @@ require 'time'
|
|
11
11
|
|
12
12
|
module Carbon
|
13
13
|
class UpdateUsersInput
|
14
|
-
# List of organization supplied user IDs
|
15
|
-
attr_accessor :customer_ids
|
16
|
-
|
17
14
|
attr_accessor :auto_sync_enabled_sources
|
18
15
|
|
19
16
|
# Custom file upload limit for the user over *all* user's files across all uploads. If set, then the user will not be allowed to upload more files than this limit. If not set, or if set to -1, then the user will have no limit.
|
@@ -22,13 +19,16 @@ module Carbon
|
|
22
19
|
# Custom file upload limit for the user across a single upload. If set, then the user will not be allowed to upload more files than this limit in a single upload. If not set, or if set to -1, then the user will have no limit.
|
23
20
|
attr_accessor :max_files_per_upload
|
24
21
|
|
22
|
+
# List of organization supplied user IDs
|
23
|
+
attr_accessor :customer_ids
|
24
|
+
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
26
|
def self.attribute_map
|
27
27
|
{
|
28
|
-
:'customer_ids' => :'customer_ids',
|
29
28
|
:'auto_sync_enabled_sources' => :'auto_sync_enabled_sources',
|
30
29
|
:'max_files' => :'max_files',
|
31
|
-
:'max_files_per_upload' => :'max_files_per_upload'
|
30
|
+
:'max_files_per_upload' => :'max_files_per_upload',
|
31
|
+
:'customer_ids' => :'customer_ids'
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -40,10 +40,10 @@ module Carbon
|
|
40
40
|
# Attribute type mapping.
|
41
41
|
def self.openapi_types
|
42
42
|
{
|
43
|
-
:'customer_ids' => :'Array<String>',
|
44
43
|
:'auto_sync_enabled_sources' => :'AutoSyncEnabledSourcesProperty',
|
45
44
|
:'max_files' => :'Integer',
|
46
|
-
:'max_files_per_upload' => :'Integer'
|
45
|
+
:'max_files_per_upload' => :'Integer',
|
46
|
+
:'customer_ids' => :'Array<String>'
|
47
47
|
}
|
48
48
|
end
|
49
49
|
|
@@ -52,7 +52,7 @@ module Carbon
|
|
52
52
|
Set.new([
|
53
53
|
:'auto_sync_enabled_sources',
|
54
54
|
:'max_files',
|
55
|
-
:'max_files_per_upload'
|
55
|
+
:'max_files_per_upload',
|
56
56
|
])
|
57
57
|
end
|
58
58
|
|
@@ -71,12 +71,6 @@ module Carbon
|
|
71
71
|
h[k.to_sym] = v
|
72
72
|
}
|
73
73
|
|
74
|
-
if attributes.key?(:'customer_ids')
|
75
|
-
if (value = attributes[:'customer_ids']).is_a?(Array)
|
76
|
-
self.customer_ids = value
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
74
|
if attributes.key?(:'auto_sync_enabled_sources')
|
81
75
|
self.auto_sync_enabled_sources = attributes[:'auto_sync_enabled_sources']
|
82
76
|
end
|
@@ -88,20 +82,18 @@ module Carbon
|
|
88
82
|
if attributes.key?(:'max_files_per_upload')
|
89
83
|
self.max_files_per_upload = attributes[:'max_files_per_upload']
|
90
84
|
end
|
85
|
+
|
86
|
+
if attributes.key?(:'customer_ids')
|
87
|
+
if (value = attributes[:'customer_ids']).is_a?(Array)
|
88
|
+
self.customer_ids = value
|
89
|
+
end
|
90
|
+
end
|
91
91
|
end
|
92
92
|
|
93
93
|
# Show invalid properties with the reasons. Usually used together with valid?
|
94
94
|
# @return Array for valid properties with the reasons
|
95
95
|
def list_invalid_properties
|
96
96
|
invalid_properties = Array.new
|
97
|
-
if @customer_ids.nil?
|
98
|
-
invalid_properties.push('invalid value for "customer_ids", customer_ids cannot be nil.')
|
99
|
-
end
|
100
|
-
|
101
|
-
if @customer_ids.length > 100
|
102
|
-
invalid_properties.push('invalid value for "customer_ids", number of items must be less than or equal to 100.')
|
103
|
-
end
|
104
|
-
|
105
97
|
if !@max_files.nil? && @max_files < -1
|
106
98
|
invalid_properties.push('invalid value for "max_files", must be greater than or equal to -1.')
|
107
99
|
end
|
@@ -110,33 +102,27 @@ module Carbon
|
|
110
102
|
invalid_properties.push('invalid value for "max_files_per_upload", must be greater than or equal to -1.')
|
111
103
|
end
|
112
104
|
|
105
|
+
if @customer_ids.nil?
|
106
|
+
invalid_properties.push('invalid value for "customer_ids", customer_ids cannot be nil.')
|
107
|
+
end
|
108
|
+
|
109
|
+
if @customer_ids.length > 100
|
110
|
+
invalid_properties.push('invalid value for "customer_ids", number of items must be less than or equal to 100.')
|
111
|
+
end
|
112
|
+
|
113
113
|
invalid_properties
|
114
114
|
end
|
115
115
|
|
116
116
|
# Check to see if the all the properties in the model are valid
|
117
117
|
# @return true if the model is valid
|
118
118
|
def valid?
|
119
|
-
return false if @customer_ids.nil?
|
120
|
-
return false if @customer_ids.length > 100
|
121
119
|
return false if !@max_files.nil? && @max_files < -1
|
122
120
|
return false if !@max_files_per_upload.nil? && @max_files_per_upload < -1
|
121
|
+
return false if @customer_ids.nil?
|
122
|
+
return false if @customer_ids.length > 100
|
123
123
|
true
|
124
124
|
end
|
125
125
|
|
126
|
-
# Custom attribute writer method with validation
|
127
|
-
# @param [Object] customer_ids Value to be assigned
|
128
|
-
def customer_ids=(customer_ids)
|
129
|
-
if customer_ids.nil?
|
130
|
-
fail ArgumentError, 'customer_ids cannot be nil'
|
131
|
-
end
|
132
|
-
|
133
|
-
if customer_ids.length > 100
|
134
|
-
fail ArgumentError, 'invalid value for "customer_ids", number of items must be less than or equal to 100.'
|
135
|
-
end
|
136
|
-
|
137
|
-
@customer_ids = customer_ids
|
138
|
-
end
|
139
|
-
|
140
126
|
# Custom attribute writer method with validation
|
141
127
|
# @param [Object] max_files Value to be assigned
|
142
128
|
def max_files=(max_files)
|
@@ -157,15 +143,29 @@ module Carbon
|
|
157
143
|
@max_files_per_upload = max_files_per_upload
|
158
144
|
end
|
159
145
|
|
146
|
+
# Custom attribute writer method with validation
|
147
|
+
# @param [Object] customer_ids Value to be assigned
|
148
|
+
def customer_ids=(customer_ids)
|
149
|
+
if customer_ids.nil?
|
150
|
+
fail ArgumentError, 'customer_ids cannot be nil'
|
151
|
+
end
|
152
|
+
|
153
|
+
if customer_ids.length > 100
|
154
|
+
fail ArgumentError, 'invalid value for "customer_ids", number of items must be less than or equal to 100.'
|
155
|
+
end
|
156
|
+
|
157
|
+
@customer_ids = customer_ids
|
158
|
+
end
|
159
|
+
|
160
160
|
# Checks equality by comparing each attribute.
|
161
161
|
# @param [Object] Object to be compared
|
162
162
|
def ==(o)
|
163
163
|
return true if self.equal?(o)
|
164
164
|
self.class == o.class &&
|
165
|
-
customer_ids == o.customer_ids &&
|
166
165
|
auto_sync_enabled_sources == o.auto_sync_enabled_sources &&
|
167
166
|
max_files == o.max_files &&
|
168
|
-
max_files_per_upload == o.max_files_per_upload
|
167
|
+
max_files_per_upload == o.max_files_per_upload &&
|
168
|
+
customer_ids == o.customer_ids
|
169
169
|
end
|
170
170
|
|
171
171
|
# @see the `==` method
|
@@ -177,7 +177,7 @@ module Carbon
|
|
177
177
|
# Calculates hash code according to all attributes.
|
178
178
|
# @return [Integer] Hash code
|
179
179
|
def hash
|
180
|
-
[
|
180
|
+
[auto_sync_enabled_sources, max_files, max_files_per_upload, customer_ids].hash
|
181
181
|
end
|
182
182
|
|
183
183
|
# Builds the object from hash
|
@@ -0,0 +1,268 @@
|
|
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 UserConfiguration
|
14
|
+
attr_accessor :auto_sync_enabled_sources
|
15
|
+
|
16
|
+
# Custom file upload limit for the user over *all* user's files across all uploads. If set, then the user will not be allowed to upload more files than this limit. If not set, or if set to -1, then the user will have no limit.
|
17
|
+
attr_accessor :max_files
|
18
|
+
|
19
|
+
# Custom file upload limit for the user across a single upload. If set, then the user will not be allowed to upload more files than this limit in a single upload. If not set, or if set to -1, then the user will have no limit.
|
20
|
+
attr_accessor :max_files_per_upload
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'auto_sync_enabled_sources' => :'auto_sync_enabled_sources',
|
26
|
+
:'max_files' => :'max_files',
|
27
|
+
:'max_files_per_upload' => :'max_files_per_upload'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns all the JSON keys this model knows about
|
32
|
+
def self.acceptable_attributes
|
33
|
+
attribute_map.values
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.openapi_types
|
38
|
+
{
|
39
|
+
:'auto_sync_enabled_sources' => :'AutoSyncEnabledSourcesProperty',
|
40
|
+
:'max_files' => :'Integer',
|
41
|
+
:'max_files_per_upload' => :'Integer'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
:'auto_sync_enabled_sources',
|
49
|
+
:'max_files',
|
50
|
+
:'max_files_per_upload'
|
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::UserConfiguration` 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::UserConfiguration`. 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?(:'auto_sync_enabled_sources')
|
70
|
+
self.auto_sync_enabled_sources = attributes[:'auto_sync_enabled_sources']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'max_files')
|
74
|
+
self.max_files = attributes[:'max_files']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'max_files_per_upload')
|
78
|
+
self.max_files_per_upload = attributes[:'max_files_per_upload']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
if !@max_files.nil? && @max_files < -1
|
87
|
+
invalid_properties.push('invalid value for "max_files", must be greater than or equal to -1.')
|
88
|
+
end
|
89
|
+
|
90
|
+
if !@max_files_per_upload.nil? && @max_files_per_upload < -1
|
91
|
+
invalid_properties.push('invalid value for "max_files_per_upload", must be greater than or equal to -1.')
|
92
|
+
end
|
93
|
+
|
94
|
+
invalid_properties
|
95
|
+
end
|
96
|
+
|
97
|
+
# Check to see if the all the properties in the model are valid
|
98
|
+
# @return true if the model is valid
|
99
|
+
def valid?
|
100
|
+
return false if !@max_files.nil? && @max_files < -1
|
101
|
+
return false if !@max_files_per_upload.nil? && @max_files_per_upload < -1
|
102
|
+
true
|
103
|
+
end
|
104
|
+
|
105
|
+
# Custom attribute writer method with validation
|
106
|
+
# @param [Object] max_files Value to be assigned
|
107
|
+
def max_files=(max_files)
|
108
|
+
if !max_files.nil? && max_files < -1
|
109
|
+
fail ArgumentError, 'invalid value for "max_files", must be greater than or equal to -1.'
|
110
|
+
end
|
111
|
+
|
112
|
+
@max_files = max_files
|
113
|
+
end
|
114
|
+
|
115
|
+
# Custom attribute writer method with validation
|
116
|
+
# @param [Object] max_files_per_upload Value to be assigned
|
117
|
+
def max_files_per_upload=(max_files_per_upload)
|
118
|
+
if !max_files_per_upload.nil? && max_files_per_upload < -1
|
119
|
+
fail ArgumentError, 'invalid value for "max_files_per_upload", must be greater than or equal to -1.'
|
120
|
+
end
|
121
|
+
|
122
|
+
@max_files_per_upload = max_files_per_upload
|
123
|
+
end
|
124
|
+
|
125
|
+
# Checks equality by comparing each attribute.
|
126
|
+
# @param [Object] Object to be compared
|
127
|
+
def ==(o)
|
128
|
+
return true if self.equal?(o)
|
129
|
+
self.class == o.class &&
|
130
|
+
auto_sync_enabled_sources == o.auto_sync_enabled_sources &&
|
131
|
+
max_files == o.max_files &&
|
132
|
+
max_files_per_upload == o.max_files_per_upload
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Integer] Hash code
|
143
|
+
def hash
|
144
|
+
[auto_sync_enabled_sources, max_files, max_files_per_upload].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Builds the object from hash
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
+
# @return [Object] Returns the model itself
|
150
|
+
def self.build_from_hash(attributes)
|
151
|
+
new.build_from_hash(attributes)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
attributes = attributes.transform_keys(&:to_sym)
|
160
|
+
self.class.openapi_types.each_pair do |key, type|
|
161
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
162
|
+
self.send("#{key}=", nil)
|
163
|
+
elsif type =~ /\AArray<(.*)>/i
|
164
|
+
# check to ensure the input is an array given that the attribute
|
165
|
+
# is documented as an array but the input is not
|
166
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
167
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
168
|
+
end
|
169
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
170
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
self
|
175
|
+
end
|
176
|
+
|
177
|
+
# Deserializes the data based on type
|
178
|
+
# @param string type Data type
|
179
|
+
# @param string value Value to be deserialized
|
180
|
+
# @return [Object] Deserialized data
|
181
|
+
def _deserialize(type, value)
|
182
|
+
case type.to_sym
|
183
|
+
when :Time
|
184
|
+
Time.parse(value)
|
185
|
+
when :Date
|
186
|
+
Date.parse(value)
|
187
|
+
when :String
|
188
|
+
value.to_s
|
189
|
+
when :Integer
|
190
|
+
value.to_i
|
191
|
+
when :Float
|
192
|
+
value.to_f
|
193
|
+
when :Boolean
|
194
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
195
|
+
true
|
196
|
+
else
|
197
|
+
false
|
198
|
+
end
|
199
|
+
when :Object
|
200
|
+
# generic object (usually a Hash), return directly
|
201
|
+
value
|
202
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
203
|
+
inner_type = Regexp.last_match[:inner_type]
|
204
|
+
value.map { |v| _deserialize(inner_type, v) }
|
205
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
206
|
+
k_type = Regexp.last_match[:k_type]
|
207
|
+
v_type = Regexp.last_match[:v_type]
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each do |k, v|
|
210
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
else # model
|
214
|
+
# models (e.g. Pet) or oneOf
|
215
|
+
klass = Carbon.const_get(type)
|
216
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the string representation of the object
|
221
|
+
# @return [String] String presentation of the object
|
222
|
+
def to_s
|
223
|
+
to_hash.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
# to_body is an alias to to_hash (backward compatibility)
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_body
|
229
|
+
to_hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = self.send(attr)
|
238
|
+
if value.nil?
|
239
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
240
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
241
|
+
end
|
242
|
+
|
243
|
+
hash[param] = _to_hash(value)
|
244
|
+
end
|
245
|
+
hash
|
246
|
+
end
|
247
|
+
|
248
|
+
# Outputs non-array value in the form of hash
|
249
|
+
# For object, use to_hash. Otherwise, just return the value
|
250
|
+
# @param [Object] value Any valid value
|
251
|
+
# @return [Hash] Returns the value in the form of hash
|
252
|
+
def _to_hash(value)
|
253
|
+
if value.is_a?(Array)
|
254
|
+
value.compact.map { |v| _to_hash(v) }
|
255
|
+
elsif value.is_a?(Hash)
|
256
|
+
{}.tap do |hash|
|
257
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
258
|
+
end
|
259
|
+
elsif value.respond_to? :to_hash
|
260
|
+
value.to_hash
|
261
|
+
else
|
262
|
+
value
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|