class Pandadoc::Api::Client
Public Instance Methods
delete(path, token)
click to toggle source
# File lib/pandadoc/api/client.rb, line 17 def delete(path, token) uri = build_uri(path) HTTParty.delete(uri, headers: default_headers(token)) end
get(path, token, params = {})
click to toggle source
# File lib/pandadoc/api/client.rb, line 6 def get(path, token, params = {}) uri = build_uri(path) HTTParty.get(uri, headers: default_headers(token), query: params) end
post_json(path, token, params = {})
click to toggle source
# File lib/pandadoc/api/client.rb, line 11 def post_json(path, token, params = {}) uri = build_uri(path) headers = default_headers(token).merge('Content-Type' => 'application/json') HTTParty.post(uri, headers: headers, body: params.to_json) end
Private Instance Methods
build_uri(path)
click to toggle source
# File lib/pandadoc/api/client.rb, line 30 def build_uri(path) File.join(Pandadoc::Api::API_ROOT, path) end
default_headers(token)
click to toggle source
# File lib/pandadoc/api/client.rb, line 24 def default_headers(token) { 'Authorization' => "Bearer #{token}" } end