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,244 @@
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 AzureBlobStorageAuthentication
14
+ attr_accessor :source
15
+
16
+ attr_accessor :account_name
17
+
18
+ attr_accessor :account_key
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'source' => :'source',
24
+ :'account_name' => :'account_name',
25
+ :'account_key' => :'account_key'
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
+ :'source' => :'Object',
38
+ :'account_name' => :'String',
39
+ :'account_key' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ :'source',
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::AzureBlobStorageAuthentication` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::AzureBlobStorageAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'source')
66
+ self.source = attributes[:'source']
67
+ end
68
+
69
+ if attributes.key?(:'account_name')
70
+ self.account_name = attributes[:'account_name']
71
+ end
72
+
73
+ if attributes.key?(:'account_key')
74
+ self.account_key = attributes[:'account_key']
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 @account_name.nil?
83
+ invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
84
+ end
85
+
86
+ if @account_key.nil?
87
+ invalid_properties.push('invalid value for "account_key", account_key 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 @account_name.nil?
97
+ return false if @account_key.nil?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ source == o.source &&
107
+ account_name == o.account_name &&
108
+ account_key == o.account_key
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [source, account_name, account_key].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ attributes = attributes.transform_keys(&:to_sym)
136
+ self.class.openapi_types.each_pair do |key, type|
137
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
138
+ self.send("#{key}=", nil)
139
+ elsif type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
143
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ end
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :Time
160
+ Time.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :Boolean
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ # models (e.g. Pet) or oneOf
191
+ klass = Carbon.const_get(type)
192
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ if value.nil?
215
+ is_nullable = self.class.openapi_nullable.include?(attr)
216
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
+ end
218
+
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+
242
+ end
243
+
244
+ 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 BaseIncludes
14
+ TASKS = "Tasks".freeze
15
+ EVENTS = "Events".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [TASKS, EVENTS].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 BaseIncludes.all_vars.include?(value)
33
+ raise "Invalid ENUM value #{value} for class #BaseIncludes"
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,434 @@
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 Contact
14
+ attr_accessor :title
15
+
16
+ attr_accessor :description
17
+
18
+ attr_accessor :id
19
+
20
+ attr_accessor :owner
21
+
22
+ attr_accessor :first_name
23
+
24
+ attr_accessor :last_name
25
+
26
+ attr_accessor :name
27
+
28
+ attr_accessor :department
29
+
30
+ attr_accessor :addresses
31
+
32
+ attr_accessor :phone_numbers
33
+
34
+ attr_accessor :emails
35
+
36
+ attr_accessor :account
37
+
38
+ attr_accessor :last_activity_at
39
+
40
+ attr_accessor :created_at
41
+
42
+ attr_accessor :updated_at
43
+
44
+ attr_accessor :is_deleted
45
+
46
+ attr_accessor :tasks
47
+
48
+ attr_accessor :events
49
+
50
+ attr_accessor :remote_data
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'title' => :'title',
56
+ :'description' => :'description',
57
+ :'id' => :'id',
58
+ :'owner' => :'owner',
59
+ :'first_name' => :'first_name',
60
+ :'last_name' => :'last_name',
61
+ :'name' => :'name',
62
+ :'department' => :'department',
63
+ :'addresses' => :'addresses',
64
+ :'phone_numbers' => :'phone_numbers',
65
+ :'emails' => :'emails',
66
+ :'account' => :'account',
67
+ :'last_activity_at' => :'last_activity_at',
68
+ :'created_at' => :'created_at',
69
+ :'updated_at' => :'updated_at',
70
+ :'is_deleted' => :'is_deleted',
71
+ :'tasks' => :'tasks',
72
+ :'events' => :'events',
73
+ :'remote_data' => :'remote_data'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'title' => :'String',
86
+ :'description' => :'String',
87
+ :'id' => :'String',
88
+ :'owner' => :'PartialOwnerNullable',
89
+ :'first_name' => :'String',
90
+ :'last_name' => :'String',
91
+ :'name' => :'String',
92
+ :'department' => :'String',
93
+ :'addresses' => :'Array<Address>',
94
+ :'phone_numbers' => :'Array<PhoneNumber>',
95
+ :'emails' => :'Array<Email>',
96
+ :'account' => :'PartialAccountNullable',
97
+ :'last_activity_at' => :'String',
98
+ :'created_at' => :'String',
99
+ :'updated_at' => :'String',
100
+ :'is_deleted' => :'Boolean',
101
+ :'tasks' => :'Array<Task>',
102
+ :'events' => :'Array<Event>',
103
+ :'remote_data' => :'Object'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ :'title',
111
+ :'description',
112
+ :'owner',
113
+ :'first_name',
114
+ :'last_name',
115
+ :'name',
116
+ :'department',
117
+ :'account',
118
+ :'last_activity_at',
119
+ :'tasks',
120
+ :'events',
121
+ :'remote_data'
122
+ ])
123
+ end
124
+
125
+ # Initializes the object
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ def initialize(attributes = {})
128
+ if (!attributes.is_a?(Hash))
129
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::Contact` initialize method"
130
+ end
131
+
132
+ # check to see if the attribute exists and convert string to symbol for hash key
133
+ attributes = attributes.each_with_object({}) { |(k, v), h|
134
+ if (!self.class.attribute_map.key?(k.to_sym))
135
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::Contact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
136
+ end
137
+ h[k.to_sym] = v
138
+ }
139
+
140
+ if attributes.key?(:'title')
141
+ self.title = attributes[:'title']
142
+ end
143
+
144
+ if attributes.key?(:'description')
145
+ self.description = attributes[:'description']
146
+ end
147
+
148
+ if attributes.key?(:'id')
149
+ self.id = attributes[:'id']
150
+ end
151
+
152
+ if attributes.key?(:'owner')
153
+ self.owner = attributes[:'owner']
154
+ end
155
+
156
+ if attributes.key?(:'first_name')
157
+ self.first_name = attributes[:'first_name']
158
+ end
159
+
160
+ if attributes.key?(:'last_name')
161
+ self.last_name = attributes[:'last_name']
162
+ end
163
+
164
+ if attributes.key?(:'name')
165
+ self.name = attributes[:'name']
166
+ end
167
+
168
+ if attributes.key?(:'department')
169
+ self.department = attributes[:'department']
170
+ end
171
+
172
+ if attributes.key?(:'addresses')
173
+ if (value = attributes[:'addresses']).is_a?(Array)
174
+ self.addresses = value
175
+ end
176
+ end
177
+
178
+ if attributes.key?(:'phone_numbers')
179
+ if (value = attributes[:'phone_numbers']).is_a?(Array)
180
+ self.phone_numbers = value
181
+ end
182
+ end
183
+
184
+ if attributes.key?(:'emails')
185
+ if (value = attributes[:'emails']).is_a?(Array)
186
+ self.emails = value
187
+ end
188
+ end
189
+
190
+ if attributes.key?(:'account')
191
+ self.account = attributes[:'account']
192
+ end
193
+
194
+ if attributes.key?(:'last_activity_at')
195
+ self.last_activity_at = attributes[:'last_activity_at']
196
+ end
197
+
198
+ if attributes.key?(:'created_at')
199
+ self.created_at = attributes[:'created_at']
200
+ end
201
+
202
+ if attributes.key?(:'updated_at')
203
+ self.updated_at = attributes[:'updated_at']
204
+ end
205
+
206
+ if attributes.key?(:'is_deleted')
207
+ self.is_deleted = attributes[:'is_deleted']
208
+ end
209
+
210
+ if attributes.key?(:'tasks')
211
+ if (value = attributes[:'tasks']).is_a?(Array)
212
+ self.tasks = value
213
+ end
214
+ end
215
+
216
+ if attributes.key?(:'events')
217
+ if (value = attributes[:'events']).is_a?(Array)
218
+ self.events = value
219
+ end
220
+ end
221
+
222
+ if attributes.key?(:'remote_data')
223
+ self.remote_data = attributes[:'remote_data']
224
+ end
225
+ end
226
+
227
+ # Show invalid properties with the reasons. Usually used together with valid?
228
+ # @return Array for valid properties with the reasons
229
+ def list_invalid_properties
230
+ invalid_properties = Array.new
231
+ if @id.nil?
232
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
233
+ end
234
+
235
+ if @addresses.nil?
236
+ invalid_properties.push('invalid value for "addresses", addresses cannot be nil.')
237
+ end
238
+
239
+ if @phone_numbers.nil?
240
+ invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
241
+ end
242
+
243
+ if @emails.nil?
244
+ invalid_properties.push('invalid value for "emails", emails cannot be nil.')
245
+ end
246
+
247
+ if @created_at.nil?
248
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
249
+ end
250
+
251
+ if @updated_at.nil?
252
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
253
+ end
254
+
255
+ if @is_deleted.nil?
256
+ invalid_properties.push('invalid value for "is_deleted", is_deleted cannot be nil.')
257
+ end
258
+
259
+ invalid_properties
260
+ end
261
+
262
+ # Check to see if the all the properties in the model are valid
263
+ # @return true if the model is valid
264
+ def valid?
265
+ return false if @id.nil?
266
+ return false if @addresses.nil?
267
+ return false if @phone_numbers.nil?
268
+ return false if @emails.nil?
269
+ return false if @created_at.nil?
270
+ return false if @updated_at.nil?
271
+ return false if @is_deleted.nil?
272
+ true
273
+ end
274
+
275
+ # Checks equality by comparing each attribute.
276
+ # @param [Object] Object to be compared
277
+ def ==(o)
278
+ return true if self.equal?(o)
279
+ self.class == o.class &&
280
+ title == o.title &&
281
+ description == o.description &&
282
+ id == o.id &&
283
+ owner == o.owner &&
284
+ first_name == o.first_name &&
285
+ last_name == o.last_name &&
286
+ name == o.name &&
287
+ department == o.department &&
288
+ addresses == o.addresses &&
289
+ phone_numbers == o.phone_numbers &&
290
+ emails == o.emails &&
291
+ account == o.account &&
292
+ last_activity_at == o.last_activity_at &&
293
+ created_at == o.created_at &&
294
+ updated_at == o.updated_at &&
295
+ is_deleted == o.is_deleted &&
296
+ tasks == o.tasks &&
297
+ events == o.events &&
298
+ remote_data == o.remote_data
299
+ end
300
+
301
+ # @see the `==` method
302
+ # @param [Object] Object to be compared
303
+ def eql?(o)
304
+ self == o
305
+ end
306
+
307
+ # Calculates hash code according to all attributes.
308
+ # @return [Integer] Hash code
309
+ def hash
310
+ [title, description, id, owner, first_name, last_name, name, department, addresses, phone_numbers, emails, account, last_activity_at, created_at, updated_at, is_deleted, tasks, events, remote_data].hash
311
+ end
312
+
313
+ # Builds the object from hash
314
+ # @param [Hash] attributes Model attributes in the form of hash
315
+ # @return [Object] Returns the model itself
316
+ def self.build_from_hash(attributes)
317
+ new.build_from_hash(attributes)
318
+ end
319
+
320
+ # Builds the object from hash
321
+ # @param [Hash] attributes Model attributes in the form of hash
322
+ # @return [Object] Returns the model itself
323
+ def build_from_hash(attributes)
324
+ return nil unless attributes.is_a?(Hash)
325
+ attributes = attributes.transform_keys(&:to_sym)
326
+ self.class.openapi_types.each_pair do |key, type|
327
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
328
+ self.send("#{key}=", nil)
329
+ elsif type =~ /\AArray<(.*)>/i
330
+ # check to ensure the input is an array given that the attribute
331
+ # is documented as an array but the input is not
332
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
333
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
334
+ end
335
+ elsif !attributes[self.class.attribute_map[key]].nil?
336
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
337
+ end
338
+ end
339
+
340
+ self
341
+ end
342
+
343
+ # Deserializes the data based on type
344
+ # @param string type Data type
345
+ # @param string value Value to be deserialized
346
+ # @return [Object] Deserialized data
347
+ def _deserialize(type, value)
348
+ case type.to_sym
349
+ when :Time
350
+ Time.parse(value)
351
+ when :Date
352
+ Date.parse(value)
353
+ when :String
354
+ value.to_s
355
+ when :Integer
356
+ value.to_i
357
+ when :Float
358
+ value.to_f
359
+ when :Boolean
360
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
361
+ true
362
+ else
363
+ false
364
+ end
365
+ when :Object
366
+ # generic object (usually a Hash), return directly
367
+ value
368
+ when /\AArray<(?<inner_type>.+)>\z/
369
+ inner_type = Regexp.last_match[:inner_type]
370
+ value.map { |v| _deserialize(inner_type, v) }
371
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
372
+ k_type = Regexp.last_match[:k_type]
373
+ v_type = Regexp.last_match[:v_type]
374
+ {}.tap do |hash|
375
+ value.each do |k, v|
376
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
377
+ end
378
+ end
379
+ else # model
380
+ # models (e.g. Pet) or oneOf
381
+ klass = Carbon.const_get(type)
382
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
383
+ end
384
+ end
385
+
386
+ # Returns the string representation of the object
387
+ # @return [String] String presentation of the object
388
+ def to_s
389
+ to_hash.to_s
390
+ end
391
+
392
+ # to_body is an alias to to_hash (backward compatibility)
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_body
395
+ to_hash
396
+ end
397
+
398
+ # Returns the object in the form of hash
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_hash
401
+ hash = {}
402
+ self.class.attribute_map.each_pair do |attr, param|
403
+ value = self.send(attr)
404
+ if value.nil?
405
+ is_nullable = self.class.openapi_nullable.include?(attr)
406
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
407
+ end
408
+
409
+ hash[param] = _to_hash(value)
410
+ end
411
+ hash
412
+ end
413
+
414
+ # Outputs non-array value in the form of hash
415
+ # For object, use to_hash. Otherwise, just return the value
416
+ # @param [Object] value Any valid value
417
+ # @return [Hash] Returns the value in the form of hash
418
+ def _to_hash(value)
419
+ if value.is_a?(Array)
420
+ value.compact.map { |v| _to_hash(v) }
421
+ elsif value.is_a?(Hash)
422
+ {}.tap do |hash|
423
+ value.each { |k, v| hash[k] = _to_hash(v) }
424
+ end
425
+ elsif value.respond_to? :to_hash
426
+ value.to_hash
427
+ else
428
+ value
429
+ end
430
+ end
431
+
432
+ end
433
+
434
+ end