Class: SmsCenter::Plivo
- Inherits:
-
Object
- Object
- SmsCenter::Plivo
- Defined in:
- lib/sms_center/plivo.rb
Instance Attribute Summary collapse
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
-
#initialize(content, to_number, from_number, keys) ⇒ Plivo
constructor
A new instance of Plivo.
Constructor Details
#initialize(content, to_number, from_number, keys) ⇒ Plivo
Returns a new instance of Plivo.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/sms_center/plivo.rb', line 3 def initialize(content, to_number, from_number, keys) base64key = Base64.strict_encode64("#{keys[:PLIVO_ACCOUNT_SID]}:#{keys[:PLIVO_AUTH_TOKEN]}") @api_url = "https://api.plivo.com/v1/Account/#{keys[:PLIVO_ACCOUNT_SID]}/Message/" @headers = { 'Authorization' => "Basic #{base64key}" } @body = { src: from_number, dst: to_number, text: content } end |
Instance Attribute Details
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
2 3 4 |
# File 'lib/sms_center/plivo.rb', line 2 def api_url @api_url end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
2 3 4 |
# File 'lib/sms_center/plivo.rb', line 2 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
2 3 4 |
# File 'lib/sms_center/plivo.rb', line 2 def headers @headers end |