31
31
- [ Parameters] ( #parameters )
32
32
- [ Params Class] ( #params-class )
33
33
- [ Declared] ( #declared )
34
- - [ Include Missing] ( #include-missing )
34
+ - [ Include Parent Namespaces] ( #include-parent-namespaces )
35
+ - [ Include missing] ( #include-missing )
35
36
- [ Parameter Validation and Coercion] ( #parameter-validation-and-coercion )
36
37
- [ Supported Parameter Types] ( #supported-parameter-types )
37
38
- [ Integer/Fixnum and Coercions] ( #integerfixnum-and-coercions )
44
45
- [ Group Options] ( #group-options )
45
46
- [ Alias] ( #alias )
46
47
- [ Built-in Validators] ( #built-in-validators )
48
+ - [ ` allow_blank ` ] ( #allowblank )
49
+ - [ ` values ` ] ( #values )
50
+ - [ ` except_values ` ] ( #exceptvalues )
51
+ - [ ` regexp ` ] ( #regexp )
52
+ - [ ` mutually_exclusive ` ] ( #mutuallyexclusive )
53
+ - [ ` exactly_one_of ` ] ( #exactlyoneof )
54
+ - [ ` at_least_one_of ` ] ( #atleastoneof )
55
+ - [ ` all_or_none_of ` ] ( #allornoneof )
56
+ - [ Nested ` mutually_exclusive ` , ` exactly_one_of ` , ` at_least_one_of ` , ` all_or_none_of ` ] ( #nested-mutuallyexclusive-exactlyoneof-atleastoneof-allornoneof )
47
57
- [ Namespace Validation and Coercion] ( #namespace-validation-and-coercion )
48
58
- [ Custom Validators] ( #custom-validators )
49
59
- [ Validation Errors] ( #validation-errors )
50
60
- [ I18n] ( #i18n )
51
- - [ Custom Validation Messages] ( #custom-validation-messages )
52
- - [ Headers] ( #headers )
61
+ - [ Custom Validation messages] ( #custom-validation-messages )
62
+ - [ ` presence ` , ` allow_blank ` , ` values ` , ` regexp ` ] ( #presence-allowblank-values-regexp )
63
+ - [ ` mutually_exclusive ` ] ( #mutuallyexclusive-1 )
64
+ - [ ` Overriding attribute names ` ] ( #overriding-attribute-names )
65
+ - [ ` With Default ` ] ( #with-default )
53
66
- [ Routes] ( #routes )
54
67
- [ Helpers] ( #helpers )
55
68
- [ Path Helpers] ( #path-helpers )
63
76
- [ Default Error HTTP Status Code] ( #default-error-http-status-code )
64
77
- [ Handling 404] ( #handling-404 )
65
78
- [ Exception Handling] ( #exception-handling )
79
+ - [ Rescuing exceptions inside namespaces] ( #rescuing-exceptions-inside-namespaces )
80
+ - [ Unrescuable Exceptions] ( #unrescuable-exceptions )
66
81
- [ Rails 3.x] ( #rails-3x )
67
82
- [ Logging] ( #logging )
68
83
- [ API Formats] ( #api-formats )
78
93
- [ Active Model Serializers] ( #active-model-serializers )
79
94
- [ Sending Raw or No Data] ( #sending-raw-or-no-data )
80
95
- [ Authentication] ( #authentication )
96
+ - [ Basic and Digest Auth] ( #basic-and-digest-auth )
97
+ - [ Register custom middleware for authentication] ( #register-custom-middleware-for-authentication )
81
98
- [ Describing and Inspecting an API] ( #describing-and-inspecting-an-api )
82
99
- [ Current Route and Endpoint] ( #current-route-and-endpoint )
83
100
- [ Before and After] ( #before-and-after )
88
105
- [ Remote IP] ( #remote-ip )
89
106
- [ Writing Tests] ( #writing-tests )
90
107
- [ Writing Tests with Rack] ( #writing-tests-with-rack )
108
+ - [ RSpec] ( #rspec )
109
+ - [ Airborne] ( #airborne )
110
+ - [ MiniTest] ( #minitest )
91
111
- [ Writing Tests with Rails] ( #writing-tests-with-rails )
112
+ - [ RSpec] ( #rspec-1 )
113
+ - [ MiniTest] ( #minitest-1 )
92
114
- [ Stubbing Helpers] ( #stubbing-helpers )
93
115
- [ Reloading API Changes in Development] ( #reloading-api-changes-in-development )
94
116
- [ Reloading in Rack Applications] ( #reloading-in-rack-applications )
95
117
- [ Reloading in Rails Applications] ( #reloading-in-rails-applications )
96
118
- [ Performance Monitoring] ( #performance-monitoring )
97
119
- [ Active Support Instrumentation] ( #active-support-instrumentation )
120
+ - [ endpoint_run.grape] ( #endpointrungrape )
121
+ - [ endpoint_render.grape] ( #endpointrendergrape )
122
+ - [ endpoint_run_filters.grape] ( #endpointrunfiltersgrape )
123
+ - [ endpoint_run_validators.grape] ( #endpointrunvalidatorsgrape )
98
124
- [ Monitoring Products] ( #monitoring-products )
99
125
- [ Contributing to Grape] ( #contributing-to-grape )
100
126
- [ License] ( #license )
@@ -888,8 +914,6 @@ class Color
888
914
end
889
915
end
890
916
891
- # ...
892
-
893
917
params do
894
918
requires :color , type: Color , default: Color .new (' blue' )
895
919
end
@@ -957,8 +981,6 @@ get '/' do
957
981
params[:json ].inspect
958
982
end
959
983
960
- # ...
961
-
962
984
client.get(' /' , json: ' {"int":1}' ) # => "{:int=>1}"
963
985
client.get(' /' , json: ' [{"int":"1"}]' ) # => "[{:int=>1}]"
964
986
@@ -994,8 +1016,6 @@ get '/' do
994
1016
params[:status_code ].inspect
995
1017
end
996
1018
997
- # ...
998
-
999
1019
client.get(' /' , status_code: ' OK_GOOD' ) # => "OK_GOOD"
1000
1020
client.get(' /' , status_code: 300 ) # => 300
1001
1021
client.get(' /' , status_code: %w(404 NOT FOUND) ) # => [404, "NOT", "FOUND"]
@@ -1012,8 +1032,6 @@ get '/' do
1012
1032
params[:status_codes ].inspect
1013
1033
end
1014
1034
1015
- # ...
1016
-
1017
1035
client.get(' /' , status_codes: %w(1 two) ) # => [1, "two"]
1018
1036
```
1019
1037
@@ -2282,7 +2300,6 @@ class API < Grape::API
2282
2300
end
2283
2301
end
2284
2302
post ' /statuses' do
2285
- # ...
2286
2303
logger.info " #{ current_user } has statused"
2287
2304
end
2288
2305
end
@@ -2925,9 +2942,7 @@ If a request for a resource is made that triggers the built-in `OPTIONS` handler
2925
2942
only ` before ` and ` after ` callbacks will be executed. The remaining callbacks will
2926
2943
be bypassed.
2927
2944
2928
- #### Examples
2929
-
2930
- Using a simple ` before ` block to set a header
2945
+ For example, using a simple ` before ` block to set a header.
2931
2946
2932
2947
``` ruby
2933
2948
before do
@@ -2963,7 +2978,7 @@ class MyAPI < Grape::API
2963
2978
end
2964
2979
```
2965
2980
2966
- The behaviour is then:
2981
+ The behavior is then:
2967
2982
2968
2983
``` bash
2969
2984
GET / # 'root - '
@@ -2991,7 +3006,7 @@ class MyAPI < Grape::API
2991
3006
end
2992
3007
```
2993
3008
2994
- The behaviour is then:
3009
+ The behavior is then:
2995
3010
2996
3011
``` bash
2997
3012
GET /123 # 'Integer'
@@ -3026,7 +3041,7 @@ class Test < Grape::API
3026
3041
end
3027
3042
```
3028
3043
3029
- The behaviour is then:
3044
+ The behavior is then:
3030
3045
3031
3046
``` bash
3032
3047
GET /foo/v1 # 'v1-hello'
@@ -3051,7 +3066,7 @@ class MyAPI < Grape::API
3051
3066
end
3052
3067
```
3053
3068
3054
- The behaviour is then:
3069
+ The behavior is then:
3055
3070
3056
3071
``` bash
3057
3072
GET /greeting # {"greeting":"Hello!"}
@@ -3339,7 +3354,7 @@ describe 'an endpoint that needs helpers stubbed' do
3339
3354
end
3340
3355
3341
3356
it ' stubs the helper' do
3342
- # ...
3357
+
3343
3358
end
3344
3359
end
3345
3360
```
0 commit comments