Module: Clicksign::API::Requests

Included in:
Batch, Document, DocumentsSigners, Notifier, Signer, WhatsappNotifier
Defined in:
lib/clicksign/api/requests.rb

Instance Method Summary collapse

Instance Method Details

#get(request_path, token) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/clicksign/api/requests.rb', line 14

def get(request_path, token)
  response = conn.get do |req|
    req.url request_path, { access_token: Clicksign::API.credentials[token] }
    req.headers['Content-Type'] = 'application/json'
  end
  
  parse(response)
end

#patch(request_path, body, token) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/clicksign/api/requests.rb', line 23

def patch(request_path, body, token)
  response = conn.patch do |req|
    req.url request_path, { access_token: Clicksign::API.credentials[token] }
    req.headers['Content-Type'] = 'application/json'
    req.body = body.to_json
  end

  parse(response)
end

#post(request_path, body, token) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/clicksign/api/requests.rb', line 4

def post(request_path, body, token)
  response = conn.post do |req|
    req.url request_path, { access_token: Clicksign::API.credentials[token] }
    req.headers['Content-Type'] = 'application/json'
    req.body = body.to_json
  end
  
  parse(response)
end