Module: Chook

Defined in:
lib/chook/subject.rb,
lib/chook/event.rb,
lib/chook/procs.rb,
lib/chook/server.rb,
lib/chook/version.rb,
lib/chook/test_events.rb,
lib/chook/configuration.rb,
lib/chook/test_subjects.rb,
lib/chook/handled_events.rb,
lib/chook/event/test_event.rb,
lib/chook/handled_subjects.rb,
lib/chook/subject/samplers.rb,
lib/chook/server/routes/home.rb,
lib/chook/subject/validators.rb,
lib/chook/event/handled_event.rb,
lib/chook/subject/randomizers.rb,
lib/chook/subject/test_subject.rb,
lib/chook/subject/handled_subject.rb,
lib/chook/event/handled_event/handlers.rb,
lib/chook/server/routes/handle_webhook_event.rb

Overview

Licensed under the Apache License, Version 2.0 (the “Apache License”)

with the following modification; you may not use this file except in
compliance with the Apache License and the following modification to it:
Section 6. Trademarks. is deleted and replaced with:

6. Trademarks. This License does not grant permission to use the trade
   names, trademarks, service marks, or product names of the Licensor
   and its affiliates, except as required to comply with Section 4(c) of
   the License and to reproduce the content of the NOTICE file.

You may obtain a copy of the Apache License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the Apache License with the above modification is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the Apache License for the specific
language governing permissions and limitations under the Apache License.

Defined Under Namespace

Modules: HandledEvents, HandledSubjects, Procs, Randomizers, Samplers, TestSubjects, Validators Classes: Configuration, Event, HandledEvent, HandledSubject, Server, Subject, TestEvent, TestEvents, TestSubject

Constant Summary collapse

VERSION =

The version of the Chook framework

'1.0.1.b2'.freeze
CONFIG =

The single instance of Configuration

Chook::Configuration.instance

Class Method Summary collapse

Class Method Details

.event_handler(&block) {|The| ... } ⇒ Proc

This method is used by the Ruby event-handler files.

Loading them should call this method and pass in a block with one parameter: a Chook::HandledEvent subclass instance.

The block is then converted to a Proc instance in @loaded_event_handler and from there can be stored for use by the event identified by the filename.

NOTE: the files should be read with 'load' not 'require', so that they can be re-loaded as needed

Parameters:

  • block (Block)

    the block to be used as an event handler

Yield Parameters:

  • The (JSS::WebHooks::Event subclass)

    event to be handled

Returns:

  • (Proc)

    the block converted to a Proc


46
47
48
# File 'lib/chook/event/handled_event/handlers.rb', line 46

def self.event_handler(&block)
  HandledEvent::Handlers.loaded_handler = Proc.new(&block)
end

.sample_jsonsObject


41
42
43
# File 'lib/chook/event/handled_event.rb', line 41

def self.sample_jsons
  @sample_jsons
end