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
+16-8Lines changed: 16 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -248,32 +248,40 @@ describe Twitter::API do
248
248
end
249
249
```
250
250
251
-
## Inspecting an API
251
+
## Describing and Inspecting an API
252
252
253
-
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`.
253
+
Grape lets you add a description to an API along with any other optional elements that can also be inspected at runtime.
Grape then 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`. The description and the optional hash that follows the API path may contain any number of keys and its values are also accessible via dynamically-generated `route_[name]` functions.
270
276
277
+
```ruby
271
278
TwitterAPI::versions # yields [ 'v1', 'v2' ]
272
279
TwitterAPI::routes # yields an array of Grape::Route objects
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.
284
+
Parameters can also be tagged to the method declaration itself.
0 commit comments