Class: Clicksign::API::Batch

Inherits:
Object
  • Object
show all
Extended by:
Requests
Defined in:
lib/clicksign/api/batch.rb

Constant Summary collapse

REQUEST_PATH =
'/api/v1/batches'
ATTRIBUTES =
[:signer_key, :document_keys, :summary]

Class Method Summary collapse

Methods included from Requests

conn, get, post

Class Method Details

.body(params) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/clicksign/api/batch.rb', line 18

def body(params)
  params = params.transform_keys(&:to_sym)

  batch = ATTRIBUTES.each.with_object({}) do |attribute, hash|
    hash[attribute] = params[attribute] if params.has_key?(attribute)
  end

  body = { batch: batch }
end

.create(token:, params: {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/clicksign/api/batch.rb', line 10

def create(token:, params:  {})
  post(
    REQUEST_PATH,
    body(params),
    token,
  )
end