class Pepito::HTTPApi::HTTPRoute

The http route object.

Constants

ExtendedRoute

Class to extends the HttpRouter route

Attributes

route[R]

The route object. @return [ExtendedRoute]

Public Class Methods

new(robot, klass, method, path, func) click to toggle source

@param robot [Pepito::Robot] The currently running robot. @param klass [Pepito::Handler] The class to call the function from. @param method [String] The http method (Example: “GET”). @param path [String] The path for the route. @param func [Symbol] The function to call. @return [void]

# File lib/pepito/http_api/http_route.rb, line 25
def initialize(robot, klass, method, path, func)
  @route = setup_route(robot, klass, method, path, func)
end

Private Instance Methods

setup_route(robot, klass, method, path, func) click to toggle source

Setup the extendend route @param robot [Pepito::Robot] The currently running robot. @param klass [Pepito::Handler] The class to call the function from. @param method [String] The http method (Example: “GET”). @param path [String] The path for the route. @param func [Symbol] The function to call. @return [ExtendedRoute]

# File lib/pepito/http_api/http_route.rb, line 38
def setup_route(robot, klass, method, path, func)
  route = ExtendedRoute.new
  route.path = path
  route.add_request_method(method)
  route.add_request_method('HEAD') if method == 'GET'
  route.to(HTTPCallback.new(robot, klass, func))
  route
end