Class: Smess::Clickatell
- Includes:
- Logging
- Defined in:
- lib/smess/outputs/clickatell.rb
Instance Attribute Summary collapse
-
#api_id ⇒ Object
Returns the value of attribute api_id.
-
#pass ⇒ Object
Returns the value of attribute pass.
-
#sender_id ⇒ Object
Returns the value of attribute sender_id.
-
#sender_ids ⇒ Object
Returns the value of attribute sender_ids.
-
#user ⇒ Object
Returns the value of attribute user.
Attributes inherited from Output
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(config) ⇒ Clickatell
constructor
A new instance of Clickatell.
- #validate_config ⇒ Object
Methods included from Logging
Methods inherited from Output
#check, #send_feedback, #verify
Constructor Details
#initialize(config) ⇒ Clickatell
Returns a new instance of Clickatell.
29 30 31 32 33 |
# File 'lib/smess/outputs/clickatell.rb', line 29 def initialize(config) super ::Clickatell::API.debug_mode = true ::Clickatell::API.secure_mode = true end |
Instance Attribute Details
#api_id ⇒ Object
Returns the value of attribute api_id.
50 51 52 |
# File 'lib/smess/outputs/clickatell.rb', line 50 def api_id @api_id end |
#pass ⇒ Object
Returns the value of attribute pass.
50 51 52 |
# File 'lib/smess/outputs/clickatell.rb', line 50 def pass @pass end |
#sender_id ⇒ Object
Returns the value of attribute sender_id.
50 51 52 |
# File 'lib/smess/outputs/clickatell.rb', line 50 def sender_id @sender_id end |
#sender_ids ⇒ Object
Returns the value of attribute sender_ids.
50 51 52 |
# File 'lib/smess/outputs/clickatell.rb', line 50 def sender_ids @sender_ids end |
#user ⇒ Object
Returns the value of attribute user.
50 51 52 |
# File 'lib/smess/outputs/clickatell.rb', line 50 def user @user end |
Instance Method Details
#deliver ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/smess/outputs/clickatell.rb', line 35 def deliver begin responses = [] .each do |msg| rsp = api.(sms.to, msg.encode('ISO-8859-1'), {from: from, concat: 3, callback: 7}) responses << rsp end result = normal_result(responses.first) rescue => e # connection problem or some error result = result_for_error(e) end result end |
#validate_config ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/smess/outputs/clickatell.rb', line 51 def validate_config @api_id = config.fetch(:api_id) @user = config.fetch(:user) @pass = config.fetch(:pass) @sender_id = config.fetch(:sender_id) @sender_ids = config.fetch(:sender_ids) end |