Class: SendCloud::DeliveryClass

Inherits:
Object
  • Object
show all
Defined in:
lib/send-cloud.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ DeliveryClass

Returns a new instance of DeliveryClass.



27
28
29
30
# File 'lib/send-cloud.rb', line 27

def initialize (settings)
  SendCloud.api_user = settings[:api_user]
  SendCloud.api_key = settings[:api_key]
end

Instance Attribute Details

#settingsObject

Returns the value of attribute settings.



25
26
27
# File 'lib/send-cloud.rb', line 25

def settings
  @settings
end

Instance Method Details

#deliver!(mail) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/send-cloud.rb', line 32

def deliver! (mail)
  begin
    SendCloud::Mail.send({
      from: mail.from_addrs.first,
      to: mail.destinations.join(';'),
      subject: mail.subject,
      html: mail.body.encoded,
      fromname: mail[:fromname].to_s
    })
  rescue => e
    raise e
  end
end