Class: DMCourier::DeliveryMethod

Inherits:
Object
  • Object
show all
Includes:
Configurable, ServiceLocator
Defined in:
lib/dm_courier/delivery_method.rb

Instance Attribute Summary collapse

Attributes included from Configurable

#api_key, #async, #auto_html, #auto_text, #bcc_address, #from, #important, #inline_css, #log_content, #return_path_domain, #service_name, #signing_domain, #subaccount, #tags, #track_clicks, #track_opens, #track_url_without_query_string, #tracking_domain

Instance Method Summary collapse

Methods included from Configurable

#configure, keys, #options, #reset!, #same_options?

Methods included from ServiceLocator

#constantize, #service

Constructor Details

#initialize(options = {}) ⇒ DeliveryMethod

Returns a new instance of DeliveryMethod.



10
11
12
13
14
15
# File 'lib/dm_courier/delivery_method.rb', line 10

def initialize(options = {})
  DMCourier::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] ||
                          DMCourier.instance_variable_get(:"@#{key}"))
  end
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/dm_courier/delivery_method.rb', line 8

def response
  @response
end

Instance Method Details

#deliver!(mail) ⇒ Object



18
19
20
# File 'lib/dm_courier/delivery_method.rb', line 18

def deliver!(mail)
  @response = service.new(mail, options).deliver!
end