mailslurp_client 15.9.0 → 15.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/api_user_controller_api.rb +74 -0
  3. data/lib/mailslurp_client/api/attachment_controller_api.rb +4 -4
  4. data/lib/mailslurp_client/api/email_controller_api.rb +68 -3
  5. data/lib/mailslurp_client/api/inbox_controller_api.rb +138 -0
  6. data/lib/mailslurp_client/api/missed_email_controller_api.rb +56 -0
  7. data/lib/mailslurp_client/api/phone_controller_api.rb +487 -0
  8. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +73 -0
  9. data/lib/mailslurp_client/api/sms_controller_api.rb +286 -0
  10. data/lib/mailslurp_client/api/template_controller_api.rb +124 -0
  11. data/lib/mailslurp_client/api/wait_for_controller_api.rb +64 -0
  12. data/lib/mailslurp_client/api/webhook_controller_api.rb +2 -2
  13. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +2 -2
  14. data/lib/mailslurp_client/models/alias_projection.rb +31 -31
  15. data/lib/mailslurp_client/models/attachment_entity.rb +10 -1
  16. data/lib/mailslurp_client/models/attachment_projection.rb +14 -14
  17. data/lib/mailslurp_client/models/bounce_projection.rb +31 -4
  18. data/lib/mailslurp_client/models/{bounce_recipient.rb → bounce_recipient_projection.rb} +35 -36
  19. data/lib/mailslurp_client/models/bounced_email_dto.rb +19 -1
  20. data/lib/mailslurp_client/models/bounced_recipient_dto.rb +37 -1
  21. data/lib/mailslurp_client/models/contact_projection.rb +18 -13
  22. data/lib/mailslurp_client/models/create_emergency_address_options.rb +324 -0
  23. data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
  24. data/lib/mailslurp_client/models/email_html_dto.rb +215 -0
  25. data/lib/mailslurp_client/models/email_preview.rb +5 -0
  26. data/lib/mailslurp_client/models/email_projection.rb +29 -19
  27. data/lib/mailslurp_client/models/emergency_address.rb +408 -0
  28. data/lib/mailslurp_client/models/emergency_address_dto.rb +273 -0
  29. data/lib/mailslurp_client/models/empty_response_dto.rb +206 -0
  30. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  31. data/lib/mailslurp_client/models/inbox_by_name_result.rb +221 -0
  32. data/lib/mailslurp_client/models/inbox_dto.rb +11 -1
  33. data/lib/mailslurp_client/models/inbox_preview.rb +5 -0
  34. data/lib/mailslurp_client/models/missed_email.rb +37 -1
  35. data/lib/mailslurp_client/models/organization_inbox_projection.rb +5 -0
  36. data/lib/mailslurp_client/models/page_alias.rb +22 -22
  37. data/lib/mailslurp_client/models/page_attachment_entity.rb +22 -22
  38. data/lib/mailslurp_client/models/page_bounced_email.rb +22 -22
  39. data/lib/mailslurp_client/models/page_bounced_recipients.rb +23 -23
  40. data/lib/mailslurp_client/models/page_contact_projection.rb +22 -22
  41. data/lib/mailslurp_client/models/page_email_preview.rb +22 -22
  42. data/lib/mailslurp_client/models/page_email_projection.rb +22 -22
  43. data/lib/mailslurp_client/models/page_email_validation_request.rb +22 -22
  44. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +22 -22
  45. data/lib/mailslurp_client/models/page_group_projection.rb +22 -22
  46. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +22 -22
  47. data/lib/mailslurp_client/models/page_inbox_projection.rb +22 -22
  48. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +22 -22
  49. data/lib/mailslurp_client/models/page_missed_email_projection.rb +22 -22
  50. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +22 -22
  51. data/lib/mailslurp_client/models/page_phone_number_projection.rb +308 -0
  52. data/lib/mailslurp_client/models/page_sent_email_projection.rb +16 -16
  53. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +344 -0
  54. data/lib/mailslurp_client/models/page_sms_projection.rb +308 -0
  55. data/lib/mailslurp_client/models/page_template_projection.rb +22 -22
  56. data/lib/mailslurp_client/models/page_thread_projection.rb +22 -22
  57. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +22 -22
  58. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +22 -22
  59. data/lib/mailslurp_client/models/page_webhook_projection.rb +22 -22
  60. data/lib/mailslurp_client/models/page_webhook_result.rb +22 -22
  61. data/lib/mailslurp_client/models/phone_number_dto.rb +347 -0
  62. data/lib/mailslurp_client/models/phone_number_projection.rb +302 -0
  63. data/lib/mailslurp_client/models/phone_plan_dto.rb +287 -0
  64. data/lib/mailslurp_client/models/send_with_queue_result.rb +318 -0
  65. data/lib/mailslurp_client/models/sent_email_projection.rb +18 -13
  66. data/lib/mailslurp_client/models/sms_match_option.rb +289 -0
  67. data/lib/mailslurp_client/models/sms_message.rb +318 -0
  68. data/lib/mailslurp_client/models/sms_preview.rb +267 -0
  69. data/lib/mailslurp_client/models/sms_projection.rb +282 -0
  70. data/lib/mailslurp_client/models/template_preview.rb +211 -0
  71. data/lib/mailslurp_client/models/template_projection.rb +18 -18
  72. data/lib/mailslurp_client/models/thread_projection.rb +36 -36
  73. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +19 -19
  74. data/lib/mailslurp_client/models/user_info_dto.rb +334 -0
  75. data/lib/mailslurp_client/models/wait_for_sms_conditions.rb +371 -0
  76. data/lib/mailslurp_client/models/webhook_bounce_payload.rb +2 -2
  77. data/lib/mailslurp_client/models/webhook_bounce_recipient_payload.rb +2 -2
  78. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  79. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +2 -2
  80. data/lib/mailslurp_client/models/webhook_email_read_payload.rb +2 -2
  81. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  82. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +7 -2
  83. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  84. data/lib/mailslurp_client/models/webhook_projection.rb +2 -2
  85. data/lib/mailslurp_client/models/webhook_result_dto.rb +7 -2
  86. data/lib/mailslurp_client/version.rb +1 -1
  87. data/lib/mailslurp_client.rb +24 -1
  88. metadata +26 -3
@@ -24,27 +24,27 @@ module MailSlurpClient
24
24
  # Thread subject
25
25
  attr_accessor :subject
26
26
 
27
- # Inbox ID
28
- attr_accessor :inbox_id
29
-
30
27
  # User ID
31
28
  attr_accessor :user_id
32
29
 
30
+ # Inbox ID
31
+ attr_accessor :inbox_id
32
+
33
33
  # To recipients
34
34
  attr_accessor :to
35
35
 
36
- # BCC recipients
37
- attr_accessor :bcc
38
-
39
- # CC recipients
40
- attr_accessor :cc
41
-
42
36
  # Created at DateTime
43
37
  attr_accessor :created_at
44
38
 
45
39
  # Updated at DateTime
46
40
  attr_accessor :updated_at
47
41
 
42
+ # BCC recipients
43
+ attr_accessor :bcc
44
+
45
+ # CC recipients
46
+ attr_accessor :cc
47
+
48
48
  # Alias ID
49
49
  attr_accessor :alias_id
50
50
 
@@ -54,13 +54,13 @@ module MailSlurpClient
54
54
  :'name' => :'name',
55
55
  :'id' => :'id',
56
56
  :'subject' => :'subject',
57
- :'inbox_id' => :'inboxId',
58
57
  :'user_id' => :'userId',
58
+ :'inbox_id' => :'inboxId',
59
59
  :'to' => :'to',
60
- :'bcc' => :'bcc',
61
- :'cc' => :'cc',
62
60
  :'created_at' => :'createdAt',
63
61
  :'updated_at' => :'updatedAt',
62
+ :'bcc' => :'bcc',
63
+ :'cc' => :'cc',
64
64
  :'alias_id' => :'aliasId'
65
65
  }
66
66
  end
@@ -71,13 +71,13 @@ module MailSlurpClient
71
71
  :'name' => :'String',
72
72
  :'id' => :'String',
73
73
  :'subject' => :'String',
74
- :'inbox_id' => :'String',
75
74
  :'user_id' => :'String',
75
+ :'inbox_id' => :'String',
76
76
  :'to' => :'Array<String>',
77
- :'bcc' => :'Array<String>',
78
- :'cc' => :'Array<String>',
79
77
  :'created_at' => :'DateTime',
80
78
  :'updated_at' => :'DateTime',
79
+ :'bcc' => :'Array<String>',
80
+ :'cc' => :'Array<String>',
81
81
  :'alias_id' => :'String'
82
82
  }
83
83
  end
@@ -115,20 +115,28 @@ module MailSlurpClient
115
115
  self.subject = attributes[:'subject']
116
116
  end
117
117
 
118
- if attributes.key?(:'inbox_id')
119
- self.inbox_id = attributes[:'inbox_id']
120
- end
121
-
122
118
  if attributes.key?(:'user_id')
123
119
  self.user_id = attributes[:'user_id']
124
120
  end
125
121
 
122
+ if attributes.key?(:'inbox_id')
123
+ self.inbox_id = attributes[:'inbox_id']
124
+ end
125
+
126
126
  if attributes.key?(:'to')
127
127
  if (value = attributes[:'to']).is_a?(Array)
128
128
  self.to = value
129
129
  end
130
130
  end
131
131
 
132
+ if attributes.key?(:'created_at')
133
+ self.created_at = attributes[:'created_at']
134
+ end
135
+
136
+ if attributes.key?(:'updated_at')
137
+ self.updated_at = attributes[:'updated_at']
138
+ end
139
+
132
140
  if attributes.key?(:'bcc')
133
141
  if (value = attributes[:'bcc']).is_a?(Array)
134
142
  self.bcc = value
@@ -141,14 +149,6 @@ module MailSlurpClient
141
149
  end
142
150
  end
143
151
 
144
- if attributes.key?(:'created_at')
145
- self.created_at = attributes[:'created_at']
146
- end
147
-
148
- if attributes.key?(:'updated_at')
149
- self.updated_at = attributes[:'updated_at']
150
- end
151
-
152
152
  if attributes.key?(:'alias_id')
153
153
  self.alias_id = attributes[:'alias_id']
154
154
  end
@@ -162,14 +162,14 @@ module MailSlurpClient
162
162
  invalid_properties.push('invalid value for "id", id cannot be nil.')
163
163
  end
164
164
 
165
- if @inbox_id.nil?
166
- invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
167
- end
168
-
169
165
  if @user_id.nil?
170
166
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
171
167
  end
172
168
 
169
+ if @inbox_id.nil?
170
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
171
+ end
172
+
173
173
  if @to.nil?
174
174
  invalid_properties.push('invalid value for "to", to cannot be nil.')
175
175
  end
@@ -193,8 +193,8 @@ module MailSlurpClient
193
193
  # @return true if the model is valid
194
194
  def valid?
195
195
  return false if @id.nil?
196
- return false if @inbox_id.nil?
197
196
  return false if @user_id.nil?
197
+ return false if @inbox_id.nil?
198
198
  return false if @to.nil?
199
199
  return false if @created_at.nil?
200
200
  return false if @updated_at.nil?
@@ -210,13 +210,13 @@ module MailSlurpClient
210
210
  name == o.name &&
211
211
  id == o.id &&
212
212
  subject == o.subject &&
213
- inbox_id == o.inbox_id &&
214
213
  user_id == o.user_id &&
214
+ inbox_id == o.inbox_id &&
215
215
  to == o.to &&
216
- bcc == o.bcc &&
217
- cc == o.cc &&
218
216
  created_at == o.created_at &&
219
217
  updated_at == o.updated_at &&
218
+ bcc == o.bcc &&
219
+ cc == o.cc &&
220
220
  alias_id == o.alias_id
221
221
  end
222
222
 
@@ -229,7 +229,7 @@ module MailSlurpClient
229
229
  # Calculates hash code according to all attributes.
230
230
  # @return [Integer] Hash code
231
231
  def hash
232
- [name, id, subject, inbox_id, user_id, to, bcc, cc, created_at, updated_at, alias_id].hash
232
+ [name, id, subject, user_id, inbox_id, to, created_at, updated_at, bcc, cc, alias_id].hash
233
233
  end
234
234
 
235
235
  # Builds the object from hash
@@ -19,9 +19,11 @@ module MailSlurpClient
19
19
 
20
20
  attr_accessor :id
21
21
 
22
+ attr_accessor :user_id
23
+
22
24
  attr_accessor :inbox_id
23
25
 
24
- attr_accessor :user_id
26
+ attr_accessor :sent_email_id
25
27
 
26
28
  attr_accessor :created_at
27
29
 
@@ -31,20 +33,18 @@ module MailSlurpClient
31
33
 
32
34
  attr_accessor :seen_at
33
35
 
34
- attr_accessor :sent_email_id
35
-
36
36
  # Attribute mapping from ruby-style variable name to JSON key.
37
37
  def self.attribute_map
38
38
  {
39
39
  :'name' => :'name',
40
40
  :'id' => :'id',
41
- :'inbox_id' => :'inboxId',
42
41
  :'user_id' => :'userId',
42
+ :'inbox_id' => :'inboxId',
43
+ :'sent_email_id' => :'sentEmailId',
43
44
  :'created_at' => :'createdAt',
44
45
  :'recipient' => :'recipient',
45
46
  :'seen' => :'seen',
46
- :'seen_at' => :'seenAt',
47
- :'sent_email_id' => :'sentEmailId'
47
+ :'seen_at' => :'seenAt'
48
48
  }
49
49
  end
50
50
 
@@ -53,13 +53,13 @@ module MailSlurpClient
53
53
  {
54
54
  :'name' => :'String',
55
55
  :'id' => :'String',
56
- :'inbox_id' => :'String',
57
56
  :'user_id' => :'String',
57
+ :'inbox_id' => :'String',
58
+ :'sent_email_id' => :'String',
58
59
  :'created_at' => :'DateTime',
59
60
  :'recipient' => :'String',
60
61
  :'seen' => :'Boolean',
61
- :'seen_at' => :'DateTime',
62
- :'sent_email_id' => :'String'
62
+ :'seen_at' => :'DateTime'
63
63
  }
64
64
  end
65
65
 
@@ -92,12 +92,16 @@ module MailSlurpClient
92
92
  self.id = attributes[:'id']
93
93
  end
94
94
 
95
+ if attributes.key?(:'user_id')
96
+ self.user_id = attributes[:'user_id']
97
+ end
98
+
95
99
  if attributes.key?(:'inbox_id')
96
100
  self.inbox_id = attributes[:'inbox_id']
97
101
  end
98
102
 
99
- if attributes.key?(:'user_id')
100
- self.user_id = attributes[:'user_id']
103
+ if attributes.key?(:'sent_email_id')
104
+ self.sent_email_id = attributes[:'sent_email_id']
101
105
  end
102
106
 
103
107
  if attributes.key?(:'created_at')
@@ -115,10 +119,6 @@ module MailSlurpClient
115
119
  if attributes.key?(:'seen_at')
116
120
  self.seen_at = attributes[:'seen_at']
117
121
  end
118
-
119
- if attributes.key?(:'sent_email_id')
120
- self.sent_email_id = attributes[:'sent_email_id']
121
- end
122
122
  end
123
123
 
124
124
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -161,13 +161,13 @@ module MailSlurpClient
161
161
  self.class == o.class &&
162
162
  name == o.name &&
163
163
  id == o.id &&
164
- inbox_id == o.inbox_id &&
165
164
  user_id == o.user_id &&
165
+ inbox_id == o.inbox_id &&
166
+ sent_email_id == o.sent_email_id &&
166
167
  created_at == o.created_at &&
167
168
  recipient == o.recipient &&
168
169
  seen == o.seen &&
169
- seen_at == o.seen_at &&
170
- sent_email_id == o.sent_email_id
170
+ seen_at == o.seen_at
171
171
  end
172
172
 
173
173
  # @see the `==` method
@@ -179,7 +179,7 @@ module MailSlurpClient
179
179
  # Calculates hash code according to all attributes.
180
180
  # @return [Integer] Hash code
181
181
  def hash
182
- [name, id, inbox_id, user_id, created_at, recipient, seen, seen_at, sent_email_id].hash
182
+ [name, id, user_id, inbox_id, sent_email_id, created_at, recipient, seen, seen_at].hash
183
183
  end
184
184
 
185
185
  # Builds the object from hash
@@ -0,0 +1,334 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ class UserInfoDto
17
+ attr_accessor :id
18
+
19
+ attr_accessor :email_address
20
+
21
+ attr_accessor :account_state
22
+
23
+ attr_accessor :subscription_type
24
+
25
+ attr_accessor :account_type
26
+
27
+ attr_accessor :created_at
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'id' => :'id',
55
+ :'email_address' => :'emailAddress',
56
+ :'account_state' => :'accountState',
57
+ :'subscription_type' => :'subscriptionType',
58
+ :'account_type' => :'accountType',
59
+ :'created_at' => :'createdAt'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'id' => :'String',
67
+ :'email_address' => :'String',
68
+ :'account_state' => :'String',
69
+ :'subscription_type' => :'String',
70
+ :'account_type' => :'String',
71
+ :'created_at' => :'DateTime'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::UserInfoDto` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::UserInfoDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'id')
97
+ self.id = attributes[:'id']
98
+ end
99
+
100
+ if attributes.key?(:'email_address')
101
+ self.email_address = attributes[:'email_address']
102
+ end
103
+
104
+ if attributes.key?(:'account_state')
105
+ self.account_state = attributes[:'account_state']
106
+ end
107
+
108
+ if attributes.key?(:'subscription_type')
109
+ self.subscription_type = attributes[:'subscription_type']
110
+ end
111
+
112
+ if attributes.key?(:'account_type')
113
+ self.account_type = attributes[:'account_type']
114
+ end
115
+
116
+ if attributes.key?(:'created_at')
117
+ self.created_at = attributes[:'created_at']
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ if @id.nil?
126
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
127
+ end
128
+
129
+ if @email_address.nil?
130
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
131
+ end
132
+
133
+ if @account_state.nil?
134
+ invalid_properties.push('invalid value for "account_state", account_state cannot be nil.')
135
+ end
136
+
137
+ if @account_type.nil?
138
+ invalid_properties.push('invalid value for "account_type", account_type cannot be nil.')
139
+ end
140
+
141
+ if @created_at.nil?
142
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ return false if @id.nil?
152
+ return false if @email_address.nil?
153
+ return false if @account_state.nil?
154
+ account_state_validator = EnumAttributeValidator.new('String', ["FROZEN", "ACTIVE"])
155
+ return false unless account_state_validator.valid?(@account_state)
156
+ subscription_type_validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "TEAM", "ENTERPRISE"])
157
+ return false unless subscription_type_validator.valid?(@subscription_type)
158
+ return false if @account_type.nil?
159
+ account_type_validator = EnumAttributeValidator.new('String', ["SOLO", "CHILD_SOLO", "CHILD_TEAM"])
160
+ return false unless account_type_validator.valid?(@account_type)
161
+ return false if @created_at.nil?
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] account_state Object to be assigned
167
+ def account_state=(account_state)
168
+ validator = EnumAttributeValidator.new('String', ["FROZEN", "ACTIVE"])
169
+ unless validator.valid?(account_state)
170
+ fail ArgumentError, "invalid value for \"account_state\", must be one of #{validator.allowable_values}."
171
+ end
172
+ @account_state = account_state
173
+ end
174
+
175
+ # Custom attribute writer method checking allowed values (enum).
176
+ # @param [Object] subscription_type Object to be assigned
177
+ def subscription_type=(subscription_type)
178
+ validator = EnumAttributeValidator.new('String', ["PRO_MONTHLY", "STARTER", "TEAM", "ENTERPRISE"])
179
+ unless validator.valid?(subscription_type)
180
+ fail ArgumentError, "invalid value for \"subscription_type\", must be one of #{validator.allowable_values}."
181
+ end
182
+ @subscription_type = subscription_type
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] account_type Object to be assigned
187
+ def account_type=(account_type)
188
+ validator = EnumAttributeValidator.new('String', ["SOLO", "CHILD_SOLO", "CHILD_TEAM"])
189
+ unless validator.valid?(account_type)
190
+ fail ArgumentError, "invalid value for \"account_type\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @account_type = account_type
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ id == o.id &&
201
+ email_address == o.email_address &&
202
+ account_state == o.account_state &&
203
+ subscription_type == o.subscription_type &&
204
+ account_type == o.account_type &&
205
+ created_at == o.created_at
206
+ end
207
+
208
+ # @see the `==` method
209
+ # @param [Object] Object to be compared
210
+ def eql?(o)
211
+ self == o
212
+ end
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Integer] Hash code
216
+ def hash
217
+ [id, email_address, account_state, subscription_type, account_type, created_at].hash
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def self.build_from_hash(attributes)
224
+ new.build_from_hash(attributes)
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ self.class.openapi_types.each_pair do |key, type|
233
+ if type =~ /\AArray<(.*)>/i
234
+ # check to ensure the input is an array given that the attribute
235
+ # is documented as an array but the input is not
236
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
237
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
238
+ end
239
+ elsif !attributes[self.class.attribute_map[key]].nil?
240
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
241
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
242
+ end
243
+
244
+ self
245
+ end
246
+
247
+ # Deserializes the data based on type
248
+ # @param string type Data type
249
+ # @param string value Value to be deserialized
250
+ # @return [Object] Deserialized data
251
+ def _deserialize(type, value)
252
+ case type.to_sym
253
+ when :DateTime
254
+ DateTime.parse(value)
255
+ when :Date
256
+ Date.parse(value)
257
+ when :String
258
+ value.to_s
259
+ when :Integer
260
+ value.to_i
261
+ when :Float
262
+ value.to_f
263
+ when :Boolean
264
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
265
+ true
266
+ else
267
+ false
268
+ end
269
+ when :Object
270
+ # generic object (usually a Hash), return directly
271
+ value
272
+ when /\AArray<(?<inner_type>.+)>\z/
273
+ inner_type = Regexp.last_match[:inner_type]
274
+ value.map { |v| _deserialize(inner_type, v) }
275
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
276
+ k_type = Regexp.last_match[:k_type]
277
+ v_type = Regexp.last_match[:v_type]
278
+ {}.tap do |hash|
279
+ value.each do |k, v|
280
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
281
+ end
282
+ end
283
+ else # model
284
+ MailSlurpClient.const_get(type).build_from_hash(value)
285
+ end
286
+ end
287
+
288
+ # Returns the string representation of the object
289
+ # @return [String] String presentation of the object
290
+ def to_s
291
+ to_hash.to_s
292
+ end
293
+
294
+ # to_body is an alias to to_hash (backward compatibility)
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_body
297
+ to_hash
298
+ end
299
+
300
+ # Returns the object in the form of hash
301
+ # @return [Hash] Returns the object in the form of hash
302
+ def to_hash
303
+ hash = {}
304
+ self.class.attribute_map.each_pair do |attr, param|
305
+ value = self.send(attr)
306
+ if value.nil?
307
+ is_nullable = self.class.openapi_nullable.include?(attr)
308
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
309
+ end
310
+
311
+ hash[param] = _to_hash(value)
312
+ end
313
+ hash
314
+ end
315
+
316
+ # Outputs non-array value in the form of hash
317
+ # For object, use to_hash. Otherwise, just return the value
318
+ # @param [Object] value Any valid value
319
+ # @return [Hash] Returns the value in the form of hash
320
+ def _to_hash(value)
321
+ if value.is_a?(Array)
322
+ value.compact.map { |v| _to_hash(v) }
323
+ elsif value.is_a?(Hash)
324
+ {}.tap do |hash|
325
+ value.each { |k, v| hash[k] = _to_hash(v) }
326
+ end
327
+ elsif value.respond_to? :to_hash
328
+ value.to_hash
329
+ else
330
+ value
331
+ end
332
+ end
333
+ end
334
+ end