Class: Sendgrid::API::Newsletter::SenderAddresses::Services

Inherits:
Service
  • Object
show all
Defined in:
lib/sendgrid/api/newsletter/sender_addresses.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(sender_address) ⇒ Entities::Response

Create a new Sender Address.

Parameters:

Returns:

See Also:



20
21
22
# File 'lib/sendgrid/api/newsletter/sender_addresses.rb', line 20

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

#delete(sender_address) ⇒ Entities::Response

Remove a Sender Address from your account.

Parameters:

  • sender_address (String, Entities::SenderAddress)

    An existing sender address identity or Entities::SenderAddress object.

Returns:

See Also:



59
60
61
62
# File 'lib/sendgrid/api/newsletter/sender_addresses.rb', line 59

def delete(sender_address)
  params = { :identity => extract_identity(sender_address) }
  perform_request(Entities::Response, 'newsletter/identity/delete.json', params)
end

#edit(sender_address, new_identity = nil) ⇒ Entities::Response

Edit an existing Sender Address.

Parameters:

  • sender_address (Entities::SenderAddress)

    An existing Entities::SenderAddress object.

  • new_identity (String) (defaults to: nil)

    A new identity for the existing sender address. Optional.

Returns:

See Also:



30
31
32
33
34
# File 'lib/sendgrid/api/newsletter/sender_addresses.rb', line 30

def edit(sender_address, new_identity = nil)
  params = sender_address.as_json
  params[:newidentity] = new_identity if new_identity
  perform_request(Entities::Response, 'newsletter/identity/edit.json', params)
end

#get(sender_address) ⇒ Entities::SenderAddress

Retrieve information associated with a particular Sender Address.

Parameters:

  • sender_address (String, Entities::SenderAddress)

    An existing sender address identity or Entities::SenderAddress object.

Returns:

See Also:



41
42
43
44
# File 'lib/sendgrid/api/newsletter/sender_addresses.rb', line 41

def get(sender_address)
  params = { :identity => extract_identity(sender_address) }
  perform_request(Entities::SenderAddress, 'newsletter/identity/get.json', params)
end

#listArray<Entities::SenderAddress>

List all Sender Addresses on your account.

Returns:

See Also:



50
51
52
# File 'lib/sendgrid/api/newsletter/sender_addresses.rb', line 50

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