Class: Mandrill::Whitelists

Inherits:
Object
  • Object
show all
Defined in:
lib/mandrill/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Whitelists

Returns a new instance of Whitelists.



1153
1154
1155
# File 'lib/mandrill/api.rb', line 1153

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



1151
1152
1153
# File 'lib/mandrill/api.rb', line 1151

def master
  @master
end

Instance Method Details

#add(email, comment = nil) ⇒ Hash

Adds an email to your email rejection whitelist. If the address is currently on your blacklist, that blacklist entry will be removed automatically.

Parameters:

  • email (String)

    an email address to add to the whitelist

  • comment (String) (defaults to: nil)

    an optional description of why the email was whitelisted

Returns:

  • (Hash)

    a status object containing the address and the result of the operation

    • String

      email the email address you provided

    • Boolean

      added whether the operation succeeded



1163
1164
1165
1166
# File 'lib/mandrill/api.rb', line 1163

def add(email, comment=nil)
    _params = {:email => email, :comment => comment}
    return @master.call 'whitelists/add', _params
end

#delete(email) ⇒ Hash

Removes an email address from the whitelist.

Parameters:

  • email (String)

    the email address to remove from the whitelist

Returns:

  • (Hash)

    a status object containing the address and whether the deletion succeeded

    • String

      email the email address that was removed from the blacklist

    • Boolean

      deleted whether the address was deleted successfully



1185
1186
1187
1188
# File 'lib/mandrill/api.rb', line 1185

def delete(email)
    _params = {:email => email}
    return @master.call 'whitelists/delete', _params
end

#list(email = nil) ⇒ Array

Retrieves your email rejection whitelist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.

Parameters:

  • email (String) (defaults to: nil)

    an optional email address or prefix to search by

Returns:

  • (Array)

    up to 1000 whitelist entries

    • Hash

      return[] the information for each whitelist entry

      - [String] email the email that is whitelisted
      - [String] detail a description of why the email was whitelisted
      - [String] created_at when the email was added to the whitelist
      


1175
1176
1177
1178
# File 'lib/mandrill/api.rb', line 1175

def list(email=nil)
    _params = {:email => email}
    return @master.call 'whitelists/list', _params
end