Class: TempmailSdk::SDKConfig
- Inherits:
-
Object
- Object
- TempmailSdk::SDKConfig
- Defined in:
- lib/tempmail_sdk/config.rb
Overview
SDK 全局配置 包含代理、超时、SSL 等设置,作用于所有 HTTP 请求
支持环境变量自动读取(优先级低于代码设置): TEMPMAIL_PROXY - 代理 URL TEMPMAIL_TIMEOUT - 超时秒数 TEMPMAIL_INSECURE - 设为 "1" 或 "true" 跳过 SSL 验证 DROPMAIL_AUTH_TOKEN / DROPMAIL_API_TOKEN - DropMail af_ 令牌(可选) DROPMAIL_NO_AUTO_TOKEN - 禁止自动拉取/续期 DROPMAIL_RENEW_LIFETIME - renew 的 lifetime,默认 1d APIHZ_ID / APIHZ_KEY - apihz(接口盒子)调用凭据(可选) TEMPMAIL_TELEMETRY_ENABLED - true/false,默认 true;false/0/no 关闭匿名上报 TEMPMAIL_TELEMETRY_URL - 自定义上报端点
Instance Attribute Summary collapse
-
#apihz_id ⇒ Object
Returns the value of attribute apihz_id.
-
#apihz_key ⇒ Object
Returns the value of attribute apihz_key.
-
#dropmail_auth_token ⇒ Object
Returns the value of attribute dropmail_auth_token.
-
#dropmail_disable_auto_token ⇒ Object
Returns the value of attribute dropmail_disable_auto_token.
-
#dropmail_renew_lifetime ⇒ Object
Returns the value of attribute dropmail_renew_lifetime.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#insecure ⇒ Object
Returns the value of attribute insecure.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#telemetry_enabled ⇒ Object
Returns the value of attribute telemetry_enabled.
-
#telemetry_url ⇒ Object
Returns the value of attribute telemetry_url.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(proxy: nil, timeout: 15, insecure: false, headers: nil, dropmail_auth_token: nil, dropmail_disable_auto_token: false, dropmail_renew_lifetime: nil, apihz_id: nil, apihz_key: nil, telemetry_enabled: nil, telemetry_url: nil) ⇒ SDKConfig
constructor
rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(proxy: nil, timeout: 15, insecure: false, headers: nil, dropmail_auth_token: nil, dropmail_disable_auto_token: false, dropmail_renew_lifetime: nil, apihz_id: nil, apihz_key: nil, telemetry_enabled: nil, telemetry_url: nil) ⇒ SDKConfig
rubocop:disable Metrics/ParameterLists
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tempmail_sdk/config.rb', line 23 def initialize(proxy: nil, timeout: 15, insecure: false, headers: nil, dropmail_auth_token: nil, dropmail_disable_auto_token: false, dropmail_renew_lifetime: nil, apihz_id: nil, apihz_key: nil, telemetry_enabled: nil, telemetry_url: nil) @proxy = proxy # 代理 URL,支持 http/https/socks5 @timeout = timeout # 全局默认超时秒数 @insecure = insecure # 跳过 SSL 证书验证(调试用) @headers = headers # 自定义请求头,合并到每个请求 @dropmail_auth_token = dropmail_auth_token # DropMail af_ 令牌;空则自动申请 @dropmail_disable_auto_token = dropmail_disable_auto_token # true 时不自动 generate/renew @dropmail_renew_lifetime = dropmail_renew_lifetime # renew lifetime,默认 1d @apihz_id = apihz_id # apihz 调用 id;空则用公共账号 @apihz_key = apihz_key # apihz 调用 key;空则用公共账号 @telemetry_enabled = telemetry_enabled # nil 默认开启;false 关闭 @telemetry_url = telemetry_url # 非空覆盖默认上报 URL end |
Instance Attribute Details
#apihz_id ⇒ Object
Returns the value of attribute apihz_id.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def apihz_id @apihz_id end |
#apihz_key ⇒ Object
Returns the value of attribute apihz_key.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def apihz_key @apihz_key end |
#dropmail_auth_token ⇒ Object
Returns the value of attribute dropmail_auth_token.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def dropmail_auth_token @dropmail_auth_token end |
#dropmail_disable_auto_token ⇒ Object
Returns the value of attribute dropmail_disable_auto_token.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def dropmail_disable_auto_token @dropmail_disable_auto_token end |
#dropmail_renew_lifetime ⇒ Object
Returns the value of attribute dropmail_renew_lifetime.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def dropmail_renew_lifetime @dropmail_renew_lifetime end |
#headers ⇒ Object
Returns the value of attribute headers.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def headers @headers end |
#insecure ⇒ Object
Returns the value of attribute insecure.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def insecure @insecure end |
#proxy ⇒ Object
Returns the value of attribute proxy.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def proxy @proxy end |
#telemetry_enabled ⇒ Object
Returns the value of attribute telemetry_enabled.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def telemetry_enabled @telemetry_enabled end |
#telemetry_url ⇒ Object
Returns the value of attribute telemetry_url.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def telemetry_url @telemetry_url end |
#timeout ⇒ Object
Returns the value of attribute timeout.
18 19 20 |
# File 'lib/tempmail_sdk/config.rb', line 18 def timeout @timeout end |