Sha256: f9b6ba295e4392201562fd772342c9b63128af3844aea95696fd0802cfb0ba5a

Contents?: true

Size: 1.72 KB

Versions: 4

Compression:

Stored size: 1.72 KB

Contents

class Sendgrid::Web::InvalidEmails < Sendgrid::Web::Client

  # Retrieve a list of invalid emails with addresses and response
  # codes, optionally with dates.
  #
  # @param date [Integer] Retrieve the timestamp of the invalid email
  #   records.
  # @param days [Integer] Number of days in the past for which to
  #   retrieve invalid emails (includes today).
  # @param start_date [DateTime] The start of the date range for which
  #   to retrieve invalid emails.
  # @param end_date [DateTime] The end of the date range for which to
  #   retrieve invalid emails.
  # @param limit [Integer] Optional field to limit the number of
  #   results returned.
  # @param offset [Integer] Optional beginning point in the list to
  #   retrieve from.
  # @param email [String] Optional email addresses to search for.
  # @return [Sendgrid::Web::Response] The Sendgrid response.
  # @note All parameters are optional.
  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

  # Delete an address from the Invalid Email list.
  #
  # @param email [String] Email address to remove.
  # @return [Sendgrid::Web::Response] The Sendgrid response.
  # @note +email+ parameter is required.
  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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sendgrid-web-0.1.0 lib/sendgrid/web/invalid_emails.rb
sendgrid-web-0.0.7 lib/sendgrid/web/invalid_emails.rb
sendgrid-web-0.0.6 lib/sendgrid/web/invalid_emails.rb
sendgrid-web-0.0.5 lib/sendgrid/web/invalid_emails.rb