Class: Clicksign::API::Signer

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

Constant Summary collapse

REQUEST_PATH =
'/api/v1/signers/'
ATTRIBUTES =
[
  :email, :auths, :name, :documentation, :birthday,
  :has_documentation, :phone_number, :delivery
]

Class Method Summary collapse

Methods included from Requests

conn, get, post

Class Method Details

.body(params) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/clicksign/api/signer.rb', line 21

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

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

  body = { signer: signer }
end

.create(token:, params:) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/clicksign/api/signer.rb', line 13

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