Class: Sendgrid::API::Newsletter::Categories::Services

Inherits:
Service
  • Object
show all
Includes:
Utils
Defined in:
lib/sendgrid/api/newsletter/categories.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, category) ⇒ Entities::Response

Assign a Category to an existing Marketing Email.

Parameters:

  • marketing_email (String, Entities::MarketingEmail)

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

  • category (String, Entities::Category)

    A category name or Entities::Category object.

Returns:

See Also:



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

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

#create(category) ⇒ Entities::Response

Create a new Category.

Parameters:

Returns:

See Also:



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

def create(category)
  params = { :category => extract_category(category) }
  perform_request(Entities::Response, 'newsletter/category/create.json', params)
end

#listArray<Entities::Category>

List all categories.

Returns:

See Also:



54
55
56
# File 'lib/sendgrid/api/newsletter/categories.rb', line 54

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

#remove(marketing_email, category) ⇒ Entities::Response

Remove specific categories, or all categories from a Marketing Email.

Parameters:

  • marketing_email (String, Entities::MarketingEmail)

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

  • category (String, Entities::Category)

    A category name or Entities::Category object.

Returns:

See Also:



45
46
47
48
# File 'lib/sendgrid/api/newsletter/categories.rb', line 45

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