Class: Smess::Twilio

Inherits:
Output show all
Includes:
Logging
Defined in:
lib/smess/outputs/twilio.rb

Instance Attribute Summary collapse

Attributes inherited from Output

#config, #sms

Instance Method Summary collapse

Methods included from Logging

#logger

Constructor Details

#initialize(config) ⇒ Twilio

Returns a new instance of Twilio.



7
8
9
10
# File 'lib/smess/outputs/twilio.rb', line 7

def initialize(config)
  super
  @results = []
end

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



12
13
14
# File 'lib/smess/outputs/twilio.rb', line 12

def auth_token
  @auth_token
end

#callback_urlObject

Returns the value of attribute callback_url.



12
13
14
# File 'lib/smess/outputs/twilio.rb', line 12

def callback_url
  @callback_url
end

#fromObject

Returns the value of attribute from.



12
13
14
# File 'lib/smess/outputs/twilio.rb', line 12

def from
  @from
end

#messaging_service_sidObject

Returns the value of attribute messaging_service_sid.



12
13
14
# File 'lib/smess/outputs/twilio.rb', line 12

def messaging_service_sid
  @messaging_service_sid
end

#sidObject

Returns the value of attribute sid.



12
13
14
# File 'lib/smess/outputs/twilio.rb', line 12

def sid
  @sid
end

Instance Method Details

#deliverObject



21
22
23
# File 'lib/smess/outputs/twilio.rb', line 21

def deliver
  send_one_sms sms.message.strip_nongsm_chars
end

#validate_configObject



13
14
15
16
17
18
19
# File 'lib/smess/outputs/twilio.rb', line 13

def validate_config
  @sid = config.fetch(:sid)
  @auth_token = config.fetch(:auth_token)
  @from = config.fetch(:from, nil)
  @messaging_service_sid = config.fetch(:messaging_service_sid, nil)
  @callback_url = config.fetch(:callback_url)
end