class ComteleSdk::TextMessageService
Public Class Methods
new(api_key)
click to toggle source
# File lib/comtele_sdk.rb, line 152 def initialize(api_key) @api_key = api_key @base_address = 'https://sms.comtele.com.br/api/v2' @headers = { 'Accept': 'application/json', 'Content-type': 'application/json', 'auth-key': @api_key } end
Public Instance Methods
get_consolidated_report(start_date, end_date, group_type)
click to toggle source
# File lib/comtele_sdk.rb, line 198 def get_consolidated_report(start_date, end_date, group_type) url = @base_address + '/consolidatedreporting?startDate=' + start_date + '&endDate=' + end_date + '&group=' + group_type response = RestClient.get(url, @headers) return JSON.parse(response) end
get_detailed_report(start_date, end_date, delivery_status)
click to toggle source
# File lib/comtele_sdk.rb, line 191 def get_detailed_report(start_date, end_date, delivery_status) url = @base_address + '/detailedreporting?startDate=' + start_date + '&endDate=' + end_date + '&delivered=' + delivery_status response = RestClient.get(url, @headers) return JSON.parse(response) end
schedule(sender, content, schedule_date, receivers)
click to toggle source
# File lib/comtele_sdk.rb, line 176 def schedule(sender, content, schedule_date, receivers) url = @base_address + '/schedule' payload = JSON.generate({ 'sender': sender, 'content': content, 'scheduleDate': schedule_date, 'receivers': receivers.join(',') }) response = RestClient.post(url, payload, @headers) return JSON.parse(response) end
send(sender, content, receivers)
click to toggle source
# File lib/comtele_sdk.rb, line 162 def send(sender, content, receivers) url = @base_address + '/send' payload = JSON.generate({ 'sender': sender, 'content': content, 'receivers': receivers.join(',') }) response = RestClient.post(url, payload, @headers) return JSON.parse(response) end