Class: Courier::Service::Base
- Inherits:
-
Object
- Object
- Courier::Service::Base
show all
- Defined in:
- lib/courier/service/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.config ⇒ Object
32
33
34
|
# File 'lib/courier/service/base.rb', line 32
def config
@config
end
|
28
29
30
|
# File 'lib/courier/service/base.rb', line 28
def configure
yield @config
end
|
.inherited(subclass) ⇒ Object
23
24
25
26
|
# File 'lib/courier/service/base.rb', line 23
def inherited(subclass)
subclass.instance_variable_set('@config', OpenStruct.new)
super
end
|
Instance Method Details
#check_args(owner, template, args) ⇒ Object
37
38
39
40
41
|
# File 'lib/courier/service/base.rb', line 37
def check_args owner, template, args
args[:owner] ||=owner
args[:text] ||=template.get_text(args)
args[:service]||=self
end
|
#deliver! ⇒ Object
52
53
54
|
# File 'lib/courier/service/base.rb', line 52
def deliver!
raise 'inherit my class and implement me'
end
|
#message(owner, template, args) ⇒ Object
43
44
45
46
|
# File 'lib/courier/service/base.rb', line 43
def message(owner, template, args)
check_args owner, template, args
courier_messages.create! :owner=>owner, :template=>template, :options=>args
end
|
#name ⇒ Object
48
49
50
|
# File 'lib/courier/service/base.rb', line 48
def name
self.class.name.demodulize.underscore.to_sym
end
|