Class: Lita::HTTPRoute

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/http_route.rb

Overview

Handlers use this class to define HTTP routes for the built-in web server.

Constant Summary collapse

ExtendedRoute =

An HttpRouter::Route class used for dispatch.

Since:

  • 3.0.0

Class.new(HttpRouter::Route) do
  include HttpRouter::RouteHelper
  include HttpRouter::GenerationHelper
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handler_class) ⇒ HTTPRoute

Returns a new instance of HTTPRoute.

Parameters:

  • handler_class (Lita::Handler)

    The handler registering the route.



17
18
19
# File 'lib/lita/http_route.rb', line 17

def initialize(handler_class)
  @handler_class = handler_class
end

Instance Attribute Details

#handler_classLita::Handler (readonly)

The handler registering the route.

Returns:



14
15
16
# File 'lib/lita/http_route.rb', line 14

def handler_class
  @handler_class
end

Instance Method Details

#delete(path, method_name, options = {}) ⇒ void #delete(path, options = {}) { ... } ⇒ void

Overloads:

  • #delete(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “delete” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #delete(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “delete” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



51
# File 'lib/lita/http_route.rb', line 51

define_http_method :delete

#get(path, method_name, options = {}) ⇒ void #get(path, options = {}) { ... } ⇒ void

Overloads:

  • #get(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “get” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #get(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “get” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



47
# File 'lib/lita/http_route.rb', line 47

define_http_method :get

#head(path, method_name, options = {}) ⇒ void #head(path, options = {}) { ... } ⇒ void

Overloads:

  • #head(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “head” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #head(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “head” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



46
# File 'lib/lita/http_route.rb', line 46

define_http_method :head

Overloads:

  • #link(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “link” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #link(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “link” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



53
# File 'lib/lita/http_route.rb', line 53

define_http_method :link

#options(path, method_name, options = {}) ⇒ void #options(path, options = {}) { ... } ⇒ void

Overloads:

  • #options(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “options” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #options(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “options” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



52
# File 'lib/lita/http_route.rb', line 52

define_http_method :options

#patch(path, method_name, options = {}) ⇒ void #patch(path, options = {}) { ... } ⇒ void

Overloads:

  • #patch(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “patch” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #patch(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “patch” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



50
# File 'lib/lita/http_route.rb', line 50

define_http_method :patch

#post(path, method_name, options = {}) ⇒ void #post(path, options = {}) { ... } ⇒ void

Overloads:

  • #post(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “post” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #post(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “post” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



48
# File 'lib/lita/http_route.rb', line 48

define_http_method :post

#put(path, method_name, options = {}) ⇒ void #put(path, options = {}) { ... } ⇒ void

Overloads:

  • #put(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “put” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #put(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “put” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



49
# File 'lib/lita/http_route.rb', line 49

define_http_method :put

Overloads:

  • #unlink(path, method_name, options = {}) ⇒ void

    This method returns an undefined value.

    Defines a new route with the “unlink” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • method_name (Symbol, String)

      The name of the instance method in the handler to call for the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

  • #unlink(path, options = {}) { ... } ⇒ void

    This method returns an undefined value.

    Defines a new route with the “unlink” HTTP method.

    Parameters:

    • path (String)

      The URL path component that will trigger the route.

    • options (Hash) (defaults to: {})

      Various options for controlling the behavior of the route.

    Yields:

    • The body of the route’s callback.

    Since:

    • 4.0.0



54
# File 'lib/lita/http_route.rb', line 54

define_http_method :unlink