Class: Mandrill::Subaccounts

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Subaccounts

Returns a new instance of Subaccounts.



1445
1446
1447
# File 'lib/mandrill/api.rb', line 1445

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



1443
1444
1445
# File 'lib/mandrill/api.rb', line 1443

def master
  @master
end

Instance Method Details

#add(id, name = nil, notes = nil, custom_quota = nil) ⇒ Hash

Add a new subaccount

Parameters:

  • id (String)

    a unique identifier for the subaccount to be used in sending calls

  • name (String) (defaults to: nil)

    an optional display name to further identify the subaccount

  • notes (String) (defaults to: nil)

    optional extra text to associate with the subaccount

  • custom_quota (Integer) (defaults to: nil)

    an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation

Returns:

  • (Hash)

    the information saved about the new subaccount

    • String

      id a unique indentifier for the subaccount

    • String

      name an optional display name for the subaccount

    • Integer

      custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation

    • String

      status the current sending status of the subaccount, one of “active” or “paused”

    • Integer

      reputation the subaccount’s current reputation on a scale from 0 to 100

    • String

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

    • String

      first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Integer

      sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)

    • Integer

      sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)

    • Integer

      sent_total the number of emails the subaccount has sent since it was created



1484
1485
1486
1487
# File 'lib/mandrill/api.rb', line 1484

def add(id, name=nil, notes=nil, custom_quota=nil)
    _params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}
    return @master.call 'subaccounts/add', _params
end

#delete(id) ⇒ Hash

Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail.

Parameters:

  • id (String)

    the unique identifier of the subaccount to delete

Returns:

  • (Hash)

    the information for the deleted subaccount

    • String

      id a unique indentifier for the subaccount

    • String

      name an optional display name for the subaccount

    • Integer

      custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation

    • String

      status the current sending status of the subaccount, one of “active” or “paused”

    • Integer

      reputation the subaccount’s current reputation on a scale from 0 to 100

    • String

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

    • String

      first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Integer

      sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)

    • Integer

      sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)

    • Integer

      sent_total the number of emails the subaccount has sent since it was created



1555
1556
1557
1558
# File 'lib/mandrill/api.rb', line 1555

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

#info(id) ⇒ Hash

Given the ID of an existing subaccount, return the data about it

Parameters:

  • id (String)

    the unique identifier of the subaccount to query

Returns:

  • (Hash)

    the information about the subaccount

    • String

      id a unique indentifier for the subaccount

    • String

      name an optional display name for the subaccount

    • String

      notes optional extra text to associate with the subaccount

    • Integer

      custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation

    • String

      status the current sending status of the subaccount, one of “active” or “paused”

    • Integer

      reputation the subaccount’s current reputation on a scale from 0 to 100

    • String

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

    • String

      first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Integer

      sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)

    • Integer

      sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)

    • Integer

      sent_total the number of emails the subaccount has sent since it was created

    • Integer

      sent_hourly the number of emails the subaccount has sent in the last hour

    • Integer

      hourly_quota the current hourly quota for the subaccount, either manual or reputation-based

    • Hash

      last_30_days stats for this subaccount in the last 30 days

      - [Integer] sent the number of emails sent for this subaccount in the last 30 days
      - [Integer] hard_bounces the number of emails hard bounced for this subaccount in the last 30 days
      - [Integer] soft_bounces the number of emails soft bounced for this subaccount in the last 30 days
      - [Integer] rejects the number of emails rejected for sending this subaccount in the last 30 days
      - [Integer] complaints the number of spam complaints for this subaccount in the last 30 days
      - [Integer] unsubs the number of unsbuscribes for this subaccount in the last 30 days
      - [Integer] opens the number of times emails have been opened for this subaccount in the last 30 days
      - [Integer] unique_opens the number of unique opens for emails sent for this subaccount in the last 30 days
      - [Integer] clicks the number of URLs that have been clicked for this subaccount in the last 30 days
      - [Integer] unique_clicks the number of unique clicks for emails sent for this subaccount in the last 30 days
      


1516
1517
1518
1519
# File 'lib/mandrill/api.rb', line 1516

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

#list(q = nil) ⇒ Array

Get the list of subaccounts defined for the account, optionally filtered by a prefix

Parameters:

  • q (String) (defaults to: nil)

    an optional prefix to filter the subaccounts’ ids and names

Returns:

  • (Array)

    the subaccounts for the account, up to a maximum of 1,000

    • Hash

      return[] the individual subaccount info

      - [String] id a unique indentifier for the subaccount
      - [String] name an optional display name for the subaccount
      - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
      - [String] status the current sending status of the subaccount, one of "active" or "paused"
      - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
      - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
      - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
      - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
      - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
      - [Integer] sent_total the number of emails the subaccount has sent since it was created
      


1463
1464
1465
1466
# File 'lib/mandrill/api.rb', line 1463

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

#pause(id) ⇒ Hash

Pause a subaccount’s sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed.

Parameters:

  • id (String)

    the unique identifier of the subaccount to pause

Returns:

  • (Hash)

    the information for the paused subaccount

    • String

      id a unique indentifier for the subaccount

    • String

      name an optional display name for the subaccount

    • Integer

      custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation

    • String

      status the current sending status of the subaccount, one of “active” or “paused”

    • Integer

      reputation the subaccount’s current reputation on a scale from 0 to 100

    • String

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

    • String

      first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Integer

      sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)

    • Integer

      sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)

    • Integer

      sent_total the number of emails the subaccount has sent since it was created



1573
1574
1575
1576
# File 'lib/mandrill/api.rb', line 1573

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

#resume(id) ⇒ Hash

Resume a paused subaccount’s sending

Parameters:

  • id (String)

    the unique identifier of the subaccount to resume

Returns:

  • (Hash)

    the information for the resumed subaccount

    • String

      id a unique indentifier for the subaccount

    • String

      name an optional display name for the subaccount

    • Integer

      custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation

    • String

      status the current sending status of the subaccount, one of “active” or “paused”

    • Integer

      reputation the subaccount’s current reputation on a scale from 0 to 100

    • String

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

    • String

      first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Integer

      sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)

    • Integer

      sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)

    • Integer

      sent_total the number of emails the subaccount has sent since it was created



1591
1592
1593
1594
# File 'lib/mandrill/api.rb', line 1591

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

#update(id, name = nil, notes = nil, custom_quota = nil) ⇒ Hash

Update an existing subaccount

Parameters:

  • id (String)

    the unique identifier of the subaccount to update

  • name (String) (defaults to: nil)

    an optional display name to further identify the subaccount

  • notes (String) (defaults to: nil)

    optional extra text to associate with the subaccount

  • custom_quota (Integer) (defaults to: nil)

    an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation

Returns:

  • (Hash)

    the information for the updated subaccount

    • String

      id a unique indentifier for the subaccount

    • String

      name an optional display name for the subaccount

    • Integer

      custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation

    • String

      status the current sending status of the subaccount, one of “active” or “paused”

    • Integer

      reputation the subaccount’s current reputation on a scale from 0 to 100

    • String

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

    • String

      first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Integer

      sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)

    • Integer

      sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)

    • Integer

      sent_total the number of emails the subaccount has sent since it was created



1537
1538
1539
1540
# File 'lib/mandrill/api.rb', line 1537

def update(id, name=nil, notes=nil, custom_quota=nil)
    _params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}
    return @master.call 'subaccounts/update', _params
end