class ComteleSdk::ContextMessageService
Public Class Methods
new(api_key)
click to toggle source
# File lib/comtele_sdk.rb, line 34 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_report(start_date, end_date, sender = '', context_rule_name = '')
click to toggle source
# File lib/comtele_sdk.rb, line 73 def get_report(start_date, end_date, sender = '', context_rule_name = '') url = @base_address + '/contextreporting?startDate=' + start_date + '&endDate=' + end_date + '&sender=' + sender + '&contextRuleName=' + context_rule_name response = RestClient.get(url, @headers) return JSON.parse(response) end
schedule(sender, context_rule_name, schedule_date, receivers)
click to toggle source
# File lib/comtele_sdk.rb, line 58 def schedule(sender, context_rule_name, schedule_date, receivers) url = @base_address + '/schedulecontextmessage' payload = JSON.generate({ 'sender': sender, 'contextRuleName': context_rule_name, 'scheduleDate': schedule_date, 'receivers': receivers.join(',') }) response = RestClient.post(url, payload, @headers) return JSON.parse(response) end
send(sender, context_rule_name, receivers)
click to toggle source
# File lib/comtele_sdk.rb, line 44 def send(sender, context_rule_name, receivers) url = @base_address + '/sendcontextmessage' payload = JSON.generate({ 'sender': sender, 'contextRuleName': context_rule_name, 'receivers': receivers.join(',') }) response = RestClient.post(url, payload, @headers) return JSON.parse(response) end