Class: Mandrill::Messages

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Messages



675
676
677
# File 'lib/mandrill/api.rb', line 675

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



673
674
675
# File 'lib/mandrill/api.rb', line 673

def master
  @master
end

Instance Method Details

#cancel_scheduled(id) ⇒ Hash

Cancels a scheduled email.



1007
1008
1009
1010
# File 'lib/mandrill/api.rb', line 1007

def cancel_scheduled(id)
    _params = {:id => id}
    return @master.call 'messages/cancel-scheduled', _params
end

#info(id) ⇒ Hash

Get the information for a single recently sent message



928
929
930
931
# File 'lib/mandrill/api.rb', line 928

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

#list_scheduled(to = nil) ⇒ Array

Queries your scheduled emails by sender or recipient, or both.



993
994
995
996
# File 'lib/mandrill/api.rb', line 993

def list_scheduled(to=nil)
    _params = {:to => to}
    return @master.call 'messages/list-scheduled', _params
end

#parse(raw_message) ⇒ Hash

Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces



957
958
959
960
# File 'lib/mandrill/api.rb', line 957

def parse(raw_message)
    _params = {:raw_message => raw_message}
    return @master.call 'messages/parse', _params
end

#reschedule(id, send_at) ⇒ Hash

Reschedules a scheduled email.



1022
1023
1024
1025
# File 'lib/mandrill/api.rb', line 1022

def reschedule(id, send_at)
    _params = {:id => id, :send_at => send_at}
    return @master.call 'messages/reschedule', _params
end

#search(query = '*', date_from = nil, date_to = nil, tags = nil, senders = nil, api_keys = nil, limit = 100) ⇒ Array

Search the content of recently sent messages and optionally narrow by date range, tags and senders



866
867
868
869
# File 'lib/mandrill/api.rb', line 866

def search(query='*', date_from=nil, date_to=nil, tags=nil, senders=nil, api_keys=nil, limit=100)
    _params = {:query => query, :date_from => date_from, :date_to => date_to, :tags => tags, :senders => senders, :api_keys => api_keys, :limit => limit}
    return @master.call 'messages/search', _params
end

#search_time_series(query = '*', date_from = nil, date_to = nil, tags = nil, senders = nil) ⇒ Array

Search the content of recently sent messages and return the aggregated hourly stats for matching messages



890
891
892
893
# File 'lib/mandrill/api.rb', line 890

def search_time_series(query='*', date_from=nil, date_to=nil, tags=nil, senders=nil)
    _params = {:query => query, :date_from => date_from, :date_to => date_to, :tags => tags, :senders => senders}
    return @master.call 'messages/search-time-series', _params
end

#send(message, async = false, ip_pool = nil, send_at = nil) ⇒ Array

Send a new transactional message through Mandrill



745
746
747
748
# File 'lib/mandrill/api.rb', line 745

def send(message, async=false, ip_pool=nil, send_at=nil)
    _params = {:message => message, :async => async, :ip_pool => ip_pool, :send_at => send_at}
    return @master.call 'messages/send', _params
end

#send_raw(raw_message, from_email = nil, from_name = nil, to = nil, async = false, ip_pool = nil, send_at = nil, return_path_domain = nil) ⇒ Array

Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill’s SMTP servers



978
979
980
981
# File 'lib/mandrill/api.rb', line 978

def send_raw(raw_message, from_email=nil, from_name=nil, to=nil, async=false, ip_pool=nil, send_at=nil, return_path_domain=nil)
    _params = {:raw_message => raw_message, :from_email => from_email, :from_name => from_name, :to => to, :async => async, :ip_pool => ip_pool, :send_at => send_at, :return_path_domain => return_path_domain}
    return @master.call 'messages/send-raw', _params
end

#send_template(template_name, template_content, message, async = false, ip_pool = nil, send_at = nil) ⇒ Array

Send a new transactional message through Mandrill using a template



821
822
823
824
# File 'lib/mandrill/api.rb', line 821

def send_template(template_name, template_content, message, async=false, ip_pool=nil, send_at=nil)
    _params = {:template_name => template_name, :template_content => template_content, :message => message, :async => async, :ip_pool => ip_pool, :send_at => send_at}
    return @master.call 'messages/send-template', _params
end