Class: Smess::Auto
Instance Attribute Summary collapse
Attributes inherited from Output
#config, #sms
Instance Method Summary
collapse
Methods inherited from Output
#check, #initialize, #verify
Constructor Details
This class inherits a constructor from Smess::Output
Instance Attribute Details
#output_name ⇒ Object
Returns the value of attribute output_name.
4
5
6
|
# File 'lib/smess/outputs/auto.rb', line 4
def output_name
@output_name
end
|
Instance Method Details
#deliver ⇒ Object
9
10
11
12
|
# File 'lib/smess/outputs/auto.rb', line 9
def deliver
out = output_for sms.to
out.deliver.merge({sent_with: output_name})
end
|
#get_output_name_for_msisdn(msisdn) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/smess/outputs/auto.rb', line 19
def get_output_name_for_msisdn(msisdn)
3.downto(0).each do |index|
return Smess.config.output_by_country_code[msisdn[0..index]] if Smess.config.output_by_country_code.key? msisdn[0..index]
end
Smess.config.default_output
end
|
#output_for(msisdn) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/smess/outputs/auto.rb', line 26
def output_for(msisdn)
@output_name = get_output_name_for_msisdn(msisdn)
output = Smess.named_output_instance( output_name )
output.sms = sms
output
end
|
#send_feedback(message_sid) ⇒ Object
14
15
16
17
|
# File 'lib/smess/outputs/auto.rb', line 14
def send_feedback(message_sid)
out = output_for sms.to
out.send_feedback(message_sid)
end
|
#validate_config ⇒ Object
6
7
|
# File 'lib/smess/outputs/auto.rb', line 6
def validate_config
end
|