Class: Mailstro::Delivery

Inherits:
Resource show all
Defined in:
lib/mailstro/delivery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email_name, options) ⇒ Delivery

Returns a new instance of Delivery.



5
6
7
8
# File 'lib/mailstro/delivery.rb', line 5

def initialize(email_name, options)
  @email_name = email_name
  @options    = options
end

Instance Attribute Details

#email_nameObject (readonly)

Returns the value of attribute email_name.



3
4
5
# File 'lib/mailstro/delivery.rb', line 3

def email_name
  @email_name
end

Instance Method Details

#dataObject



14
15
16
# File 'lib/mailstro/delivery.rb', line 14

def data
  @options.fetch(:data, nil)
end

#deliverObject



18
19
20
21
22
23
24
# File 'lib/mailstro/delivery.rb', line 18

def deliver
  post("deliveries",
       :to         => to,
       :email_name => email_name,
       :data       => data
  )
end

#toObject



10
11
12
# File 'lib/mailstro/delivery.rb', line 10

def to
  @options.fetch(:to)
end