Sha256: f9d67ac6646b93086825bdf6ffd8dec2b3c04cd46bdf08bf3253926ca940e1c4
Contents?: true
Size: 892 Bytes
Versions: 3
Compression:
Stored size: 892 Bytes
Contents
module Boilercode class Client include HTTParty # base_uri "http://localhost:3000/api/v1" base_uri "https://boilercode.io/api/v1" attr_reader :config def initialize @config = Boilercode::Config.new end def get(endpoint) self.class.get(endpoint, headers: headers) end def post(endpoint, body) self.class.post(endpoint, headers: headers, body: body.to_json) end def patch(endpoint, body) self.class.patch(endpoint, headers: headers, body: body.to_json) end def put(endpoint, body) self.class.put(endpoint, headers: headers, body: body.to_json) end def delete(endpoint) self.class.delete(endpoint, headers: headers) end protected def headers { "Content-Type": "application/json", Authorization: "Bearer #{config.creds[:token]}" } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
boilercode-0.1.2 | lib/boilercode/client.rb |
boilercode-0.1.1 | lib/boilercode/client.rb |
boilercode-0.1.0 | lib/boilercode/client.rb |