Sha256: 4d3ee9a4de3791d9e43a1f82ad07620c040af60a8f9daf39a52c47f0903f5e45
Contents?: true
Size: 726 Bytes
Versions: 8
Compression:
Stored size: 726 Bytes
Contents
module Billogram class Client include HTTParty format :json def initialize(username, password, base_uri) self.class.default_options.merge!(base_uri: base_uri, basic_auth: {username: username, password: password}) end def get(*args) handle_request(:get, *args) end def post(*args) handle_request(:post, *args) end def put(*args) handle_request(:put, *args) end def delete(*args) handle_request(:delete, *args) end def handle_request(method, *args) response = self.class.send(method, *args) return response.parsed_response["data"] if response.code == 200 raise Billogram::Error.from_response(response) end end end
Version data entries
8 entries across 8 versions & 1 rubygems