Module: Vigiles

Extended by:
T::Sig
Defined in:
lib/vigiles/spec.rb,
lib/vigiles.rb,
lib/vigiles/types.rb,
lib/vigiles/archive.rb,
lib/vigiles/options.rb,
lib/vigiles/version.rb,
lib/vigiles/constants.rb,
lib/vigiles/utilities/uri.rb,
lib/vigiles/archive/extras.rb,
lib/vigiles/utilities/http.rb,
lib/vigiles/utilities/json.rb,
lib/vigiles/archive/request.rb,
lib/vigiles/archive/metadata.rb,
lib/vigiles/archive/response.rb,
lib/vigiles/archive/parameter.rb,
lib/vigiles/archive/conversation.rb,
lib/vigiles/conversation_recorder.rb,
lib/generators/vigiles/install_generator.rb,
lib/generators/vigiles/migration_generator.rb,
lib/vigiles/conversation_recorders/unknown.rb,
lib/vigiles/middleware/record_conversation.rb,
lib/generators/vigiles/initializer_generator.rb,
lib/vigiles/conversation_recorders/application_json.rb

Overview

typed: strict frozen_string_literal: true

Defined Under Namespace

Modules: Archive, Constants, ConversationRecorders, Generators, Middleware, Types, Utilities Classes: ConversationRecorder, Options, Spec

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.configure(&blk) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/vigiles.rb', line 47

def self.configure(&blk)
  blk.call(spec)

  # TODO(yaw, 2024-06-15): ensure that the spec is valid.
  # ensure that for every content type a recorder is configured. otherwise
  # assign the general recorder for unknown content types.
end

.maybe_record_conversation(req:, res:) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/vigiles.rb', line 38

def self.maybe_record_conversation(req:, res:)
  return unless should_record?(req)

  Archive.record_conversation(req:, res:)
rescue Archive::UnrecordableRequestError
  nil
end

.specObject



25
26
27
28
29
30
# File 'lib/vigiles.rb', line 25

def self.spec
  @spec ||= T.let(
    Vigiles::Spec.make_default_spec,
    T.nilable(Vigiles::Spec)
  )
end

.spec=(spec) ⇒ Object



33
34
35
# File 'lib/vigiles.rb', line 33

def self.spec=(spec)
  @spec = spec
end