class ApiMapper::Router
Public Class Methods
add_route(method, mapper, path)
click to toggle source
# File lib/api_mapper/router.rb, line 16 def add_route(method, mapper, path) routes << Route.new(method, mapper, path) end
get(path, mapper)
click to toggle source
# File lib/api_mapper/router.rb, line 4 def get(path, mapper) add_route(:get, path, mapper) end
patch(path, mapper)
click to toggle source
# File lib/api_mapper/router.rb, line 8 def patch(path, mapper) add_route(:patch, path, mapper) end
post(path, mapper)
click to toggle source
# File lib/api_mapper/router.rb, line 12 def post(path, mapper) add_route(:post, path, mapper) end
routes()
click to toggle source
# File lib/api_mapper/router.rb, line 20 def routes @routes ||= [] end
Public Instance Methods
resolve(method, path)
click to toggle source
# File lib/api_mapper/router.rb, line 25 def resolve(method, path) self.class.routes.find { |route| route.match(method, path) } end