Class: DelivereeSms::Telerivet
- Inherits:
-
Object
- Object
- DelivereeSms::Telerivet
- Defined in:
- lib/deliveree_sms/telerivet.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) ⇒ Telerivet
constructor
A new instance of Telerivet.
Constructor Details
#initialize(content, to_number, from_number, keys) ⇒ Telerivet
Returns a new instance of Telerivet.
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/deliveree_sms/telerivet.rb', line 3 def initialize(content, to_number, from_number, keys) base64key = Base64.strict_encode64("#{keys[:TELERIVET_API_KEY]}:") @api_url = "https://api.telerivet.com/v1/projects/#{keys[:TELERIVET_PROJECT_ID]}/messages/send" @headers = { 'Authorization' => "Basic #{base64key}", 'Content-Type' => 'application/json' } @body = { "content": content, "to_number": to_number } @body["from_number"] = from_number if from_number end |
Instance Attribute Details
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
2 3 4 |
# File 'lib/deliveree_sms/telerivet.rb', line 2 def api_url @api_url end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
2 3 4 |
# File 'lib/deliveree_sms/telerivet.rb', line 2 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
2 3 4 |
# File 'lib/deliveree_sms/telerivet.rb', line 2 def headers @headers end |