Class: Mandrill::Exports

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Exports

Returns a new instance of Exports.



224
225
226
# File 'lib/mandrill/api.rb', line 224

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



222
223
224
# File 'lib/mandrill/api.rb', line 222

def master
  @master
end

Instance Method Details

#activity(notify_email = nil, date_from = nil, date_to = nil, tags = nil, senders = nil, states = nil, api_keys = nil) ⇒ Hash

Begins an export of your activity history. The activity will be exported to a zip archive containing a single file named activity.csv in the same format as you would be able to export from your account’s activity view. It includes the following fields: Date, Email Address, Sender, Subject, Status, Tags, Opens, Clicks, Bounce Detail. If you have configured any custom metadata fields, they will be included in the exported data.

Parameters:

  • notify_email (String) (defaults to: nil)

    an optional email address to notify when the export job has finished

  • date_from (String) (defaults to: nil)

    start date as a UTC string in YYYY-MM-DD HH:MM:SS format

  • date_to (String) (defaults to: nil)

    end date as a UTC string in YYYY-MM-DD HH:MM:SS format

  • tags (Array) (defaults to: nil)

    an array of tag names to narrow the export to; will match messages that contain ANY of the tags

    • String

      tags[] a tag name

  • senders (Array) (defaults to: nil)

    an array of senders to narrow the export to

    • String

      senders[] a sender address

  • states (Array) (defaults to: nil)

    an array of states to narrow the export to; messages with ANY of the states will be included

    • String

      states[] a message state

  • api_keys (Array) (defaults to: nil)

    an array of api keys to narrow the export to; messsagse sent with ANY of the keys will be included

    • String

      api_keys[] an API key associated with your account

Returns:

  • (Hash)

    information about the activity export job that was started

    • String

      id the unique identifier for this Export. Use this identifier when checking the export job’s status

    • String

      created_at the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format

    • String

      type the type of the export job

    • String

      finished_at the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format, or null for jobs that have not run

    • String

      state the export job’s state

    • String

      result_url the url for the export job’s results, if the job is complete



303
304
305
306
# File 'lib/mandrill/api.rb', line 303

def activity(notify_email=nil, date_from=nil, date_to=nil, tags=nil, senders=nil, states=nil, api_keys=nil)
    _params = {:notify_email => notify_email, :date_from => date_from, :date_to => date_to, :tags => tags, :senders => senders, :states => states, :api_keys => api_keys}
    return @master.call 'exports/activity', _params
end

#info(id) ⇒ Hash

Returns information about an export job. If the export job’s state is ‘complete’, the returned data will include a URL you can use to fetch the results. Every export job produces a zip archive, but the format of the archive is distinct for each job type. The api calls that initiate exports include more details about the output format for that job type.

Parameters:

  • id (String)

    an export job identifier

Returns:

  • (Hash)

    the information about the export

    • String

      id the unique identifier for this Export. Use this identifier when checking the export job’s status

    • String

      created_at the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format

    • String

      type the type of the export job - activity, reject, or whitelist

    • String

      finished_at the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format

    • String

      state the export job’s state - waiting, working, complete, error, or expired.

    • String

      result_url the url for the export job’s results, if the job is completed.



237
238
239
240
# File 'lib/mandrill/api.rb', line 237

def info(id)
    _params = {:id => id}
    return @master.call 'exports/info', _params
end

#listArray

Returns a list of your exports.

Returns:

  • (Array)

    the account’s exports

    • Hash

      return[] the individual export info

      - [String] id the unique identifier for this Export. Use this identifier when checking the export job's status
      - [String] created_at the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format
      - [String] type the type of the export job - activity, reject, or whitelist
      - [String] finished_at the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format
      - [String] state the export job's state - waiting, working, complete, error, or expired.
      - [String] result_url the url for the export job's results, if the job is completed.
      


251
252
253
254
# File 'lib/mandrill/api.rb', line 251

def list()
    _params = {}
    return @master.call 'exports/list', _params
end

#rejects(notify_email = nil) ⇒ Hash

Begins an export of your rejection blacklist. The blacklist will be exported to a zip archive containing a single file named rejects.csv that includes the following fields: email, reason, detail, created_at, expires_at, last_event_at, expires_at.

Parameters:

  • notify_email (String) (defaults to: nil)

    an optional email address to notify when the export job has finished.

Returns:

  • (Hash)

    information about the rejects export job that was started

    • String

      id the unique identifier for this Export. Use this identifier when checking the export job’s status

    • String

      created_at the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format

    • String

      type the type of the export job

    • String

      finished_at the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format, or null for jobs that have not run

    • String

      state the export job’s state

    • String

      result_url the url for the export job’s results, if the job is complete



265
266
267
268
# File 'lib/mandrill/api.rb', line 265

def rejects(notify_email=nil)
    _params = {:notify_email => notify_email}
    return @master.call 'exports/rejects', _params
end

#whitelist(notify_email = nil) ⇒ Hash

Begins an export of your rejection whitelist. The whitelist will be exported to a zip archive containing a single file named whitelist.csv that includes the following fields: email, detail, created_at.

Parameters:

  • notify_email (String) (defaults to: nil)

    an optional email address to notify when the export job has finished.

Returns:

  • (Hash)

    information about the whitelist export job that was started

    • String

      id the unique identifier for this Export. Use this identifier when checking the export job’s status

    • String

      created_at the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format

    • String

      type the type of the export job

    • String

      finished_at the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format, or null for jobs that have not run

    • String

      state the export job’s state

    • String

      result_url the url for the export job’s results, if the job is complete



279
280
281
282
# File 'lib/mandrill/api.rb', line 279

def whitelist(notify_email=nil)
    _params = {:notify_email => notify_email}
    return @master.call 'exports/whitelist', _params
end