Class: MailSlurpClient::CreateInboxDto

Inherits:
Object
  • Object
show all
Defined in:
lib/mailslurp_client/models/create_inbox_dto.rb

Overview

Options for creating an inbox. An inbox has a real email address that can send and receive emails. Inboxes can be permanent or expire at a given time. Inboxes are either `SMTP` or `HTTP` mailboxes. `SMTP` inboxes are processed by a mail server running at `mailslurp.mx` while `HTTP` inboxes are processed by AWS SES backed mailservers. An inbox email address is randomly assigned by default ending in either `mailslurp.com` or (if `useDomainPool` is enabled) ending in a similar domain such as `mailslurp.xyz` (selected at random). To specify an address use a custom domain: either pass the `emailAddress` options with `<your-recipient>@<your-domain>`. To create a randomized address for your domain set the `domainName` to the domain you have verified or pass the `domainId`. Virtual inboxes prevent outbound sending and instead trap mail.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateInboxDto

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 150

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateInboxDto` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateInboxDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'email_address')
    self.email_address = attributes[:'email_address']
  end

  if attributes.key?(:'domain_name')
    self.domain_name = attributes[:'domain_name']
  end

  if attributes.key?(:'domain_id')
    self.domain_id = attributes[:'domain_id']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'use_domain_pool')
    self.use_domain_pool = attributes[:'use_domain_pool']
  end

  if attributes.key?(:'tags')
    if (value = attributes[:'tags']).is_a?(Array)
      self.tags = value
    end
  end

  if attributes.key?(:'expires_at')
    self.expires_at = attributes[:'expires_at']
  end

  if attributes.key?(:'favourite')
    self.favourite = attributes[:'favourite']
  end

  if attributes.key?(:'expires_in')
    self.expires_in = attributes[:'expires_in']
  end

  if attributes.key?(:'allow_team_access')
    self.allow_team_access = attributes[:'allow_team_access']
  end

  if attributes.key?(:'inbox_type')
    self.inbox_type = attributes[:'inbox_type']
  end

  if attributes.key?(:'virtual_inbox')
    self.virtual_inbox = attributes[:'virtual_inbox']
  end

  if attributes.key?(:'use_short_address')
    self.use_short_address = attributes[:'use_short_address']
  end

  if attributes.key?(:'prefix')
    self.prefix = attributes[:'prefix']
  end
end

Instance Attribute Details

#allow_team_accessObject

DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization.



49
50
51
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 49

def allow_team_access
  @allow_team_access
end

#descriptionObject

Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with



31
32
33
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 31

def description
  @description
end

#domain_idObject

ID of custom domain to use for email address.



25
26
27
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 25

def domain_id
  @domain_id
end

#domain_nameObject

FQDN domain name for the domain you have verified. Will be appended with a randomly assigned recipient name. Use the `emailAddress` option instead to specify the full custom inbox.



22
23
24
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 22

def domain_name
  @domain_name
end

#email_addressObject

A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID.



19
20
21
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 19

def email_address
  @email_address
end

#expires_atObject

Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX.



40
41
42
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 40

def expires_at
  @expires_at
end

#expires_inObject

Number of milliseconds that inbox should exist for



46
47
48
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 46

def expires_in
  @expires_in
end

#favouriteObject

Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering



43
44
45
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 43

def favourite
  @favourite
end

#inbox_typeObject

Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).



52
53
54
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 52

def inbox_type
  @inbox_type
end

#nameObject

Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails.



28
29
30
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 28

def name
  @name
end

#prefixObject

Prefix to add before the email address for easier labelling or identification.



61
62
63
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 61

def prefix
  @prefix
end

#tagsObject

Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.



37
38
39
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 37

def tags
  @tags
end

#use_domain_poolObject

Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.world,info,xyz,…` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types.



34
35
36
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 34

def use_domain_pool
  @use_domain_pool
end

#use_short_addressObject

Use a shorter email address under 31 characters



58
59
60
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 58

def use_short_address
  @use_short_address
end

#virtual_inboxObject

Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending.



55
56
57
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 55

def virtual_inbox
  @virtual_inbox
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 86

def self.attribute_map
  {
    :'email_address' => :'emailAddress',
    :'domain_name' => :'domainName',
    :'domain_id' => :'domainId',
    :'name' => :'name',
    :'description' => :'description',
    :'use_domain_pool' => :'useDomainPool',
    :'tags' => :'tags',
    :'expires_at' => :'expiresAt',
    :'favourite' => :'favourite',
    :'expires_in' => :'expiresIn',
    :'allow_team_access' => :'allowTeamAccess',
    :'inbox_type' => :'inboxType',
    :'virtual_inbox' => :'virtualInbox',
    :'use_short_address' => :'useShortAddress',
    :'prefix' => :'prefix'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



288
289
290
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 288

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 128

def self.openapi_nullable
  Set.new([
    :'email_address',
    :'domain_name',
    :'domain_id',
    :'name',
    :'description',
    :'use_domain_pool',
    :'tags',
    :'expires_at',
    :'favourite',
    :'expires_in',
    :'allow_team_access',
    :'inbox_type',
    :'virtual_inbox',
    :'use_short_address',
    :'prefix'
  ])
end

.openapi_typesObject

Attribute type mapping.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 107

def self.openapi_types
  {
    :'email_address' => :'String',
    :'domain_name' => :'String',
    :'domain_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'use_domain_pool' => :'Boolean',
    :'tags' => :'Array<String>',
    :'expires_at' => :'DateTime',
    :'favourite' => :'Boolean',
    :'expires_in' => :'Integer',
    :'allow_team_access' => :'Boolean',
    :'inbox_type' => :'String',
    :'virtual_inbox' => :'Boolean',
    :'use_short_address' => :'Boolean',
    :'prefix' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 253

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      email_address == o.email_address &&
      domain_name == o.domain_name &&
      domain_id == o.domain_id &&
      name == o.name &&
      description == o.description &&
      use_domain_pool == o.use_domain_pool &&
      tags == o.tags &&
      expires_at == o.expires_at &&
      favourite == o.favourite &&
      expires_in == o.expires_in &&
      allow_team_access == o.allow_team_access &&
      inbox_type == o.inbox_type &&
      virtual_inbox == o.virtual_inbox &&
      use_short_address == o.use_short_address &&
      prefix == o.prefix
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 316

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    MailSlurpClient.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 385

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 295

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


275
276
277
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 275

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



281
282
283
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 281

def hash
  [email_address, domain_name, domain_id, name, description, use_domain_pool, tags, expires_at, favourite, expires_in, allow_team_access, inbox_type, virtual_inbox, use_short_address, prefix].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



228
229
230
231
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 228

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



361
362
363
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 361

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 367

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end
    
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



355
356
357
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 355

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



235
236
237
238
239
# File 'lib/mailslurp_client/models/create_inbox_dto.rb', line 235

def valid?
  inbox_type_validator = EnumAttributeValidator.new('String', ["HTTP_INBOX", "SMTP_INBOX"])
  return false unless inbox_type_validator.valid?(@inbox_type)
  true
end