Class: CourierRails::DeliveryMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/courier_rails/delivery_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DeliveryMethod

Returns a new instance of DeliveryMethod.



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

def initialize(options = {})
  @settings = options
end

Instance Attribute Details

#payloadObject

Returns the value of attribute payload.



6
7
8
# File 'lib/courier_rails/delivery_method.rb', line 6

def payload
  @payload
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/courier_rails/delivery_method.rb', line 6

def response
  @response
end

#settingsObject

Returns the value of attribute settings.



6
7
8
# File 'lib/courier_rails/delivery_method.rb', line 6

def settings
  @settings
end

Instance Method Details

#deliver!(mail) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/courier_rails/delivery_method.rb', line 12

def deliver!(mail)
  @payload = {}

  courier_data = find_courier_data_from mail

  prepare_event_from courier_data
  prepare_recipient_from mail, courier_data
  prepare_profile_from mail, courier_data
  prepare_data_from courier_data
  prepare_brand_from courier_data

  perfom_send_request
end