Sha256: f224d5c443626fe3b374f2aa13736892cad6e02f578bdc5201763f5c819ee2be

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

module Clicksign
  module API
    class Notifier
      extend Requests

      REQUEST_PATH = '/api/v1/signers/:key/notify'
      ATTRIBUTES = [:message]

      class << self
        def notify(document_key, params = {})
          post(
            path_for(document_key),
            body(params)
          )
        end

        def path_for(document_key)
          REQUEST_PATH.dup.tap do |path|
            path[':key'] = document_key
          end
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clicksign-api-0.0.2 lib/clicksign/api/notifier.rb