Class: Mandrill::Urls

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Urls

Returns a new instance of Urls.



1600
1601
1602
# File 'lib/mandrill/api.rb', line 1600

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



1598
1599
1600
# File 'lib/mandrill/api.rb', line 1598

def master
  @master
end

Instance Method Details

#add_tracking_domain(domain) ⇒ Hash

Add a tracking domain to your account

Parameters:

  • domain (String)

    a domain name

Returns:

  • (Hash)

    information about the domain

    • String

      domain the tracking domain name

    • String

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

    • String

      last_tested_at when the domain’s DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Hash

      cname details about the domain’s CNAME record

      - [Boolean] valid whether the domain's CNAME record is valid for use with Mandrill
      - [String] valid_after when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
      - [String] error an error describing the CNAME record, or null if the record is correct
      
    • Boolean

      valid_tracking whether this domain can be used as a tracking domain for email.



1669
1670
1671
1672
# File 'lib/mandrill/api.rb', line 1669

def add_tracking_domain(domain)
    _params = {:domain => domain}
    return @master.call 'urls/add-tracking-domain', _params
end

#check_tracking_domain(domain) ⇒ Hash

Checks the CNAME settings for a tracking domain. The domain must have been added already with the add-tracking-domain call

Parameters:

  • domain (String)

    an existing tracking domain name

Returns:

  • (Hash)

    information about the tracking domain

    • String

      domain the tracking domain name

    • String

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

    • String

      last_tested_at when the domain’s DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Hash

      cname details about the domain’s CNAME record

      - [Boolean] valid whether the domain's CNAME record is valid for use with Mandrill
      - [String] valid_after when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
      - [String] error an error describing the CNAME record, or null if the record is correct
      
    • Boolean

      valid_tracking whether this domain can be used as a tracking domain for email.



1685
1686
1687
1688
# File 'lib/mandrill/api.rb', line 1685

def check_tracking_domain(domain)
    _params = {:domain => domain}
    return @master.call 'urls/check-tracking-domain', _params
end

#listArray

Get the 100 most clicked URLs

Returns:

  • (Array)

    the 100 most clicked URLs and their stats

    • Hash

      return[] the individual URL stats

      - [String] url the URL to be tracked
      - [Integer] sent the number of emails that contained the URL
      - [Integer] clicks the number of times the URL has been clicked from a tracked email
      - [Integer] unique_clicks the number of unique emails that have generated clicks for this URL
      


1611
1612
1613
1614
# File 'lib/mandrill/api.rb', line 1611

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

#search(q) ⇒ Array

Return the 100 most clicked URLs that match the search query given

Parameters:

  • q (String)

    a search query

Returns:

  • (Array)

    the 100 most clicked URLs matching the search query

    • Hash

      return[] the URL matching the query

      - [String] url the URL to be tracked
      - [Integer] sent the number of emails that contained the URL
      - [Integer] clicks the number of times the URL has been clicked from a tracked email
      - [Integer] unique_clicks the number of unique emails that have generated clicks for this URL
      


1624
1625
1626
1627
# File 'lib/mandrill/api.rb', line 1624

def search(q)
    _params = {:q => q}
    return @master.call 'urls/search', _params
end

#time_series(url) ⇒ Array

Return the recent history (hourly stats for the last 30 days) for a url

Parameters:

  • url (String)

    an existing URL

Returns:

  • (Array)

    the array of history information

    • Hash

      return[] the information for a single hour

      - [String] time the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
      - [Integer] sent the number of emails that were sent with the URL during the hour
      - [Integer] clicks the number of times the URL was clicked during the hour
      - [Integer] unique_clicks the number of unique clicks generated for emails sent with this URL during the hour
      


1637
1638
1639
1640
# File 'lib/mandrill/api.rb', line 1637

def time_series(url)
    _params = {:url => url}
    return @master.call 'urls/time-series', _params
end

#tracking_domainsArray

Get the list of tracking domains set up for this account

Returns:

  • (Array)

    the tracking domains and their status

    • Hash

      return[] the individual tracking domain

      - [String] domain the tracking domain name
      - [String] created_at the date and time that the tracking domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
      - [String] last_tested_at when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format
      - [Hash] cname details about the domain's CNAME record
          - [Boolean] valid whether the domain's CNAME record is valid for use with Mandrill
          - [String] valid_after when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
          - [String] error an error describing the CNAME record, or null if the record is correct
      - [Boolean] valid_tracking whether this domain can be used as a tracking domain for email.
      


1653
1654
1655
1656
# File 'lib/mandrill/api.rb', line 1653

def tracking_domains()
    _params = {}
    return @master.call 'urls/tracking-domains', _params
end