Class: Apia::DSLs::RouteSet
- Inherits:
-
Object
- Object
- Apia::DSLs::RouteSet
- Defined in:
- lib/apia/dsls/route_set.rb
Instance Method Summary collapse
- #group(id, &block) ⇒ Object
-
#initialize(route_set) ⇒ RouteSet
constructor
A new instance of RouteSet.
- #route(path, request_method: nil, **options) ⇒ Object
- #schema(path: 'schema') ⇒ Object
Constructor Details
#initialize(route_set) ⇒ RouteSet
Returns a new instance of RouteSet.
11 12 13 |
# File 'lib/apia/dsls/route_set.rb', line 11 def initialize(route_set) @route_set = route_set end |
Instance Method Details
#group(id, &block) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/apia/dsls/route_set.rb', line 31 def group(id, &block) group = Apia::RouteGroup.new(id.to_s, nil) dsl = Apia::DSLs::RouteGroup.new(@route_set, group) dsl.instance_eval(&block) @route_set.groups << group end |
#route(path, request_method: nil, **options) ⇒ Object
20 21 22 23 |
# File 'lib/apia/dsls/route_set.rb', line 20 def route(path, request_method: nil, **) route = Route.new(path, request_method: request_method, **) @route_set.add(route) end |
#schema(path: 'schema') ⇒ Object
15 16 17 18 |
# File 'lib/apia/dsls/route_set.rb', line 15 def schema(path: 'schema') require 'apia/schema/controller' get path, controller: Schema::Controller, endpoint: :schema end |