Class: TempmailSdk::EmailInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/tempmail_sdk/types.rb

Overview

创建临时邮箱后返回的邮箱信息 Token 等认证信息由 SDK 内部维护,不对外暴露(token 通过私有读取器访问)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel:, email:, token: nil, expires_at: nil, created_at: nil) ⇒ EmailInfo

Returns a new instance of EmailInfo.

Parameters:

  • channel (String)

    渠道标识

  • email (String)

    邮箱地址

  • token (String, nil) (defaults to: nil)

    认证令牌,SDK 内部维护

  • expires_at (Integer, nil) (defaults to: nil)

    过期时间(毫秒时间戳)

  • created_at (Object, nil) (defaults to: nil)

    创建时间



21
22
23
24
25
26
27
# File 'lib/tempmail_sdk/types.rb', line 21

def initialize(channel:, email:, token: nil, expires_at: nil, created_at: nil)
  @channel = channel
  @email = email
  @token = token
  @expires_at = expires_at
  @created_at = created_at
end

Instance Attribute Details

#channelString

Returns 创建该邮箱所使用的渠道.

Returns:

  • (String)

    创建该邮箱所使用的渠道



8
9
10
# File 'lib/tempmail_sdk/types.rb', line 8

def channel
  @channel
end

#created_atObject?

Returns 邮箱创建时间.

Returns:

  • (Object, nil)

    邮箱创建时间



14
15
16
# File 'lib/tempmail_sdk/types.rb', line 14

def created_at
  @created_at
end

#emailString

Returns 临时邮箱地址.

Returns:

  • (String)

    临时邮箱地址



10
11
12
# File 'lib/tempmail_sdk/types.rb', line 10

def email
  @email
end

#expires_atInteger?

Returns 邮箱过期时间(毫秒时间戳).

Returns:

  • (Integer, nil)

    邮箱过期时间(毫秒时间戳)



12
13
14
# File 'lib/tempmail_sdk/types.rb', line 12

def expires_at
  @expires_at
end

Instance Method Details

#to_sObject Also known as: inspect



39
40
41
42
# File 'lib/tempmail_sdk/types.rb', line 39

def to_s
  "#<EmailInfo channel=#{@channel.inspect} email=#{@email.inspect} " \
    "expires_at=#{@expires_at.inspect} created_at=#{@created_at.inspect}>"
end

#tokenString?

SDK 内部使用的令牌读取器(对外语义上不暴露,仅内部 dispatch 使用)

Returns:

  • (String, nil)


35
36
37
# File 'lib/tempmail_sdk/types.rb', line 35

def token
  @token
end