Class: GoogleHttpActionmailer::DeliveryMethod
- Inherits:
-
Object
- Object
- GoogleHttpActionmailer::DeliveryMethod
- Defined in:
- lib/google_http_actionmailer.rb
Instance Attribute Summary collapse
-
#delivery_options ⇒ Object
readonly
Returns the value of attribute delivery_options.
-
#message_options ⇒ Object
readonly
Returns the value of attribute message_options.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(params) ⇒ DeliveryMethod
constructor
A new instance of DeliveryMethod.
Constructor Details
#initialize(params) ⇒ DeliveryMethod
Returns a new instance of DeliveryMethod.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/google_http_actionmailer.rb', line 14 def initialize(params) @service = Google::Apis::GmailV1::GmailService.new @service. = params[:authorization] @service..merge params[:request_options] unless params[:client_options].nil? @service..members.each do |opt| opt = opt.to_sym unless params[:client_options][opt].nil? @service.[opt] = params[:client_options][opt] end end end = params[:message_options] || {} = params[:delivery_options] || {} end |
Instance Attribute Details
#delivery_options ⇒ Object (readonly)
Returns the value of attribute delivery_options.
12 13 14 |
# File 'lib/google_http_actionmailer.rb', line 12 def end |
#message_options ⇒ Object (readonly)
Returns the value of attribute message_options.
11 12 13 |
# File 'lib/google_http_actionmailer.rb', line 11 def end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
10 11 12 |
# File 'lib/google_http_actionmailer.rb', line 10 def service @service end |
Instance Method Details
#deliver!(mail) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/google_http_actionmailer.rb', line 33 def deliver!(mail) user_id = [:user_id] || 'me' = Google::Apis::GmailV1::Message.new( raw: mail.to_s, thread_id: mail['Thread-ID'] ) before_send = [:before_send] if before_send && before_send.respond_to?(:call) before_send.call(mail, ) end = service.( user_id, , ) after_send = [:after_send] if after_send && after_send.respond_to?(:call) after_send.call(mail, ) end end |