Class: CakeMail::Relay
- Inherits:
-
Object
- Object
- CakeMail::Relay
- Defined in:
- lib/cakemail/relay.rb
Class Method Summary collapse
-
.get_logs(args) ⇒ Object
Retrieves logs from Relay.
-
.send(args) ⇒ Object
Send an email using the Relay.
Class Method Details
.get_logs(args) ⇒ Object
Retrieves logs from Relay.
Arguments :
-
args = { :user => required, :log_type => required, :start_time => optional, :end_time => optional }
54 55 56 57 58 59 60 61 |
# File 'lib/cakemail/relay.rb', line 54 def get_logs(args) raise ArgumentError if args.nil? or args[:user] or args[:log_type].nil? = { :user_key => args[:user].user_key, :log_type => args[:log_type] } [:start_time] = args[:start_time] unless args[:start_time].nil? [:end_time] = args[:end_time] unless args[:end_time].nil? res = args[:user].session.request("CakeMail::API::ClassRelay", "Send", ) return res['bounce_log'] end |
.send(args) ⇒ Object
Send an email using the Relay.
Arguments :
-
args = { :user => required, :email => required, :sender_name => required, :sender_email => required, :subject => required, :html_message => optional, :text_message => optional, :encoding => optional, :track_opening => optional, :track_clicks_in_html => optional, :track_clicks_in_text => optional, :data => optional/custom }
Custom format of :data :
- { :type => “text”, :name => “schedule” }, { :type => “text”, :name => “schedule” }, …
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cakemail/relay.rb', line 37 def send(args) raise ArgumentError if args.nil? or args[:user] or args[:email].nil? or args[:sender_name] or args[:sender_email] or args[:subject] = { :user_key => args[:user].user_key, :email => args[:email], :sender_name => args[:sender_name], :sender_email => args[:sender_email], :subject => args[:subject] } [:html_message] = args[:html_message] unless args[:html_message].nil? [:text_message] = args[:text_message] unless args[:text_message].nil? [:encoding] = args[:encoding] unless args[:encoding].nil? [:track_opening] = args[:track_opening] unless args[:track_opening].nil? [:track_clicks_in_html] = args[:track_clicks_in_html] unless args[:track_clicks_in_html].nil? [:track_clicks_in_text] = args[:track_clicks_in_text] unless args[:track_clicks_in_text].nil? [:data] = args[:data] unless args[:data].nil? res = args[:user].session.request("CakeMail::API::ClassRelay", "Send", ) end |