Class: GrowsurfRuby::Resources::Campaign::Emails

Inherits:
Object
  • Object
show all
Defined in:
lib/growsurf_ruby/resources/campaign/emails.rb,
sig/growsurf_ruby/resources/campaign/emails.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Emails

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 Emails.

Parameters:



58
59
60
# File 'lib/growsurf_ruby/resources/campaign/emails.rb', line 58

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(id, request_options: {}) ⇒ Hash{Symbol=>Object}

Retrieves a program's email configuration — the same surface as the dashboard Program Editor's Emails tab. Returns each editable email template (subject, preheader, body, isEnabled) plus the settings block (sender, contact, and design). The set of email templates returned depends on the program type (referral vs affiliate).

Parameters:

Returns:

  • (Hash{Symbol=>Object})


20
21
22
23
24
25
26
27
# File 'lib/growsurf_ruby/resources/campaign/emails.rb', line 20

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["campaign/%1$s/emails", id],
    model: GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown],
    options: params[:request_options]
  )
end

#update(id, body, request_options: {}) ⇒ Hash{Symbol=>Object}

Updates a program's email configuration. Only the fields you send are changed; omitted fields are left untouched. You may only write the email templates the dashboard exposes for the program type — writing a template that is not available for the program type returns a 400. Some fields are read-only (settings.sender.fromEmail, whose custom value requires dashboard domain verification).

Parameters:

  • id (String)

    GrowSurf program ID.

  • body (Hash{Symbol=>Object})

    Partial email configuration to merge.

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

Returns:

  • (Hash{Symbol=>Object})


45
46
47
48
49
50
51
52
53
# File 'lib/growsurf_ruby/resources/campaign/emails.rb', line 45

def update(id, body, params = {})
  @client.request(
    method: :patch,
    path: ["campaign/%1$s/emails", id],
    body: body,
    model: GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown],
    options: params[:request_options]
  )
end