Sha256: 8c3277f49bbf4a9878a2d691113d4a0d97b393580908f2e30d5422e603ae115d
Contents?: true
Size: 708 Bytes
Versions: 2
Compression:
Stored size: 708 Bytes
Contents
module Esbit class Connection def initialize(campfire) @campfire = campfire end def get(path, params = {}) make_request do RestClient.get request_url(path), params end end def post(path, params = {}) make_request do RestClient.post request_url(path), params end end private def make_request raw_response = yield handle_response(raw_response) end def handle_response(raw_response) JSON.parse raw_response end def base_url "https://#{@campfire.token}@#{@campfire.subdomain}.campfirenow.com" end def request_url(path) "#{URI.join(base_url, path)}.json" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
esbit-0.0.4 | lib/esbit/connection.rb |
esbit-0.0.3 | lib/esbit/connection.rb |