Class: Sendgrid::API::Newsletter::MarketingEmails::Services

Inherits:
Service
  • Object
show all
Includes:
Utils
Defined in:
lib/sendgrid/api/newsletter/marketing_emails.rb

Instance Attribute Summary

Attributes inherited from Service

#resource

Instance Method Summary collapse

Methods inherited from Service

#initialize, #perform_request

Constructor Details

This class inherits a constructor from Sendgrid::API::Service

Instance Method Details

#add(marketing_email) ⇒ Entities::Response

Create a new Marketing Email.

Parameters:

Returns:

See Also:



23
24
25
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 23

def add(marketing_email)
  perform_request(Entities::Response, 'newsletter/add.json', marketing_email.as_json)
end

#delete(marketing_email) ⇒ Entities::Response

Remove an existing Marketing Email.

Parameters:

  • marketing_email (String, Entities::MarketingEmail)

    An existing marketing email name or Entities::MarketingEmail object.

Returns:

See Also:



62
63
64
65
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 62

def delete(marketing_email)
  params = { :name => extract_marketing_email(marketing_email) }
  perform_request(Entities::Response, 'newsletter/delete.json', params)
end

#edit(marketing_email, newname = nil) ⇒ Entities::Response

Edit an existing Marketing Email.

Parameters:

  • marketing_email (Entities::MarketingEmail)

    An Entities::MarketingEmail object.

  • newname (String) (defaults to: nil)

    The new name for the Marketing Email being edited. Optional.

Returns:

See Also:



33
34
35
36
37
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 33

def edit(marketing_email, newname = nil)
  params = marketing_email.as_json
  params.merge!(:newname => newname) if newname
  perform_request(Entities::Response, 'newsletter/edit.json', params)
end

#get(marketing_email) ⇒ Entities::MarketingEmail

Retrieve the contents of an existing Marketing Email.

Parameters:

  • marketing_email (String, Entities::MarketingEmail)

    An existing marketing email name or Entities::MarketingEmail object.

Returns:

See Also:



44
45
46
47
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 44

def get(marketing_email)
  params = { :name => extract_marketing_email(marketing_email) }
  perform_request(Entities::MarketingEmail, 'newsletter/get.json', params)
end

#listArray<Entities::MarketingEmail>

Retrieve a list of all existing Marketing Email.

Returns:

See Also:



53
54
55
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 53

def list
  perform_request(Entities::MarketingEmail, 'newsletter/list.json')
end