Sha256: c78292718a98e672b531a661afbc6f5961618d113c5dfd0f73f1c684b60c6c6b

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

class Sendgrid::Web::SpamReports < Sendgrid::Web::Client

  # Retrieve entries in the Spam Reports list.
  #
  # @param date [Integer] Retrieve the timestamp of the spam reports
  #   records.
  # @param days [Integer] Number of days in the past for which to
  #   retrieve spam reports (includes today).
  # @param start_date [DateTime] The start of the date range for which
  #   to retrieve spam reports.
  # @param end_date [DateTime] The end of the date range for which to
  #   retrieve spam reports.
  # @param limit [Integer] Optional field to limit the number of
  #   results returned.
  # @param offset [Integer] Optional beginning point in the list to
  #   retrieve from.
  # @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)
    res = connection.post(
      '/api/spamreports.get.json',
      default_params(
        date: date,
        days: days,
        start_date: start_date,
        end_date: end_date,
        limit: limit,
        offset: offset))
    craft_response(res)
  end

  # Deletes all spam reports associated with the provided email.
  #
  # @param email [String] Email spam reports address to remove.
  # @return [Sendgrid::Web::Response] The SendGrid response.
  # @note +email+ parameter is required.
  def delete(email: nil)
    if email.nil?
      raise ArgumentError.new('Missing required `email` option')
    end
    res = connection.post(
      '/api/spamreports.delete.json',
      default_params(email: email))
    craft_response(res)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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