Module: Smplkit::Audit::HttpMethod

Defined in:
lib/smplkit/audit/models.rb

Overview

HTTP verb used by a forwarder’s outbound delivery (ADR-047 §2.12).

Mirrors the audit spec’s HttpConfigurationMethod enum so the HttpConfiguration#method field is constrained to a known value instead of accepting any string. Members are declared in alphabetical order.

Constant Summary collapse

DELETE =
"DELETE"
GET =
"GET"
PATCH =
"PATCH"
POST =
"POST"
PUT =
"PUT"
VALUES =
[DELETE, GET, PATCH, POST, PUT].freeze

Class Method Summary collapse

Class Method Details

.coerce(value) ⇒ String?

Validate and normalize an input to a wire-format string.

Parameters:

  • value (String, nil)

    a published constant or its literal string.

Returns:

  • (String, nil)

    the canonical wire value (or nil when input is nil).

Raises:

  • (ArgumentError)

    when value is not a member of VALUES.



105
106
107
108
109
110
111
112
113
# File 'lib/smplkit/audit/models.rb', line 105

def self.coerce(value)
  return nil if value.nil?

  s = value.to_s
  return s if VALUES.include?(s)

  raise ArgumentError,
        "Unknown HttpMethod #{value.inspect}; expected one of #{VALUES.inspect}"
end