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,246 @@
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 ContactsResponse
14
+ attr_accessor :count
15
+
16
+ attr_accessor :next_cursor
17
+
18
+ attr_accessor :data
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'count' => :'count',
24
+ :'next_cursor' => :'next_cursor',
25
+ :'data' => :'data'
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
+ :'count' => :'Integer',
38
+ :'next_cursor' => :'String',
39
+ :'data' => :'Array<Contact>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ :'next_cursor',
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::ContactsResponse` 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::ContactsResponse`. 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?(:'count')
66
+ self.count = attributes[:'count']
67
+ end
68
+
69
+ if attributes.key?(:'next_cursor')
70
+ self.next_cursor = attributes[:'next_cursor']
71
+ end
72
+
73
+ if attributes.key?(:'data')
74
+ if (value = attributes[:'data']).is_a?(Array)
75
+ self.data = value
76
+ end
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ if @count.nil?
85
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
86
+ end
87
+
88
+ if @data.nil?
89
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return false if @count.nil?
99
+ return false if @data.nil?
100
+ true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ count == o.count &&
109
+ next_cursor == o.next_cursor &&
110
+ data == o.data
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [count, next_cursor, data].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ attributes = attributes.transform_keys(&:to_sym)
138
+ self.class.openapi_types.each_pair do |key, type|
139
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
140
+ self.send("#{key}=", nil)
141
+ elsif type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :Time
162
+ Time.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ # models (e.g. Pet) or oneOf
193
+ klass = Carbon.const_get(type)
194
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+
244
+ end
245
+
246
+ end
@@ -24,6 +24,7 @@ module Carbon
24
24
  ZENDESK = "ZENDESK".freeze
25
25
  ZOTERO = "ZOTERO".freeze
26
26
  S3 = "S3".freeze
27
+ AZURE_BLOB_STORAGE = "AZURE_BLOB_STORAGE".freeze
27
28
  GMAIL = "GMAIL".freeze
28
29
  OUTLOOK = "OUTLOOK".freeze
29
30
  SERVICENOW = "SERVICENOW".freeze
@@ -73,7 +74,7 @@ module Carbon
73
74
  MSG = "MSG".freeze
74
75
 
75
76
  def self.all_vars
76
- @all_vars ||= [GOOGLE_CLOUD_STORAGE, GOOGLE_DRIVE, NOTION, NOTION_DATABASE, INTERCOM, DROPBOX, ONEDRIVE, SHAREPOINT, CONFLUENCE, BOX, ZENDESK, ZOTERO, S3, GMAIL, OUTLOOK, SERVICENOW, TEXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, RAW_TEXT, WEB_SCRAPE, RSS_FEED, FRESHDESK, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, GONG, JPG, PNG, JPEG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
77
+ @all_vars ||= [GOOGLE_CLOUD_STORAGE, GOOGLE_DRIVE, NOTION, NOTION_DATABASE, INTERCOM, DROPBOX, ONEDRIVE, SHAREPOINT, CONFLUENCE, BOX, ZENDESK, ZOTERO, S3, AZURE_BLOB_STORAGE, GMAIL, OUTLOOK, SERVICENOW, TEXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, RAW_TEXT, WEB_SCRAPE, RSS_FEED, FRESHDESK, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, GONG, JPG, PNG, JPEG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
77
78
  end
78
79
 
79
80
  # Builds the enum from string
@@ -24,6 +24,7 @@ module Carbon
24
24
  ZENDESK = "ZENDESK".freeze
25
25
  ZOTERO = "ZOTERO".freeze
26
26
  S3 = "S3".freeze
27
+ AZURE_BLOB_STORAGE = "AZURE_BLOB_STORAGE".freeze
27
28
  GMAIL = "GMAIL".freeze
28
29
  OUTLOOK = "OUTLOOK".freeze
29
30
  SERVICENOW = "SERVICENOW".freeze
@@ -73,7 +74,7 @@ module Carbon
73
74
  MSG = "MSG".freeze
74
75
 
75
76
  def self.all_vars
76
- @all_vars ||= [GOOGLE_CLOUD_STORAGE, GOOGLE_DRIVE, NOTION, NOTION_DATABASE, INTERCOM, DROPBOX, ONEDRIVE, SHAREPOINT, CONFLUENCE, BOX, ZENDESK, ZOTERO, S3, GMAIL, OUTLOOK, SERVICENOW, TEXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, RAW_TEXT, WEB_SCRAPE, RSS_FEED, FRESHDESK, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, GONG, JPG, PNG, JPEG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
77
+ @all_vars ||= [GOOGLE_CLOUD_STORAGE, GOOGLE_DRIVE, NOTION, NOTION_DATABASE, INTERCOM, DROPBOX, ONEDRIVE, SHAREPOINT, CONFLUENCE, BOX, ZENDESK, ZOTERO, S3, AZURE_BLOB_STORAGE, GMAIL, OUTLOOK, SERVICENOW, TEXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, HTML, RAW_TEXT, WEB_SCRAPE, RSS_FEED, FRESHDESK, GITBOOK, SALESFORCE, GITHUB, SLACK, GURU, GONG, JPG, PNG, JPEG, MP3, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, MPEG, MPG, MP4, WMV, AVI, MOV, MKV, FLV, WEBM, EML, MSG].freeze
77
78
  end
78
79
 
79
80
  # Builds the enum from string
@@ -0,0 +1,230 @@
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 Email
14
+ attr_accessor :email
15
+
16
+ attr_accessor :email_type
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'email' => :'email',
22
+ :'email_type' => :'email_type'
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
+ :'email' => :'String',
35
+ :'email_type' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ :'email_type'
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::Email` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::Email`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'email')
62
+ self.email = attributes[:'email']
63
+ end
64
+
65
+ if attributes.key?(:'email_type')
66
+ self.email_type = attributes[:'email_type']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @email.nil?
75
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
76
+ end
77
+
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ return false if @email.nil?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ email == o.email &&
94
+ email_type == o.email_type
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [email, email_type].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ self.class.openapi_types.each_pair do |key, type|
123
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
124
+ self.send("#{key}=", nil)
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :Time
146
+ Time.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ # models (e.g. Pet) or oneOf
177
+ klass = Carbon.const_get(type)
178
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end