class Tandarb::Client

Constants

BASE_URL

Public Instance Methods

delete(path:, token:) click to toggle source
# File lib/tandarb/client.rb, line 25
def delete(path:, token:)
  HTTParty.delete(BASE_URL + path, :headers => headers(token))
end
get(path, token) click to toggle source
# File lib/tandarb/client.rb, line 5
def get(path, token)
  HTTParty.get(
    BASE_URL + path,
    :headers => headers(token)).parsed_response
end
post(path, body, token) click to toggle source
# File lib/tandarb/client.rb, line 11
def post(path, body, token)
  HTTParty.post(
    BASE_URL + path,
    :headers => headers(token),
    :query => body).parsed_response
end
put(path:, body:, token:) click to toggle source
# File lib/tandarb/client.rb, line 18
def put(path:, body:, token:)
  HTTParty.put(
    BASE_URL + path,
    :headers => headers(token),
    :query => body).parsed_response
end

Private Instance Methods

headers(token) click to toggle source
# File lib/tandarb/client.rb, line 31
def headers(token)
  auth = "Bearer " + token
  {"Cache-Control"=> "no-cache", "Authorization"=> auth}
end