Class: Whoosh::Endpoint

Inherits:
Object
  • Object
show all
Includes:
Streaming::Helpers
Defined in:
lib/whoosh/endpoint.rb

Defined Under Namespace

Classes: Context

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Streaming::Helpers

#stream, #stream_llm

Class Method Details

.declared_routesObject



36
37
38
# File 'lib/whoosh/endpoint.rb', line 36

def declared_routes
  @declared_routes
end

.delete(path, **opts) ⇒ Object



64
65
66
# File 'lib/whoosh/endpoint.rb', line 64

def delete(path, **opts)
  declare_route("DELETE", path, **opts)
end

.dependenciesObject



44
45
46
# File 'lib/whoosh/endpoint.rb', line 44

def dependencies
  @dependencies || []
end

.get(path, **opts) ⇒ Object



48
49
50
# File 'lib/whoosh/endpoint.rb', line 48

def get(path, **opts)
  declare_route("GET", path, **opts)
end

.inherited(subclass) ⇒ Object



31
32
33
34
# File 'lib/whoosh/endpoint.rb', line 31

def inherited(subclass)
  super
  subclass.instance_variable_set(:@declared_routes, [])
end

.inject(*names) ⇒ Object



40
41
42
# File 'lib/whoosh/endpoint.rb', line 40

def inject(*names)
  @dependencies = names
end

.options(path, **opts) ⇒ Object



68
69
70
# File 'lib/whoosh/endpoint.rb', line 68

def options(path, **opts)
  declare_route("OPTIONS", path, **opts)
end

.patch(path, **opts) ⇒ Object



60
61
62
# File 'lib/whoosh/endpoint.rb', line 60

def patch(path, **opts)
  declare_route("PATCH", path, **opts)
end

.post(path, **opts) ⇒ Object



52
53
54
# File 'lib/whoosh/endpoint.rb', line 52

def post(path, **opts)
  declare_route("POST", path, **opts)
end

.put(path, **opts) ⇒ Object



56
57
58
# File 'lib/whoosh/endpoint.rb', line 56

def put(path, **opts)
  declare_route("PUT", path, **opts)
end

Instance Method Details

#call(req) ⇒ Object

Raises:

  • (NotImplementedError)


85
86
87
# File 'lib/whoosh/endpoint.rb', line 85

def call(req)
  raise NotImplementedError, "#{self.class}#call must be implemented"
end