Class: Infobeep::SMSClient
- Inherits:
-
BaseClient
- Object
- BaseClient
- Infobeep::SMSClient
- Defined in:
- lib/infobeep/client.rb
Constant Summary collapse
- SMS_API_BASE_URL =
"#{API_BASE_URL}sms/1/"
Constants inherited from BaseClient
Instance Method Summary collapse
Methods inherited from BaseClient
#authentication_headers, #client_headers, #initialize
Constructor Details
This class inherits a constructor from Infobeep::BaseClient
Instance Method Details
#send_request(sms_request) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/infobeep/client.rb', line 36 def send_request(sms_request) url = SMS_API_BASE_URL + sms_request.route method = sms_request.http_method headers = client_headers.merge(sms_request.headers) payload = sms_request.payload begin response = RestClient::Request.execute(method: method, url: url, payload: payload, headers: headers) rescue RestClient::ExceptionWithResponse => err raise err end response_hash = JSON.parse(response.body) sms_request.response_class.new(response_hash) end |