class ComteleSdk::BlacklistService
Public Class Methods
new(api_key)
click to toggle source
# File lib/comtele_sdk.rb, line 207 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_blacklist()
click to toggle source
# File lib/comtele_sdk.rb, line 217 def get_blacklist() url = @base_address + '/blacklist' response = RestClient.get(url, @headers) return JSON.parse(response) end
get_by_phone_number(phone_number)
click to toggle source
# File lib/comtele_sdk.rb, line 224 def get_by_phone_number(phone_number) url = @base_address + '/blacklist?id=' + phone_number response = RestClient.get(url, @headers) return JSON.parse(response) end
insert(phone_number)
click to toggle source
# File lib/comtele_sdk.rb, line 231 def insert(phone_number) url = @base_address + '/blacklist' payload = JSON.generate({ 'phoneNumber': phone_number }) response = RestClient.post(url, payload, @headers) return JSON.parse(response) end
remove(phone_number)
click to toggle source
# File lib/comtele_sdk.rb, line 240 def remove(phone_number) url = @base_address + '/blacklist?id=' + phone_number response = RestClient.delete(url, {}, @headers) return JSON.parse(response) end