Class: Clicksign::API::Notifier

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

Constant Summary collapse

REQUEST_PATH =
'/api/v1/notifications'
ATTRIBUTES =
[:request_signature_key, :message, :url]

Class Method Summary collapse

Methods included from Requests

conn, get, post

Class Method Details

.body(params) ⇒ Object



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

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

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

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



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

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