class SlackAPI

Public Class Methods

get(path, url_params = {}) click to toggle source
# File bin/mv-slacker, line 24
def self.get(path, url_params = {})
  response = Http.get(path, query: url_params.merge(token: $config[:slack_token]))
  $slack_login_time ||= DateTime.httpdate(response.headers['Date']).to_time.to_i
  raise Error.new("#{response.code} #{response.message}") unless response.code == 200
  json = JSON.parse(response.body)
  raise Error.new(response["error"]) unless response["ok"]
  json
end