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.



31
32
33
# File 'lib/lita/http_route.rb', line 31

def initialize(handler_class)
  @handler_class = handler_class
end

Instance Attribute Details

#handler_classLita::Handler (readonly)

The handler registering the route.

Returns:



28
29
30
# File 'lib/lita/http_route.rb', line 28

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

define_http_method :unlink