module Botan
Constants
- API_URL
- VERSION
Attributes
configuration[W]
Public Class Methods
configuration()
click to toggle source
# File lib/botan.rb, line 31 def self.configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/botan.rb, line 35 def self.configure yield(configuration) end
track(uid, message, name, token = nil)
click to toggle source
# File lib/botan.rb, line 15 def self.track(uid, message, name, token = nil) token = token || Botan.configuration.token begin response = Faraday.new(url: API_URL).post do |req| req.url "/track?token=#{token}&uid=#{uid}&name=#{name}" req.headers['Content-Type'] = 'application/json' req.body = JSON.dump({text: message}) end JSON.parse(response.body) rescue => e raise Botan::ResponseError.new(e.message) end end