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.

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.



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