class ComteleSdk::CreditService
Public Class Methods
new(api_key)
click to toggle source
# File lib/comtele_sdk.rb, line 82 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
add_credits(username, amount)
click to toggle source
# File lib/comtele_sdk.rb, line 113 def add_credits(username, amount) url = @base_address + '/credits/'+ username + '?amount=' + amount.to_s response = RestClient.put(url, {}, @headers) return JSON.parse(response) end
get_credits(username)
click to toggle source
# File lib/comtele_sdk.rb, line 92 def get_credits(username) url = @base_address + '/credits/' + username response = RestClient.get(url, @headers) return JSON.parse(response) end
get_history(username)
click to toggle source
# File lib/comtele_sdk.rb, line 106 def get_history(username) url = @base_address + '/balancehistory/' + username response = RestClient.get(url, @headers) return JSON.parse(response) end
get_my_credits()
click to toggle source
# File lib/comtele_sdk.rb, line 99 def get_my_credits url = @base_address + '/credits' response = RestClient.get(url, @headers) return JSON.parse(response) end