You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.markdown
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ you simply use the `rescue_from` method inside your API declaration:
85
85
86
86
## Inspecting an API
87
87
88
-
Grape exposes arrays of API versions and compiled routes. Each route contains a prefix, version, namespace, method and path.
88
+
Grape exposes arrays of API versions and compiled routes. Each route contains a `route_prefix`, `route_version`, `route_namespace`, `route_method`, `route_path`and `route_params`.
89
89
90
90
class TwitterAPI < Grape::API
91
91
@@ -107,16 +107,16 @@ Grape exposes arrays of API versions and compiled routes. Each route contains a
107
107
TwitterAPI::routes # yields an array of Grape::Route objects
108
108
TwitterAPI::routes[0].route_version # yields 'v1'
109
109
110
-
Grape also supports storing additional options with the route information. This can be useful for generating documentation.
111
-
The optional hash that follows the API path may contain any number of keys and values are accessible via `route_[name]`.
110
+
Grape also supports storing additional parameters with the route information. This can be useful for generating documentation. The optional hash that follows the API path may contain any number of keys and its values are also accessible via a dynamically-generated `route_[name]` function.
112
111
113
-
class StringAPI < Grape::API
114
-
get :split, { :params => [ :string, :token ] } do
115
-
params[:string].split(params[:token])
112
+
class StringAPI < Grape::API
113
+
get "split/:string", { :params => [ "token" ], :optional_params => [ "limit" ] } do
0 commit comments