Class: Pandadoc::Api::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pandadoc/api/client.rb

Instance Method Summary collapse

Instance Method Details

#delete(path, token) ⇒ Object



17
18
19
20
# 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 = {}) ⇒ Object



6
7
8
9
# 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 = {}) ⇒ Object



11
12
13
14
15
# 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