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,250 @@
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 OneDriveAuthentication
14
+ attr_accessor :source
15
+
16
+ attr_accessor :access_token
17
+
18
+ attr_accessor :refresh_token
19
+
20
+ attr_accessor :tenant_name
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'source' => :'source',
26
+ :'access_token' => :'access_token',
27
+ :'refresh_token' => :'refresh_token',
28
+ :'tenant_name' => :'tenant_name'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'source' => :'Object',
41
+ :'access_token' => :'String',
42
+ :'refresh_token' => :'String',
43
+ :'tenant_name' => :'String'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'source',
51
+ :'refresh_token',
52
+ :'tenant_name'
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::OneDriveAuthentication` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::OneDriveAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'source')
72
+ self.source = attributes[:'source']
73
+ end
74
+
75
+ if attributes.key?(:'access_token')
76
+ self.access_token = attributes[:'access_token']
77
+ end
78
+
79
+ if attributes.key?(:'refresh_token')
80
+ self.refresh_token = attributes[:'refresh_token']
81
+ end
82
+
83
+ if attributes.key?(:'tenant_name')
84
+ self.tenant_name = attributes[:'tenant_name']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ if @access_token.nil?
93
+ invalid_properties.push('invalid value for "access_token", access_token cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ return false if @access_token.nil?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ source == o.source &&
112
+ access_token == o.access_token &&
113
+ refresh_token == o.refresh_token &&
114
+ tenant_name == o.tenant_name
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [source, access_token, refresh_token, tenant_name].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ new.build_from_hash(attributes)
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
144
+ self.send("#{key}=", nil)
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = Carbon.const_get(type)
198
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,40 @@
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 OpportunitiesOrderBy
14
+ CREATED_AT = "created_at".freeze
15
+ UPDATED_AT = "updated_at".freeze
16
+ AMOUNT = "amount".freeze
17
+ NAME = "name".freeze
18
+ LAST_ACTIVITY_AT = "last_activity_at".freeze
19
+ CLOSE_DATE = "close_date".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [CREATED_AT, UPDATED_AT, AMOUNT, NAME, LAST_ACTIVITY_AT, CLOSE_DATE].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if OpportunitiesOrderBy.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #OpportunitiesOrderBy"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
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 OpportunitiesOrderByNullable
14
+ CREATED_AT = "created_at".freeze
15
+ UPDATED_AT = "updated_at".freeze
16
+ AMOUNT = "amount".freeze
17
+ NAME = "name".freeze
18
+ LAST_ACTIVITY_AT = "last_activity_at".freeze
19
+ CLOSE_DATE = "close_date".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [CREATED_AT, UPDATED_AT, AMOUNT, NAME, LAST_ACTIVITY_AT, CLOSE_DATE].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if OpportunitiesOrderByNullable.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #OpportunitiesOrderByNullable"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,293 @@
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 OpportunitiesRequest
14
+ attr_accessor :data_source_id
15
+
16
+ attr_accessor :include_remote_data
17
+
18
+ attr_accessor :next_cursor
19
+
20
+ attr_accessor :page_size
21
+
22
+ attr_accessor :order_dir
23
+
24
+ attr_accessor :includes
25
+
26
+ attr_accessor :filters
27
+
28
+ attr_accessor :order_by
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'data_source_id' => :'data_source_id',
34
+ :'include_remote_data' => :'include_remote_data',
35
+ :'next_cursor' => :'next_cursor',
36
+ :'page_size' => :'page_size',
37
+ :'order_dir' => :'order_dir',
38
+ :'includes' => :'includes',
39
+ :'filters' => :'filters',
40
+ :'order_by' => :'order_by'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'data_source_id' => :'Integer',
53
+ :'include_remote_data' => :'Boolean',
54
+ :'next_cursor' => :'String',
55
+ :'page_size' => :'Integer',
56
+ :'order_dir' => :'OrderDirV2Nullable',
57
+ :'includes' => :'Array<BaseIncludes>',
58
+ :'filters' => :'OpportunityFilters',
59
+ :'order_by' => :'OpportunitiesOrderByNullable'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ :'next_cursor',
67
+ :'page_size',
68
+ :'order_dir',
69
+ :'order_by'
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::OpportunitiesRequest` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::OpportunitiesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'data_source_id')
89
+ self.data_source_id = attributes[:'data_source_id']
90
+ end
91
+
92
+ if attributes.key?(:'include_remote_data')
93
+ self.include_remote_data = attributes[:'include_remote_data']
94
+ else
95
+ self.include_remote_data = false
96
+ end
97
+
98
+ if attributes.key?(:'next_cursor')
99
+ self.next_cursor = attributes[:'next_cursor']
100
+ end
101
+
102
+ if attributes.key?(:'page_size')
103
+ self.page_size = attributes[:'page_size']
104
+ end
105
+
106
+ if attributes.key?(:'order_dir')
107
+ self.order_dir = attributes[:'order_dir']
108
+ else
109
+ self.order_dir = 'asc'
110
+ end
111
+
112
+ if attributes.key?(:'includes')
113
+ if (value = attributes[:'includes']).is_a?(Array)
114
+ self.includes = value
115
+ end
116
+ end
117
+
118
+ if attributes.key?(:'filters')
119
+ self.filters = attributes[:'filters']
120
+ end
121
+
122
+ if attributes.key?(:'order_by')
123
+ self.order_by = attributes[:'order_by']
124
+ end
125
+ end
126
+
127
+ # Show invalid properties with the reasons. Usually used together with valid?
128
+ # @return Array for valid properties with the reasons
129
+ def list_invalid_properties
130
+ invalid_properties = Array.new
131
+ if @data_source_id.nil?
132
+ invalid_properties.push('invalid value for "data_source_id", data_source_id cannot be nil.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return false if @data_source_id.nil?
142
+ true
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ data_source_id == o.data_source_id &&
151
+ include_remote_data == o.include_remote_data &&
152
+ next_cursor == o.next_cursor &&
153
+ page_size == o.page_size &&
154
+ order_dir == o.order_dir &&
155
+ includes == o.includes &&
156
+ filters == o.filters &&
157
+ order_by == o.order_by
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [data_source_id, include_remote_data, next_cursor, page_size, order_dir, includes, filters, order_by].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ new.build_from_hash(attributes)
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ self.class.openapi_types.each_pair do |key, type|
186
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
187
+ self.send("#{key}=", nil)
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
192
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
193
+ end
194
+ elsif !attributes[self.class.attribute_map[key]].nil?
195
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
196
+ end
197
+ end
198
+
199
+ self
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def _deserialize(type, value)
207
+ case type.to_sym
208
+ when :Time
209
+ Time.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :Boolean
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ # models (e.g. Pet) or oneOf
240
+ klass = Carbon.const_get(type)
241
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
242
+ end
243
+ end
244
+
245
+ # Returns the string representation of the object
246
+ # @return [String] String presentation of the object
247
+ def to_s
248
+ to_hash.to_s
249
+ end
250
+
251
+ # to_body is an alias to to_hash (backward compatibility)
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_body
254
+ to_hash
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = self.send(attr)
263
+ if value.nil?
264
+ is_nullable = self.class.openapi_nullable.include?(attr)
265
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
+ end
267
+
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+
291
+ end
292
+
293
+ end