Class: Whoosh::Endpoint

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

Defined Under Namespace

Classes: Context

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.declared_routesObject



34
35
36
# File 'lib/whoosh/endpoint.rb', line 34

def declared_routes
  @declared_routes
end

.delete(path, **opts) ⇒ Object



54
55
56
# File 'lib/whoosh/endpoint.rb', line 54

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

.get(path, **opts) ⇒ Object



38
39
40
# File 'lib/whoosh/endpoint.rb', line 38

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

.inherited(subclass) ⇒ Object



29
30
31
32
# File 'lib/whoosh/endpoint.rb', line 29

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

.options(path, **opts) ⇒ Object



58
59
60
# File 'lib/whoosh/endpoint.rb', line 58

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

.patch(path, **opts) ⇒ Object



50
51
52
# File 'lib/whoosh/endpoint.rb', line 50

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

.post(path, **opts) ⇒ Object



42
43
44
# File 'lib/whoosh/endpoint.rb', line 42

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

.put(path, **opts) ⇒ Object



46
47
48
# File 'lib/whoosh/endpoint.rb', line 46

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

Instance Method Details

#call(req) ⇒ Object

Raises:

  • (NotImplementedError)


75
76
77
# File 'lib/whoosh/endpoint.rb', line 75

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