Class: Sendgrid::Web::InvalidEmails

Inherits:
Client
  • Object
show all
Defined in:
lib/sendgrid/web/invalid_emails.rb

Instance Method Summary collapse

Methods inherited from Client

base_uri, config, #config, configure

Instance Method Details

#delete(email: nil) ⇒ Sendgrid::Web::Response

Note:

email parameter is required.

Delete an address from the Invalid Email list.

Parameters:

  • email (String) (defaults to: nil)

    Email address to remove.

Returns:

Raises:

  • (ArgumentError)


43
44
45
46
47
48
49
# File 'lib/sendgrid/web/invalid_emails.rb', line 43

def delete(email: nil)
  raise ArgumentError.new('Missing required `email` option') if email.nil?
  res = connection.post(
    '/api/invalidemails.delete.json',
    default_params(email: email))
  craft_response(res)
end

#get(date: nil, days: nil, start_date: nil, end_date: nil, limit: nil, offset: nil, email: nil) ⇒ Sendgrid::Web::Response

Note:

All parameters are optional.

Retrieve a list of invalid emails with addresses and response codes, optionally with dates.

Parameters:

  • date (Integer) (defaults to: nil)

    Retrieve the timestamp of the invalid email records.

  • days (Integer) (defaults to: nil)

    Number of days in the past for which to retrieve invalid emails (includes today).

  • start_date (DateTime) (defaults to: nil)

    The start of the date range for which to retrieve invalid emails.

  • end_date (DateTime) (defaults to: nil)

    The end of the date range for which to retrieve invalid emails.

  • limit (Integer) (defaults to: nil)

    Optional field to limit the number of results returned.

  • offset (Integer) (defaults to: nil)

    Optional beginning point in the list to retrieve from.

  • email (String) (defaults to: nil)

    Optional email addresses to search for.

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sendgrid/web/invalid_emails.rb', line 21

def get(
  date: nil, days: nil, start_date: nil,
  end_date: nil, limit: nil, offset: nil,
  email: nil)
  res = connection.post(
    '/api/invalidemails.get.json',
    default_params(
      date: date,
      days: days,
      start_date: start_date,
      end_date: end_date,
      limit: limit,
      offset: offset,
      email: email))
  craft_response(res)
end