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



663
664
665
# File 'lib/mandrill/api.rb', line 663

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



661
662
663
# File 'lib/mandrill/api.rb', line 661

def master
  @master
end

Instance Method Details

#parse(raw_message) ⇒ Hash

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



855
856
857
858
# File 'lib/mandrill/api.rb', line 855

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

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

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



826
827
828
829
# File 'lib/mandrill/api.rb', line 826

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

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

Send a new transactional message through Mandrill



729
730
731
732
# File 'lib/mandrill/api.rb', line 729

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

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

Take a raw MIME document for a message, and send it exactly as if it were sent over the SMTP protocol



874
875
876
877
# File 'lib/mandrill/api.rb', line 874

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

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

Send a new transactional message through Mandrill using a template



801
802
803
804
# File 'lib/mandrill/api.rb', line 801

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