apes 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +82 -0
- data/.travis-gemfile +15 -0
- data/.travis.yml +15 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +22 -0
- data/README.md +177 -0
- data/Rakefile +44 -0
- data/apes.gemspec +34 -0
- data/doc/Apes.html +130 -0
- data/doc/Apes/Concerns.html +127 -0
- data/doc/Apes/Concerns/Errors.html +1089 -0
- data/doc/Apes/Concerns/Pagination.html +636 -0
- data/doc/Apes/Concerns/Request.html +766 -0
- data/doc/Apes/Concerns/Response.html +940 -0
- data/doc/Apes/Controller.html +1100 -0
- data/doc/Apes/Errors.html +125 -0
- data/doc/Apes/Errors/AuthenticationError.html +133 -0
- data/doc/Apes/Errors/BadRequestError.html +157 -0
- data/doc/Apes/Errors/BaseError.html +320 -0
- data/doc/Apes/Errors/InvalidDataError.html +157 -0
- data/doc/Apes/Errors/MissingDataError.html +157 -0
- data/doc/Apes/Model.html +378 -0
- data/doc/Apes/PaginationCursor.html +2138 -0
- data/doc/Apes/RuntimeConfiguration.html +909 -0
- data/doc/Apes/Serializers.html +125 -0
- data/doc/Apes/Serializers/JSON.html +389 -0
- data/doc/Apes/Serializers/JWT.html +452 -0
- data/doc/Apes/Serializers/List.html +347 -0
- data/doc/Apes/UrlsParser.html +1432 -0
- data/doc/Apes/Validators.html +125 -0
- data/doc/Apes/Validators/BaseValidator.html +278 -0
- data/doc/Apes/Validators/BooleanValidator.html +494 -0
- data/doc/Apes/Validators/EmailValidator.html +350 -0
- data/doc/Apes/Validators/PhoneValidator.html +375 -0
- data/doc/Apes/Validators/ReferenceValidator.html +372 -0
- data/doc/Apes/Validators/TimestampValidator.html +640 -0
- data/doc/Apes/Validators/UuidValidator.html +372 -0
- data/doc/Apes/Validators/ZipCodeValidator.html +372 -0
- data/doc/Apes/Version.html +189 -0
- data/doc/ApplicationController.html +547 -0
- data/doc/Concerns.html +128 -0
- data/doc/Concerns/ErrorHandling.html +826 -0
- data/doc/Concerns/PaginationHandling.html +463 -0
- data/doc/Concerns/RequestHandling.html +512 -0
- data/doc/Concerns/ResponseHandling.html +579 -0
- data/doc/Errors.html +126 -0
- data/doc/Errors/AuthenticationError.html +123 -0
- data/doc/Errors/BadRequestError.html +147 -0
- data/doc/Errors/BaseError.html +289 -0
- data/doc/Errors/InvalidDataError.html +147 -0
- data/doc/Errors/MissingDataError.html +147 -0
- data/doc/Model.html +315 -0
- data/doc/PaginationCursor.html +764 -0
- data/doc/Serializers.html +126 -0
- data/doc/Serializers/JSON.html +253 -0
- data/doc/Serializers/JWT.html +253 -0
- data/doc/Serializers/List.html +245 -0
- data/doc/Validators.html +126 -0
- data/doc/Validators/BaseValidator.html +209 -0
- data/doc/Validators/BooleanValidator.html +391 -0
- data/doc/Validators/EmailValidator.html +298 -0
- data/doc/Validators/PhoneValidator.html +313 -0
- data/doc/Validators/ReferenceValidator.html +284 -0
- data/doc/Validators/TimestampValidator.html +476 -0
- data/doc/Validators/UuidValidator.html +310 -0
- data/doc/Validators/ZipCodeValidator.html +310 -0
- data/doc/_index.html +435 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +252 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +252 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +615 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/apes.rb +40 -0
- data/lib/apes/concerns/errors.rb +111 -0
- data/lib/apes/concerns/pagination.rb +81 -0
- data/lib/apes/concerns/request.rb +237 -0
- data/lib/apes/concerns/response.rb +74 -0
- data/lib/apes/controller.rb +77 -0
- data/lib/apes/errors.rb +38 -0
- data/lib/apes/model.rb +94 -0
- data/lib/apes/pagination_cursor.rb +152 -0
- data/lib/apes/runtime_configuration.rb +80 -0
- data/lib/apes/serializers.rb +88 -0
- data/lib/apes/urls_parser.rb +233 -0
- data/lib/apes/validators.rb +234 -0
- data/lib/apes/version.rb +24 -0
- data/spec/apes/concerns/errors_spec.rb +141 -0
- data/spec/apes/concerns/pagination_spec.rb +114 -0
- data/spec/apes/concerns/request_spec.rb +244 -0
- data/spec/apes/concerns/response_spec.rb +79 -0
- data/spec/apes/controller_spec.rb +54 -0
- data/spec/apes/errors_spec.rb +14 -0
- data/spec/apes/models_spec.rb +148 -0
- data/spec/apes/pagination_cursor_spec.rb +113 -0
- data/spec/apes/runtime_configuration_spec.rb +100 -0
- data/spec/apes/serializers_spec.rb +70 -0
- data/spec/apes/urls_parser_spec.rb +150 -0
- data/spec/apes/validators_spec.rb +237 -0
- data/spec/spec_helper.rb +30 -0
- data/views/_included.json.jbuilder +9 -0
- data/views/_pagination.json.jbuilder +9 -0
- data/views/collection.json.jbuilder +4 -0
- data/views/errors/400.json.jbuilder +9 -0
- data/views/errors/403.json.jbuilder +7 -0
- data/views/errors/404.json.jbuilder +6 -0
- data/views/errors/422.json.jbuilder +19 -0
- data/views/errors/500.json.jbuilder +12 -0
- data/views/errors/501.json.jbuilder +7 -0
- data/views/layouts/general.json.jbuilder +36 -0
- data/views/object.json.jbuilder +4 -0
- metadata +262 -0
@@ -0,0 +1,127 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Apes::Concerns
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Apes/Concerns.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Apes.html" title="Apes (module)">Apes</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Concerns</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Apes::Concerns
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/apes/concerns/errors.rb<span class="defines">,<br />
|
83
|
+
lib/apes/concerns/request.rb,<br /> lib/apes/concerns/response.rb,<br /> lib/apes/concerns/pagination.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Overview</h2><div class="docstring">
|
90
|
+
<div class="discussion">
|
91
|
+
<p>A set of module to handle JSON API in a Rails controller.</p>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div class="tags">
|
97
|
+
|
98
|
+
|
99
|
+
</div><h2>Defined Under Namespace</h2>
|
100
|
+
<p class="children">
|
101
|
+
|
102
|
+
|
103
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Concerns/Errors.html" title="Apes::Concerns::Errors (module)">Errors</a></span>, <span class='object_link'><a href="Concerns/Pagination.html" title="Apes::Concerns::Pagination (module)">Pagination</a></span>, <span class='object_link'><a href="Concerns/Request.html" title="Apes::Concerns::Request (module)">Request</a></span>, <span class='object_link'><a href="Concerns/Response.html" title="Apes::Concerns::Response (module)">Response</a></span>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</p>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div id="footer">
|
121
|
+
Generated on Sat Jun 4 12:41:53 2016 by
|
122
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
123
|
+
0.8.7.6 (ruby-2.3.0).
|
124
|
+
</div>
|
125
|
+
|
126
|
+
</body>
|
127
|
+
</html>
|
@@ -0,0 +1,1089 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Apes::Concerns::Errors
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!Apes/Concerns/Errors.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (E)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Apes.html" title="Apes (module)">Apes</a></span></span> » <span class='title'><span class='object_link'><a href="../Concerns.html" title="Apes::Concerns (module)">Concerns</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Errors</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Apes::Concerns::Errors
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
<dt class="r1">Included in:</dt>
|
81
|
+
<dd class="r1"><span class='object_link'><a href="../Controller.html" title="Apes::Controller (class)">Apes::Controller</a></span></dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
86
|
+
<dd class="r2 last">lib/apes/concerns/errors.rb</dd>
|
87
|
+
|
88
|
+
</dl>
|
89
|
+
<div class="clear"></div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>Errors handling module.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
<h2>Constant Summary</h2>
|
103
|
+
|
104
|
+
<dl class="constants">
|
105
|
+
|
106
|
+
<dt id="ERROR_HANDLERS-constant" class="">ERROR_HANDLERS =
|
107
|
+
<div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
<p>Default map of error handlers</p>
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div class="tags">
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
</dt>
|
119
|
+
<dd><pre class="code"><span class='lbrace'>{</span>
|
120
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ActiveRecord::RecordNotFound</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_not_found</span><span class='comma'>,</span>
|
121
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apes::Errors::AuthenticationError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_fordidden</span><span class='comma'>,</span>
|
122
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apes::Errors::InvalidModelError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_invalid_source</span><span class='comma'>,</span>
|
123
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apes::Errors::BadRequestError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_bad_request</span><span class='comma'>,</span>
|
124
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apes::Errors::MissingDataError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_missing_data</span><span class='comma'>,</span>
|
125
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apes::Errors::InvalidDataError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_invalid_data</span><span class='comma'>,</span>
|
126
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>JSON::ParserError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_invalid_data</span><span class='comma'>,</span>
|
127
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ActiveRecord::RecordInvalid</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_validation</span><span class='comma'>,</span>
|
128
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ActiveRecord::UnknownAttributeError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_unknown_attribute</span><span class='comma'>,</span>
|
129
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ActionController::UnpermittedParameters</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_unknown_attribute</span><span class='comma'>,</span>
|
130
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apes::Errors::BaseError</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_general</span><span class='comma'>,</span>
|
131
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Lazier::Exceptions::Debug</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='symbol'>:error_handle_debug</span>
|
132
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
133
|
+
|
134
|
+
</dl>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<h2>
|
145
|
+
Instance Method Summary
|
146
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
147
|
+
</h2>
|
148
|
+
|
149
|
+
<ul class="summary">
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#error_handle_bad_request-instance_method" title="#error_handle_bad_request (instance method)">- (Object) <strong>error_handle_bad_request</strong>(_ = nil) </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<span class="summary_desc"><div class='inline'><p>Handles requests containing invalid data.</p>
|
169
|
+
</div></span>
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
|
174
|
+
<li class="public ">
|
175
|
+
<span class="summary_signature">
|
176
|
+
|
177
|
+
<a href="#error_handle_debug-instance_method" title="#error_handle_debug (instance method)">- (Object) <strong>error_handle_debug</strong>(exception) </a>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</span>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<span class="summary_desc"><div class='inline'><p>Handles debug exceptions.</p>
|
192
|
+
</div></span>
|
193
|
+
|
194
|
+
</li>
|
195
|
+
|
196
|
+
|
197
|
+
<li class="public ">
|
198
|
+
<span class="summary_signature">
|
199
|
+
|
200
|
+
<a href="#error_handle_exception-instance_method" title="#error_handle_exception (instance method)">- (Object) <strong>error_handle_exception</strong>(exception) </a>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</span>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<span class="summary_desc"><div class='inline'><p>Default unexpected exception handler.</p>
|
215
|
+
</div></span>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
|
220
|
+
<li class="public ">
|
221
|
+
<span class="summary_signature">
|
222
|
+
|
223
|
+
<a href="#error_handle_fordidden-instance_method" title="#error_handle_fordidden (instance method)">- (Object) <strong>error_handle_fordidden</strong>(exception) </a>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
</span>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
<span class="summary_desc"><div class='inline'><p>Handles unauthorized requests.</p>
|
238
|
+
</div></span>
|
239
|
+
|
240
|
+
</li>
|
241
|
+
|
242
|
+
|
243
|
+
<li class="public ">
|
244
|
+
<span class="summary_signature">
|
245
|
+
|
246
|
+
<a href="#error_handle_general-instance_method" title="#error_handle_general (instance method)">- (Object) <strong>error_handle_general</strong>(exception) </a>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
</span>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
<span class="summary_desc"><div class='inline'><p>Handles base exceptions.</p>
|
261
|
+
</div></span>
|
262
|
+
|
263
|
+
</li>
|
264
|
+
|
265
|
+
|
266
|
+
<li class="public ">
|
267
|
+
<span class="summary_signature">
|
268
|
+
|
269
|
+
<a href="#error_handle_invalid_data-instance_method" title="#error_handle_invalid_data (instance method)">- (Object) <strong>error_handle_invalid_data</strong>(_ = nil) </a>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
</span>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<span class="summary_desc"><div class='inline'><p>Handles requests that send invalid data.</p>
|
284
|
+
</div></span>
|
285
|
+
|
286
|
+
</li>
|
287
|
+
|
288
|
+
|
289
|
+
<li class="public ">
|
290
|
+
<span class="summary_signature">
|
291
|
+
|
292
|
+
<a href="#error_handle_missing_data-instance_method" title="#error_handle_missing_data (instance method)">- (Object) <strong>error_handle_missing_data</strong>(_ = nil) </a>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
</span>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
<span class="summary_desc"><div class='inline'><p>Handles requests that miss data.</p>
|
307
|
+
</div></span>
|
308
|
+
|
309
|
+
</li>
|
310
|
+
|
311
|
+
|
312
|
+
<li class="public ">
|
313
|
+
<span class="summary_signature">
|
314
|
+
|
315
|
+
<a href="#error_handle_not_found-instance_method" title="#error_handle_not_found (instance method)">- (Object) <strong>error_handle_not_found</strong>(_ = nil) </a>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
<span class="summary_desc"><div class='inline'><p>Handles requests of missing data.</p>
|
330
|
+
</div></span>
|
331
|
+
|
332
|
+
</li>
|
333
|
+
|
334
|
+
|
335
|
+
<li class="public ">
|
336
|
+
<span class="summary_signature">
|
337
|
+
|
338
|
+
<a href="#error_handle_others-instance_method" title="#error_handle_others (instance method)">- (Object) <strong>error_handle_others</strong>(exception) </a>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<span class="summary_desc"><div class='inline'><p>Handles other exceptions.</p>
|
353
|
+
</div></span>
|
354
|
+
|
355
|
+
</li>
|
356
|
+
|
357
|
+
|
358
|
+
<li class="public ">
|
359
|
+
<span class="summary_signature">
|
360
|
+
|
361
|
+
<a href="#error_handle_unknown_attribute-instance_method" title="#error_handle_unknown_attribute (instance method)">- (Object) <strong>error_handle_unknown_attribute</strong>(exception) </a>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
</span>
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
<span class="summary_desc"><div class='inline'><p>Handles requests that send data with unexpected attributes.</p>
|
376
|
+
</div></span>
|
377
|
+
|
378
|
+
</li>
|
379
|
+
|
380
|
+
|
381
|
+
<li class="public ">
|
382
|
+
<span class="summary_signature">
|
383
|
+
|
384
|
+
<a href="#error_handle_validation-instance_method" title="#error_handle_validation (instance method)">- (Object) <strong>error_handle_validation</strong>(exception) </a>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
</span>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
<span class="summary_desc"><div class='inline'><p>Handles requests that send data with invalid attributes.</p>
|
399
|
+
</div></span>
|
400
|
+
|
401
|
+
</li>
|
402
|
+
|
403
|
+
|
404
|
+
<li class="public ">
|
405
|
+
<span class="summary_signature">
|
406
|
+
|
407
|
+
<a href="#fail_request%21-instance_method" title="#fail_request! (instance method)">- (Object) <strong>fail_request!</strong>(status, error) </a>
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
</span>
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
<span class="summary_desc"><div class='inline'><p>Handles a failed request.</p>
|
422
|
+
</div></span>
|
423
|
+
|
424
|
+
</li>
|
425
|
+
|
426
|
+
|
427
|
+
</ul>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
<div id="instance_method_details" class="method_details_list">
|
433
|
+
<h2>Instance Method Details</h2>
|
434
|
+
|
435
|
+
|
436
|
+
<div class="method_details first">
|
437
|
+
<h3 class="signature first" id="error_handle_bad_request-instance_method">
|
438
|
+
|
439
|
+
- (<tt>Object</tt>) <strong>error_handle_bad_request</strong>(_ = nil)
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
</h3><div class="docstring">
|
446
|
+
<div class="discussion">
|
447
|
+
<p>Handles requests containing invalid data.</p>
|
448
|
+
|
449
|
+
|
450
|
+
</div>
|
451
|
+
</div>
|
452
|
+
<div class="tags">
|
453
|
+
|
454
|
+
|
455
|
+
</div><table class="source_code">
|
456
|
+
<tr>
|
457
|
+
<td>
|
458
|
+
<pre class="lines">
|
459
|
+
|
460
|
+
|
461
|
+
81
|
462
|
+
82
|
463
|
+
83
|
464
|
+
84</pre>
|
465
|
+
</td>
|
466
|
+
<td>
|
467
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 81</span>
|
468
|
+
|
469
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_bad_request'>error_handle_bad_request</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
470
|
+
<span class='ivar'>@reason</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid Content-Type specified. Please use \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_request_valid_content_type'>request_valid_content_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" when performing write operations.</span><span class='tstring_end'>"</span></span>
|
471
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/400</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:bad_request</span><span class='rparen'>)</span>
|
472
|
+
<span class='kw'>end</span></pre>
|
473
|
+
</td>
|
474
|
+
</tr>
|
475
|
+
</table>
|
476
|
+
</div>
|
477
|
+
|
478
|
+
<div class="method_details ">
|
479
|
+
<h3 class="signature " id="error_handle_debug-instance_method">
|
480
|
+
|
481
|
+
- (<tt>Object</tt>) <strong>error_handle_debug</strong>(exception)
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
</h3><div class="docstring">
|
488
|
+
<div class="discussion">
|
489
|
+
<p>Handles debug exceptions.</p>
|
490
|
+
|
491
|
+
|
492
|
+
</div>
|
493
|
+
</div>
|
494
|
+
<div class="tags">
|
495
|
+
<p class="tag_title">Parameters:</p>
|
496
|
+
<ul class="param">
|
497
|
+
|
498
|
+
<li>
|
499
|
+
|
500
|
+
<span class='name'>exception</span>
|
501
|
+
|
502
|
+
|
503
|
+
<span class='type'>(<tt>Exception</tt>)</span>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
—
|
508
|
+
<div class='inline'><p>The exception to handle.</p>
|
509
|
+
</div>
|
510
|
+
|
511
|
+
</li>
|
512
|
+
|
513
|
+
</ul>
|
514
|
+
|
515
|
+
|
516
|
+
</div><table class="source_code">
|
517
|
+
<tr>
|
518
|
+
<td>
|
519
|
+
<pre class="lines">
|
520
|
+
|
521
|
+
|
522
|
+
63
|
523
|
+
64
|
524
|
+
65</pre>
|
525
|
+
</td>
|
526
|
+
<td>
|
527
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 63</span>
|
528
|
+
|
529
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_debug'>error_handle_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
530
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/400</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='int'>418</span><span class='comma'>,</span> <span class='label'>locals:</span> <span class='lbrace'>{</span><span class='label'>debug:</span> <span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
531
|
+
<span class='kw'>end</span></pre>
|
532
|
+
</td>
|
533
|
+
</tr>
|
534
|
+
</table>
|
535
|
+
</div>
|
536
|
+
|
537
|
+
<div class="method_details ">
|
538
|
+
<h3 class="signature " id="error_handle_exception-instance_method">
|
539
|
+
|
540
|
+
- (<tt>Object</tt>) <strong>error_handle_exception</strong>(exception)
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
</h3><div class="docstring">
|
547
|
+
<div class="discussion">
|
548
|
+
<p>Default unexpected exception handler.</p>
|
549
|
+
|
550
|
+
|
551
|
+
</div>
|
552
|
+
</div>
|
553
|
+
<div class="tags">
|
554
|
+
<p class="tag_title">Parameters:</p>
|
555
|
+
<ul class="param">
|
556
|
+
|
557
|
+
<li>
|
558
|
+
|
559
|
+
<span class='name'>exception</span>
|
560
|
+
|
561
|
+
|
562
|
+
<span class='type'>(<tt>Exception</tt>)</span>
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
—
|
567
|
+
<div class='inline'><p>The exception to handle.</p>
|
568
|
+
</div>
|
569
|
+
|
570
|
+
</li>
|
571
|
+
|
572
|
+
</ul>
|
573
|
+
|
574
|
+
|
575
|
+
</div><table class="source_code">
|
576
|
+
<tr>
|
577
|
+
<td>
|
578
|
+
<pre class="lines">
|
579
|
+
|
580
|
+
|
581
|
+
38
|
582
|
+
39
|
583
|
+
40
|
584
|
+
41</pre>
|
585
|
+
</td>
|
586
|
+
<td>
|
587
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 38</span>
|
588
|
+
|
589
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_exception'>error_handle_exception</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
590
|
+
<span class='id identifier rubyid_handler'>handler</span> <span class='op'>=</span> <span class='const'>ERROR_HANDLERS</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='symbol'>:error_handle_others</span><span class='rparen'>)</span>
|
591
|
+
<span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_handler'>handler</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
592
|
+
<span class='kw'>end</span></pre>
|
593
|
+
</td>
|
594
|
+
</tr>
|
595
|
+
</table>
|
596
|
+
</div>
|
597
|
+
|
598
|
+
<div class="method_details ">
|
599
|
+
<h3 class="signature " id="error_handle_fordidden-instance_method">
|
600
|
+
|
601
|
+
- (<tt>Object</tt>) <strong>error_handle_fordidden</strong>(exception)
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
</h3><div class="docstring">
|
608
|
+
<div class="discussion">
|
609
|
+
<p>Handles unauthorized requests.</p>
|
610
|
+
|
611
|
+
|
612
|
+
</div>
|
613
|
+
</div>
|
614
|
+
<div class="tags">
|
615
|
+
<p class="tag_title">Parameters:</p>
|
616
|
+
<ul class="param">
|
617
|
+
|
618
|
+
<li>
|
619
|
+
|
620
|
+
<span class='name'>exception</span>
|
621
|
+
|
622
|
+
|
623
|
+
<span class='type'>(<tt>Exception</tt>)</span>
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
—
|
628
|
+
<div class='inline'><p>The exception to handle.</p>
|
629
|
+
</div>
|
630
|
+
|
631
|
+
</li>
|
632
|
+
|
633
|
+
</ul>
|
634
|
+
|
635
|
+
|
636
|
+
</div><table class="source_code">
|
637
|
+
<tr>
|
638
|
+
<td>
|
639
|
+
<pre class="lines">
|
640
|
+
|
641
|
+
|
642
|
+
70
|
643
|
+
71
|
644
|
+
72
|
645
|
+
73</pre>
|
646
|
+
</td>
|
647
|
+
<td>
|
648
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 70</span>
|
649
|
+
|
650
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_fordidden'>error_handle_fordidden</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
651
|
+
<span class='ivar'>@authentication_error</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>error:</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>?</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You don't have access to this resource.</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span>
|
652
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/403</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:forbidden</span><span class='rparen'>)</span>
|
653
|
+
<span class='kw'>end</span></pre>
|
654
|
+
</td>
|
655
|
+
</tr>
|
656
|
+
</table>
|
657
|
+
</div>
|
658
|
+
|
659
|
+
<div class="method_details ">
|
660
|
+
<h3 class="signature " id="error_handle_general-instance_method">
|
661
|
+
|
662
|
+
- (<tt>Object</tt>) <strong>error_handle_general</strong>(exception)
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
|
668
|
+
</h3><div class="docstring">
|
669
|
+
<div class="discussion">
|
670
|
+
<p>Handles base exceptions.</p>
|
671
|
+
|
672
|
+
|
673
|
+
</div>
|
674
|
+
</div>
|
675
|
+
<div class="tags">
|
676
|
+
<p class="tag_title">Parameters:</p>
|
677
|
+
<ul class="param">
|
678
|
+
|
679
|
+
<li>
|
680
|
+
|
681
|
+
<span class='name'>exception</span>
|
682
|
+
|
683
|
+
|
684
|
+
<span class='type'>(<tt>Exception</tt>)</span>
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
—
|
689
|
+
<div class='inline'><p>The exception to handle.</p>
|
690
|
+
</div>
|
691
|
+
|
692
|
+
</li>
|
693
|
+
|
694
|
+
</ul>
|
695
|
+
|
696
|
+
|
697
|
+
</div><table class="source_code">
|
698
|
+
<tr>
|
699
|
+
<td>
|
700
|
+
<pre class="lines">
|
701
|
+
|
702
|
+
|
703
|
+
46
|
704
|
+
47
|
705
|
+
48</pre>
|
706
|
+
</td>
|
707
|
+
<td>
|
708
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 46</span>
|
709
|
+
|
710
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_general'>error_handle_general</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
711
|
+
<span class='id identifier rubyid_render_error'>render_error</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_details'>details</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_details'>details</span><span class='lbracket'>[</span><span class='symbol'>:error</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
712
|
+
<span class='kw'>end</span></pre>
|
713
|
+
</td>
|
714
|
+
</tr>
|
715
|
+
</table>
|
716
|
+
</div>
|
717
|
+
|
718
|
+
<div class="method_details ">
|
719
|
+
<h3 class="signature " id="error_handle_invalid_data-instance_method">
|
720
|
+
|
721
|
+
- (<tt>Object</tt>) <strong>error_handle_invalid_data</strong>(_ = nil)
|
722
|
+
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
|
727
|
+
</h3><div class="docstring">
|
728
|
+
<div class="discussion">
|
729
|
+
<p>Handles requests that send invalid data.</p>
|
730
|
+
|
731
|
+
|
732
|
+
</div>
|
733
|
+
</div>
|
734
|
+
<div class="tags">
|
735
|
+
|
736
|
+
|
737
|
+
</div><table class="source_code">
|
738
|
+
<tr>
|
739
|
+
<td>
|
740
|
+
<pre class="lines">
|
741
|
+
|
742
|
+
|
743
|
+
93
|
744
|
+
94
|
745
|
+
95
|
746
|
+
96</pre>
|
747
|
+
</td>
|
748
|
+
<td>
|
749
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 93</span>
|
750
|
+
|
751
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_invalid_data'>error_handle_invalid_data</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
752
|
+
<span class='ivar'>@reason</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid data provided.</span><span class='tstring_end'>"</span></span>
|
753
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/400</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:bad_request</span><span class='rparen'>)</span>
|
754
|
+
<span class='kw'>end</span></pre>
|
755
|
+
</td>
|
756
|
+
</tr>
|
757
|
+
</table>
|
758
|
+
</div>
|
759
|
+
|
760
|
+
<div class="method_details ">
|
761
|
+
<h3 class="signature " id="error_handle_missing_data-instance_method">
|
762
|
+
|
763
|
+
- (<tt>Object</tt>) <strong>error_handle_missing_data</strong>(_ = nil)
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
</h3><div class="docstring">
|
770
|
+
<div class="discussion">
|
771
|
+
<p>Handles requests that miss data.</p>
|
772
|
+
|
773
|
+
|
774
|
+
</div>
|
775
|
+
</div>
|
776
|
+
<div class="tags">
|
777
|
+
|
778
|
+
|
779
|
+
</div><table class="source_code">
|
780
|
+
<tr>
|
781
|
+
<td>
|
782
|
+
<pre class="lines">
|
783
|
+
|
784
|
+
|
785
|
+
87
|
786
|
+
88
|
787
|
+
89
|
788
|
+
90</pre>
|
789
|
+
</td>
|
790
|
+
<td>
|
791
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 87</span>
|
792
|
+
|
793
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_missing_data'>error_handle_missing_data</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
794
|
+
<span class='ivar'>@reason</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Missing data.</span><span class='tstring_end'>"</span></span>
|
795
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/400</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:bad_request</span><span class='rparen'>)</span>
|
796
|
+
<span class='kw'>end</span></pre>
|
797
|
+
</td>
|
798
|
+
</tr>
|
799
|
+
</table>
|
800
|
+
</div>
|
801
|
+
|
802
|
+
<div class="method_details ">
|
803
|
+
<h3 class="signature " id="error_handle_not_found-instance_method">
|
804
|
+
|
805
|
+
- (<tt>Object</tt>) <strong>error_handle_not_found</strong>(_ = nil)
|
806
|
+
|
807
|
+
|
808
|
+
|
809
|
+
|
810
|
+
|
811
|
+
</h3><div class="docstring">
|
812
|
+
<div class="discussion">
|
813
|
+
<p>Handles requests of missing data.</p>
|
814
|
+
|
815
|
+
|
816
|
+
</div>
|
817
|
+
</div>
|
818
|
+
<div class="tags">
|
819
|
+
|
820
|
+
|
821
|
+
</div><table class="source_code">
|
822
|
+
<tr>
|
823
|
+
<td>
|
824
|
+
<pre class="lines">
|
825
|
+
|
826
|
+
|
827
|
+
76
|
828
|
+
77
|
829
|
+
78</pre>
|
830
|
+
</td>
|
831
|
+
<td>
|
832
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 76</span>
|
833
|
+
|
834
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_not_found'>error_handle_not_found</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
835
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/404</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:not_found</span><span class='rparen'>)</span>
|
836
|
+
<span class='kw'>end</span></pre>
|
837
|
+
</td>
|
838
|
+
</tr>
|
839
|
+
</table>
|
840
|
+
</div>
|
841
|
+
|
842
|
+
<div class="method_details ">
|
843
|
+
<h3 class="signature " id="error_handle_others-instance_method">
|
844
|
+
|
845
|
+
- (<tt>Object</tt>) <strong>error_handle_others</strong>(exception)
|
846
|
+
|
847
|
+
|
848
|
+
|
849
|
+
|
850
|
+
|
851
|
+
</h3><div class="docstring">
|
852
|
+
<div class="discussion">
|
853
|
+
<p>Handles other exceptions.</p>
|
854
|
+
|
855
|
+
|
856
|
+
</div>
|
857
|
+
</div>
|
858
|
+
<div class="tags">
|
859
|
+
<p class="tag_title">Parameters:</p>
|
860
|
+
<ul class="param">
|
861
|
+
|
862
|
+
<li>
|
863
|
+
|
864
|
+
<span class='name'>exception</span>
|
865
|
+
|
866
|
+
|
867
|
+
<span class='type'>(<tt>Exception</tt>)</span>
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
—
|
872
|
+
<div class='inline'><p>The exception to handle.</p>
|
873
|
+
</div>
|
874
|
+
|
875
|
+
</li>
|
876
|
+
|
877
|
+
</ul>
|
878
|
+
|
879
|
+
|
880
|
+
</div><table class="source_code">
|
881
|
+
<tr>
|
882
|
+
<td>
|
883
|
+
<pre class="lines">
|
884
|
+
|
885
|
+
|
886
|
+
53
|
887
|
+
54
|
888
|
+
55
|
889
|
+
56
|
890
|
+
57
|
891
|
+
58</pre>
|
892
|
+
</td>
|
893
|
+
<td>
|
894
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 53</span>
|
895
|
+
|
896
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_others'>error_handle_others</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
897
|
+
<span class='ivar'>@exception</span> <span class='op'>=</span> <span class='id identifier rubyid_exception'>exception</span>
|
898
|
+
<span class='ivar'>@backtrace</span> <span class='op'>=</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span>
|
899
|
+
<span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>50</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span> <span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='const'>Apes</span><span class='op'>::</span><span class='const'>RuntimeConfiguration</span><span class='period'>.</span><span class='id identifier rubyid_rails_root'>rails_root</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>$RAILS</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='const'>Apes</span><span class='op'>::</span><span class='const'>RuntimeConfiguration</span><span class='period'>.</span><span class='id identifier rubyid_gems_root'>gems_root</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>$GEMS</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
900
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/500</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:internal_server_error</span><span class='rparen'>)</span>
|
901
|
+
<span class='kw'>end</span></pre>
|
902
|
+
</td>
|
903
|
+
</tr>
|
904
|
+
</table>
|
905
|
+
</div>
|
906
|
+
|
907
|
+
<div class="method_details ">
|
908
|
+
<h3 class="signature " id="error_handle_unknown_attribute-instance_method">
|
909
|
+
|
910
|
+
- (<tt>Object</tt>) <strong>error_handle_unknown_attribute</strong>(exception)
|
911
|
+
|
912
|
+
|
913
|
+
|
914
|
+
|
915
|
+
|
916
|
+
</h3><div class="docstring">
|
917
|
+
<div class="discussion">
|
918
|
+
<p>Handles requests that send data with unexpected attributes.</p>
|
919
|
+
|
920
|
+
|
921
|
+
</div>
|
922
|
+
</div>
|
923
|
+
<div class="tags">
|
924
|
+
|
925
|
+
|
926
|
+
</div><table class="source_code">
|
927
|
+
<tr>
|
928
|
+
<td>
|
929
|
+
<pre class="lines">
|
930
|
+
|
931
|
+
|
932
|
+
99
|
933
|
+
100
|
934
|
+
101
|
935
|
+
102</pre>
|
936
|
+
</td>
|
937
|
+
<td>
|
938
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 99</span>
|
939
|
+
|
940
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_unknown_attribute'>error_handle_unknown_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
941
|
+
<span class='ivar'>@errors</span> <span class='op'>=</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>ActionController</span><span class='op'>::</span><span class='const'>UnpermittedParameters</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span> <span class='op'>:</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_attribute'>attribute</span>
|
942
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/422</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:unprocessable_entity</span><span class='rparen'>)</span>
|
943
|
+
<span class='kw'>end</span></pre>
|
944
|
+
</td>
|
945
|
+
</tr>
|
946
|
+
</table>
|
947
|
+
</div>
|
948
|
+
|
949
|
+
<div class="method_details ">
|
950
|
+
<h3 class="signature " id="error_handle_validation-instance_method">
|
951
|
+
|
952
|
+
- (<tt>Object</tt>) <strong>error_handle_validation</strong>(exception)
|
953
|
+
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
</h3><div class="docstring">
|
959
|
+
<div class="discussion">
|
960
|
+
<p>Handles requests that send data with invalid attributes.</p>
|
961
|
+
|
962
|
+
|
963
|
+
</div>
|
964
|
+
</div>
|
965
|
+
<div class="tags">
|
966
|
+
|
967
|
+
|
968
|
+
</div><table class="source_code">
|
969
|
+
<tr>
|
970
|
+
<td>
|
971
|
+
<pre class="lines">
|
972
|
+
|
973
|
+
|
974
|
+
105
|
975
|
+
106
|
976
|
+
107
|
977
|
+
108</pre>
|
978
|
+
</td>
|
979
|
+
<td>
|
980
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 105</span>
|
981
|
+
|
982
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_error_handle_validation'>error_handle_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='rparen'>)</span>
|
983
|
+
<span class='ivar'>@errors</span> <span class='op'>=</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span>
|
984
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>errors/422</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>status:</span> <span class='symbol'>:unprocessable_entity</span><span class='rparen'>)</span>
|
985
|
+
<span class='kw'>end</span></pre>
|
986
|
+
</td>
|
987
|
+
</tr>
|
988
|
+
</table>
|
989
|
+
</div>
|
990
|
+
|
991
|
+
<div class="method_details ">
|
992
|
+
<h3 class="signature " id="fail_request!-instance_method">
|
993
|
+
|
994
|
+
- (<tt>Object</tt>) <strong>fail_request!</strong>(status, error)
|
995
|
+
|
996
|
+
|
997
|
+
|
998
|
+
|
999
|
+
|
1000
|
+
</h3><div class="docstring">
|
1001
|
+
<div class="discussion">
|
1002
|
+
<p>Handles a failed request.</p>
|
1003
|
+
|
1004
|
+
|
1005
|
+
</div>
|
1006
|
+
</div>
|
1007
|
+
<div class="tags">
|
1008
|
+
<p class="tag_title">Parameters:</p>
|
1009
|
+
<ul class="param">
|
1010
|
+
|
1011
|
+
<li>
|
1012
|
+
|
1013
|
+
<span class='name'>status</span>
|
1014
|
+
|
1015
|
+
|
1016
|
+
<span class='type'>(<tt>Symbol|Fixnum</tt>)</span>
|
1017
|
+
|
1018
|
+
|
1019
|
+
|
1020
|
+
—
|
1021
|
+
<div class='inline'><p>The HTTP error code.</p>
|
1022
|
+
</div>
|
1023
|
+
|
1024
|
+
</li>
|
1025
|
+
|
1026
|
+
<li>
|
1027
|
+
|
1028
|
+
<span class='name'>error</span>
|
1029
|
+
|
1030
|
+
|
1031
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1032
|
+
|
1033
|
+
|
1034
|
+
|
1035
|
+
—
|
1036
|
+
<div class='inline'><p>The occurred error.</p>
|
1037
|
+
</div>
|
1038
|
+
|
1039
|
+
</li>
|
1040
|
+
|
1041
|
+
</ul>
|
1042
|
+
|
1043
|
+
<p class="tag_title">Raises:</p>
|
1044
|
+
<ul class="raise">
|
1045
|
+
|
1046
|
+
<li>
|
1047
|
+
|
1048
|
+
|
1049
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Errors/BaseError.html" title="Apes::Errors::BaseError (class)">::Apes::Errors::BaseError</a></span></tt>)</span>
|
1050
|
+
|
1051
|
+
|
1052
|
+
|
1053
|
+
</li>
|
1054
|
+
|
1055
|
+
</ul>
|
1056
|
+
|
1057
|
+
</div><table class="source_code">
|
1058
|
+
<tr>
|
1059
|
+
<td>
|
1060
|
+
<pre class="lines">
|
1061
|
+
|
1062
|
+
|
1063
|
+
31
|
1064
|
+
32
|
1065
|
+
33</pre>
|
1066
|
+
</td>
|
1067
|
+
<td>
|
1068
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/errors.rb', line 31</span>
|
1069
|
+
|
1070
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_fail_request!'>fail_request!</span><span class='lparen'>(</span><span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
|
1071
|
+
<span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Apes</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>BaseError</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>status:</span> <span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='label'>error:</span> <span class='id identifier rubyid_error'>error</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1072
|
+
<span class='kw'>end</span></pre>
|
1073
|
+
</td>
|
1074
|
+
</tr>
|
1075
|
+
</table>
|
1076
|
+
</div>
|
1077
|
+
|
1078
|
+
</div>
|
1079
|
+
|
1080
|
+
</div>
|
1081
|
+
|
1082
|
+
<div id="footer">
|
1083
|
+
Generated on Sat Jun 4 12:41:53 2016 by
|
1084
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1085
|
+
0.8.7.6 (ruby-2.3.0).
|
1086
|
+
</div>
|
1087
|
+
|
1088
|
+
</body>
|
1089
|
+
</html>
|