Class: Unisms::Sms

Inherits:
Object
  • Object
show all
Defined in:
lib/unisms/sms.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter = nil) ⇒ Sms

Returns a new instance of Sms.



10
11
12
# File 'lib/unisms/sms.rb', line 10

def initialize(adapter = nil)
	@adapter = adapter || self.class.default_adapter
end

Class Attribute Details

.default_adapterObject

Returns the value of attribute default_adapter.



5
6
7
# File 'lib/unisms/sms.rb', line 5

def default_adapter
  @default_adapter
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



8
9
10
# File 'lib/unisms/sms.rb', line 8

def adapter
  @adapter
end

Instance Method Details

#deliver(message, to: nil, from: nil) ⇒ Object



14
15
16
17
# File 'lib/unisms/sms.rb', line 14

def deliver(message, to: nil, from: nil)
	Unisms.logger.info "Using #{@adapter} to send message to #{to}"
	@adapter.deliver(message, to: to, from: from)
end