Module: Knock

Defined in:
lib/knock.rb,
lib/knock/base.rb,
lib/knock/users.rb,
lib/knock/client.rb,
lib/knock/errors.rb,
lib/knock/objects.rb,
lib/knock/version.rb,
lib/knock/messages.rb,
lib/knock/workflows.rb,
lib/knock/preferences.rb,
lib/knock/bulk_operations.rb

Defined Under Namespace

Modules: Base, BulkOperations, Client, Messages, Objects, Preferences, Users, Workflows Classes: APIError, AuthenticationError, InvalidRequestError, KnockError

Constant Summary collapse

API_HOSTNAME =
ENV["KNOCK_API_HOSTNAME"] || "api.knock.app"
VERSION =
"0.4.2"

Class Method Summary collapse

Class Method Details

.keyObject



13
14
15
# File 'lib/knock.rb', line 13

def self.key
  Base.key
end

.key!Object



17
18
19
# File 'lib/knock.rb', line 17

def self.key!
  key || raise("Knock.key not set")
end

.key=(value) ⇒ Object



9
10
11
# File 'lib/knock.rb', line 9

def self.key=(value)
  Base.key = value
end

.notify(**args) ⇒ Hash

Triggers the workflow with the given key

Parameters:

  • key (String)

    The workflow key

  • actor (String)

    The actor ID

  • recipients (Array<String>)

    The recipient IDs

  • data (Hash)

    The data to pass to the workflow

  • cancellation_key (String)

    An optional key to identify this workflow invocation for cancelling

  • tenant (String)

    An optional tenant identifier

Returns:

  • (Hash)

    A workflow trigger result



51
52
53
# File 'lib/knock.rb', line 51

def self.notify(**args)
  Knock::Workflows.trigger(**args)
end