Class: HubSpotSDK::Resources::Marketing::Transactional::SmtpTokens

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/marketing/transactional/smtp_tokens.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SmtpTokens

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SmtpTokens.

Parameters:



131
132
133
# File 'lib/hubspot_sdk/resources/marketing/transactional/smtp_tokens.rb', line 131

def initialize(client:)
  @client = client
end

Instance Method Details

#create(campaign_name:, create_contact:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::SmtpAPITokenView

Create a SMTP API token.

Parameters:

  • campaign_name (String)

    A name for the campaign tied to the SMTP API token.

  • create_contact (Boolean)

    Indicates whether a contact should be created for email recipients.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
# File 'lib/hubspot_sdk/resources/marketing/transactional/smtp_tokens.rb', line 21

def create(params)
  parsed, options = HubSpotSDK::Marketing::Transactional::SmtpTokenCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/transactional/2026-03/smtp-tokens",
    body: parsed,
    model: HubSpotSDK::Marketing::SmtpAPITokenView,
    options: options
  )
end

#delete(token_id, request_options: {}) ⇒ nil

Delete a single token by ID.

Parameters:

Returns:

  • (nil)

See Also:



80
81
82
83
84
85
86
87
# File 'lib/hubspot_sdk/resources/marketing/transactional/smtp_tokens.rb', line 80

def delete(token_id, params = {})
  @client.request(
    method: :delete,
    path: ["marketing/transactional/2026-03/smtp-tokens/%1$s", token_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#get(token_id, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::SmtpAPITokenView

Query a single token by ID.

Parameters:

Returns:

See Also:



99
100
101
102
103
104
105
106
# File 'lib/hubspot_sdk/resources/marketing/transactional/smtp_tokens.rb', line 99

def get(token_id, params = {})
  @client.request(
    method: :get,
    path: ["marketing/transactional/2026-03/smtp-tokens/%1$s", token_id],
    model: HubSpotSDK::Marketing::SmtpAPITokenView,
    options: params[:request_options]
  )
end

#list(after: nil, campaign_name: nil, email_campaign_id: nil, limit: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Marketing::SmtpAPITokenView>

Some parameter documentations has been truncated, see Models::Marketing::Transactional::SmtpTokenListParams for more details.

Query multiple SMTP API tokens by campaign name or a single token by emailCampaignId.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • campaign_name (String)
  • email_campaign_id (String)
  • limit (Integer)

    The maximum number of results to display per page.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/hubspot_sdk/resources/marketing/transactional/smtp_tokens.rb', line 54

def list(params = {})
  parsed, options = HubSpotSDK::Marketing::Transactional::SmtpTokenListParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "marketing/transactional/2026-03/smtp-tokens",
    query: query.transform_keys(
      campaign_name: "campaignName",
      email_campaign_id: "emailCampaignId"
    ),
    page: HubSpotSDK::Internal::Page,
    model: HubSpotSDK::Marketing::SmtpAPITokenView,
    options: options
  )
end

#reset_password(token_id, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::SmtpAPITokenView

Allows the creation of a replacement password for a given token. Once the password is successfully reset, the old password for the token will be invalid.

Parameters:

Returns:

See Also:



119
120
121
122
123
124
125
126
# File 'lib/hubspot_sdk/resources/marketing/transactional/smtp_tokens.rb', line 119

def reset_password(token_id, params = {})
  @client.request(
    method: :post,
    path: ["marketing/transactional/2026-03/smtp-tokens/%1$s/password-reset", token_id],
    model: HubSpotSDK::Marketing::SmtpAPITokenView,
    options: params[:request_options]
  )
end