apes 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/doc/Apes.html +1 -1
- data/doc/Apes/Concerns.html +1 -1
- data/doc/Apes/Concerns/Errors.html +1 -1
- data/doc/Apes/Concerns/Pagination.html +1 -1
- data/doc/Apes/Concerns/Request.html +23 -27
- data/doc/Apes/Concerns/Response.html +1 -1
- data/doc/Apes/Controller.html +1 -1
- data/doc/Apes/Errors.html +1 -1
- data/doc/Apes/Errors/AuthenticationError.html +1 -1
- data/doc/Apes/Errors/BadRequestError.html +1 -1
- data/doc/Apes/Errors/BaseError.html +1 -1
- data/doc/Apes/Errors/InvalidDataError.html +1 -1
- data/doc/Apes/Errors/MissingDataError.html +1 -1
- data/doc/Apes/Model.html +1 -1
- data/doc/Apes/PaginationCursor.html +1 -1
- data/doc/Apes/RuntimeConfiguration.html +5 -5
- data/doc/Apes/Serializers.html +1 -1
- data/doc/Apes/Serializers/JSON.html +1 -1
- data/doc/Apes/Serializers/JWT.html +1 -1
- data/doc/Apes/Serializers/List.html +1 -1
- data/doc/Apes/UrlsParser.html +1 -1
- data/doc/Apes/Validators.html +1 -1
- data/doc/Apes/Validators/BaseValidator.html +1 -1
- data/doc/Apes/Validators/BooleanValidator.html +1 -1
- data/doc/Apes/Validators/EmailValidator.html +1 -1
- data/doc/Apes/Validators/PhoneValidator.html +1 -1
- data/doc/Apes/Validators/ReferenceValidator.html +1 -1
- data/doc/Apes/Validators/TimestampValidator.html +1 -1
- data/doc/Apes/Validators/UuidValidator.html +1 -1
- data/doc/Apes/Validators/ZipCodeValidator.html +1 -1
- data/doc/Apes/Version.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/lib/apes/concerns/request.rb +1 -3
- data/lib/apes/runtime_configuration.rb +1 -1
- data/lib/apes/version.rb +1 -1
- data/spec/apes/concerns/request_spec.rb +15 -1
- data/spec/apes/runtime_configuration_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a4b6fab1b14d71ede16a3f88bb76667ca6b8060
|
|
4
|
+
data.tar.gz: f2064a34117073756dc3d358000e17e8557d6df2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b28248a214851797484557cbe137b73105f322248b1c4bd853bd6928366d9edd8860a28acd7b7e2a8c088ae614c353626cc3c3d4b1a8d7e610fe7b6d65ce8250
|
|
7
|
+
data.tar.gz: d03abf06b7810967502130cecbdcaebe6384799ec52c746db0f579e37f7466136b7d29a5ef483a9e99efe61576e249e9374ee8705b5a4c8561c9432c44fe9e37
|
data/CHANGELOG.md
CHANGED
data/doc/Apes.html
CHANGED
|
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
|
121
121
|
</div>
|
|
122
122
|
|
|
123
123
|
<div id="footer">
|
|
124
|
-
Generated on
|
|
124
|
+
Generated on Tue Jun 14 10:21:03 2016 by
|
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
126
126
|
0.8.7.6 (ruby-2.3.0).
|
|
127
127
|
</div>
|
data/doc/Apes/Concerns.html
CHANGED
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
</div>
|
|
119
119
|
|
|
120
120
|
<div id="footer">
|
|
121
|
-
Generated on
|
|
121
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
122
122
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
123
123
|
0.8.7.6 (ruby-2.3.0).
|
|
124
124
|
</div>
|
|
@@ -1080,7 +1080,7 @@
|
|
|
1080
1080
|
</div>
|
|
1081
1081
|
|
|
1082
1082
|
<div id="footer">
|
|
1083
|
-
Generated on
|
|
1083
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
1084
1084
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1085
1085
|
0.8.7.6 (ruby-2.3.0).
|
|
1086
1086
|
</div>
|
|
@@ -627,7 +627,7 @@
|
|
|
627
627
|
</div>
|
|
628
628
|
|
|
629
629
|
<div id="footer">
|
|
630
|
-
Generated on
|
|
630
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
631
631
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
632
632
|
0.8.7.6 (ruby-2.3.0).
|
|
633
633
|
</div>
|
|
@@ -358,18 +358,18 @@
|
|
|
358
358
|
<pre class="lines">
|
|
359
359
|
|
|
360
360
|
|
|
361
|
+
77
|
|
362
|
+
78
|
|
361
363
|
79
|
|
362
364
|
80
|
|
363
365
|
81
|
|
364
366
|
82
|
|
365
367
|
83
|
|
366
368
|
84
|
|
367
|
-
85
|
|
368
|
-
86
|
|
369
|
-
87</pre>
|
|
369
|
+
85</pre>
|
|
370
370
|
</td>
|
|
371
371
|
<td>
|
|
372
|
-
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line
|
|
372
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line 77</span>
|
|
373
373
|
|
|
374
374
|
<span class='kw'>def</span> <span class='id identifier rubyid_request_cast_attributes'>request_cast_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_attributes'>attributes</span><span class='rparen'>)</span>
|
|
375
375
|
<span class='id identifier rubyid_types'>types</span> <span class='op'>=</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_column_types'>column_types</span>
|
|
@@ -491,6 +491,8 @@
|
|
|
491
491
|
<pre class="lines">
|
|
492
492
|
|
|
493
493
|
|
|
494
|
+
55
|
|
495
|
+
56
|
|
494
496
|
57
|
|
495
497
|
58
|
|
496
498
|
59
|
|
@@ -504,12 +506,10 @@
|
|
|
504
506
|
67
|
|
505
507
|
68
|
|
506
508
|
69
|
|
507
|
-
70
|
|
508
|
-
71
|
|
509
|
-
72</pre>
|
|
509
|
+
70</pre>
|
|
510
510
|
</td>
|
|
511
511
|
<td>
|
|
512
|
-
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line
|
|
512
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line 55</span>
|
|
513
513
|
|
|
514
514
|
<span class='kw'>def</span> <span class='id identifier rubyid_request_extract_model'>request_extract_model</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='label'>type_field:</span> <span class='symbol'>:type</span><span class='comma'>,</span> <span class='label'>attributes_field:</span> <span class='symbol'>:attributes</span><span class='comma'>,</span> <span class='label'>relationships_field:</span> <span class='symbol'>:relationships</span><span class='rparen'>)</span>
|
|
515
515
|
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span>
|
|
@@ -562,17 +562,13 @@
|
|
|
562
562
|
16
|
|
563
563
|
17
|
|
564
564
|
18
|
|
565
|
-
19
|
|
566
|
-
20
|
|
567
|
-
21</pre>
|
|
565
|
+
19</pre>
|
|
568
566
|
</td>
|
|
569
567
|
<td>
|
|
570
568
|
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line 14</span>
|
|
571
569
|
|
|
572
570
|
<span class='kw'>def</span> <span class='id identifier rubyid_request_handle_cors'>request_handle_cors</span>
|
|
573
|
-
<span class='id identifier
|
|
574
|
-
|
|
575
|
-
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Access-Control-Allow-Origin</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_cors_source'>cors_source</span>
|
|
571
|
+
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Access-Control-Allow-Origin</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Origin</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Apes</span><span class='op'>::</span><span class='const'>RuntimeConfiguration</span><span class='period'>.</span><span class='id identifier rubyid_cors_source'>cors_source</span>
|
|
576
572
|
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Access-Control-Allow-Methods</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>POST, GET, PUT, DELETE, OPTIONS</span><span class='tstring_end'>"</span></span>
|
|
577
573
|
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Access-Control-Allow-Headers</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Content-Type, X-User-Email, X-User-Token</span><span class='tstring_end'>"</span></span>
|
|
578
574
|
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Access-Control-Max-Age</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
|
@@ -624,12 +620,12 @@
|
|
|
624
620
|
<pre class="lines">
|
|
625
621
|
|
|
626
622
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
37
|
|
624
|
+
38
|
|
625
|
+
39</pre>
|
|
630
626
|
</td>
|
|
631
627
|
<td>
|
|
632
|
-
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line
|
|
628
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line 37</span>
|
|
633
629
|
|
|
634
630
|
<span class='kw'>def</span> <span class='id identifier rubyid_request_source_host'>request_source_host</span>
|
|
635
631
|
<span class='ivar'>@api_source</span> <span class='op'>||=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span>
|
|
@@ -681,12 +677,12 @@
|
|
|
681
677
|
<pre class="lines">
|
|
682
678
|
|
|
683
679
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
680
|
+
44
|
|
681
|
+
45
|
|
682
|
+
46</pre>
|
|
687
683
|
</td>
|
|
688
684
|
<td>
|
|
689
|
-
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line
|
|
685
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line 44</span>
|
|
690
686
|
|
|
691
687
|
<span class='kw'>def</span> <span class='id identifier rubyid_request_valid_content_type'>request_valid_content_type</span>
|
|
692
688
|
<span class='const'>Apes</span><span class='op'>::</span><span class='const'>Concerns</span><span class='op'>::</span><span class='const'>Request</span><span class='op'>::</span><span class='const'>CONTENT_TYPE</span>
|
|
@@ -721,6 +717,8 @@
|
|
|
721
717
|
<pre class="lines">
|
|
722
718
|
|
|
723
719
|
|
|
720
|
+
22
|
|
721
|
+
23
|
|
724
722
|
24
|
|
725
723
|
25
|
|
726
724
|
26
|
|
@@ -729,12 +727,10 @@
|
|
|
729
727
|
29
|
|
730
728
|
30
|
|
731
729
|
31
|
|
732
|
-
32
|
|
733
|
-
33
|
|
734
|
-
34</pre>
|
|
730
|
+
32</pre>
|
|
735
731
|
</td>
|
|
736
732
|
<td>
|
|
737
|
-
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line
|
|
733
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/request.rb', line 22</span>
|
|
738
734
|
|
|
739
735
|
<span class='kw'>def</span> <span class='id identifier rubyid_request_validate'>request_validate</span>
|
|
740
736
|
<span class='id identifier rubyid_content_type'>content_type</span> <span class='op'>=</span> <span class='id identifier rubyid_request_valid_content_type'>request_valid_content_type</span>
|
|
@@ -757,7 +753,7 @@
|
|
|
757
753
|
</div>
|
|
758
754
|
|
|
759
755
|
<div id="footer">
|
|
760
|
-
Generated on
|
|
756
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
761
757
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
762
758
|
0.8.7.6 (ruby-2.3.0).
|
|
763
759
|
</div>
|
|
@@ -931,7 +931,7 @@
|
|
|
931
931
|
</div>
|
|
932
932
|
|
|
933
933
|
<div id="footer">
|
|
934
|
-
Generated on
|
|
934
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
935
935
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
936
936
|
0.8.7.6 (ruby-2.3.0).
|
|
937
937
|
</div>
|
data/doc/Apes/Controller.html
CHANGED
|
@@ -1091,7 +1091,7 @@ It ensures that the host is always included and that is set properly in developm
|
|
|
1091
1091
|
</div>
|
|
1092
1092
|
|
|
1093
1093
|
<div id="footer">
|
|
1094
|
-
Generated on
|
|
1094
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
1095
1095
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1096
1096
|
0.8.7.6 (ruby-2.3.0).
|
|
1097
1097
|
</div>
|
data/doc/Apes/Errors.html
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.8.7.6 (ruby-2.3.0).
|
|
122
122
|
</div>
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
</div>
|
|
125
125
|
|
|
126
126
|
<div id="footer">
|
|
127
|
-
Generated on
|
|
127
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
129
129
|
0.8.7.6 (ruby-2.3.0).
|
|
130
130
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on
|
|
151
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.8.7.6 (ruby-2.3.0).
|
|
154
154
|
</div>
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
</div>
|
|
312
312
|
|
|
313
313
|
<div id="footer">
|
|
314
|
-
Generated on
|
|
314
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
315
315
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
316
316
|
0.8.7.6 (ruby-2.3.0).
|
|
317
317
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on
|
|
151
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.8.7.6 (ruby-2.3.0).
|
|
154
154
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on
|
|
151
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.8.7.6 (ruby-2.3.0).
|
|
154
154
|
</div>
|
data/doc/Apes/Model.html
CHANGED
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
</div>
|
|
370
370
|
|
|
371
371
|
<div id="footer">
|
|
372
|
-
Generated on
|
|
372
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
373
373
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
374
374
|
0.8.7.6 (ruby-2.3.0).
|
|
375
375
|
</div>
|
|
@@ -2129,7 +2129,7 @@
|
|
|
2129
2129
|
</div>
|
|
2130
2130
|
|
|
2131
2131
|
<div id="footer">
|
|
2132
|
-
Generated on
|
|
2132
|
+
Generated on Tue Jun 14 10:21:05 2016 by
|
|
2133
2133
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
2134
2134
|
0.8.7.6 (ruby-2.3.0).
|
|
2135
2135
|
</div>
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
<li class="public ">
|
|
128
128
|
<span class="summary_signature">
|
|
129
129
|
|
|
130
|
-
<a href="#cors_source-class_method" title="cors_source (class method)">+ (String) <strong>cors_source</strong>(default = "localhost") </a>
|
|
130
|
+
<a href="#cors_source-class_method" title="cors_source (class method)">+ (String) <strong>cors_source</strong>(default = "http://localhost") </a>
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
<div class="method_details first">
|
|
321
321
|
<h3 class="signature first" id="cors_source-class_method">
|
|
322
322
|
|
|
323
|
-
+ (<tt>String</tt>) <strong>cors_source</strong>(default = "localhost")
|
|
323
|
+
+ (<tt>String</tt>) <strong>cors_source</strong>(default = "http://localhost")
|
|
324
324
|
|
|
325
325
|
|
|
326
326
|
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
<span class='type'>(<tt>String</tt>)</span>
|
|
346
346
|
|
|
347
347
|
|
|
348
|
-
<em class="default">(defaults to: <tt>"localhost"</tt>)</em>
|
|
348
|
+
<em class="default">(defaults to: <tt>"http://localhost"</tt>)</em>
|
|
349
349
|
|
|
350
350
|
|
|
351
351
|
—
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
<td>
|
|
388
388
|
<pre class="code"><span class="info file"># File 'lib/apes/runtime_configuration.rb', line 59</span>
|
|
389
389
|
|
|
390
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_cors_source'>cors_source</span><span class='lparen'>(</span><span class='id identifier rubyid_default'>default</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>localhost</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
390
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_cors_source'>cors_source</span><span class='lparen'>(</span><span class='id identifier rubyid_default'>default</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://localhost</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
391
391
|
<span class='id identifier rubyid_fetch_with_fallback'>fetch_with_fallback</span><span class='lparen'>(</span><span class='id identifier rubyid_default'>default</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_secrets'>secrets</span><span class='period'>.</span><span class='id identifier rubyid_cors_source'>cors_source</span> <span class='rbrace'>}</span>
|
|
392
392
|
<span class='kw'>end</span></pre>
|
|
393
393
|
</td>
|
|
@@ -900,7 +900,7 @@
|
|
|
900
900
|
</div>
|
|
901
901
|
|
|
902
902
|
<div id="footer">
|
|
903
|
-
Generated on
|
|
903
|
+
Generated on Tue Jun 14 10:21:05 2016 by
|
|
904
904
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
905
905
|
0.8.7.6 (ruby-2.3.0).
|
|
906
906
|
</div>
|
data/doc/Apes/Serializers.html
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.8.7.6 (ruby-2.3.0).
|
|
122
122
|
</div>
|
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
</div>
|
|
381
381
|
|
|
382
382
|
<div id="footer">
|
|
383
|
-
Generated on
|
|
383
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
384
384
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
385
385
|
0.8.7.6 (ruby-2.3.0).
|
|
386
386
|
</div>
|
|
@@ -443,7 +443,7 @@
|
|
|
443
443
|
</div>
|
|
444
444
|
|
|
445
445
|
<div id="footer">
|
|
446
|
-
Generated on
|
|
446
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
447
447
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
448
448
|
0.8.7.6 (ruby-2.3.0).
|
|
449
449
|
</div>
|
|
@@ -338,7 +338,7 @@
|
|
|
338
338
|
</div>
|
|
339
339
|
|
|
340
340
|
<div id="footer">
|
|
341
|
-
Generated on
|
|
341
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
342
342
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
343
343
|
0.8.7.6 (ruby-2.3.0).
|
|
344
344
|
</div>
|
data/doc/Apes/UrlsParser.html
CHANGED
|
@@ -1423,7 +1423,7 @@ To update the list: http:jecas.cz/tld-list/</p>
|
|
|
1423
1423
|
</div>
|
|
1424
1424
|
|
|
1425
1425
|
<div id="footer">
|
|
1426
|
-
Generated on
|
|
1426
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
1427
1427
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1428
1428
|
0.8.7.6 (ruby-2.3.0).
|
|
1429
1429
|
</div>
|
data/doc/Apes/Validators.html
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.8.7.6 (ruby-2.3.0).
|
|
122
122
|
</div>
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
</div>
|
|
270
270
|
|
|
271
271
|
<div id="footer">
|
|
272
|
-
Generated on
|
|
272
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
273
273
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
274
274
|
0.8.7.6 (ruby-2.3.0).
|
|
275
275
|
</div>
|
|
@@ -485,7 +485,7 @@
|
|
|
485
485
|
</div>
|
|
486
486
|
|
|
487
487
|
<div id="footer">
|
|
488
|
-
Generated on
|
|
488
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
489
489
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
490
490
|
0.8.7.6 (ruby-2.3.0).
|
|
491
491
|
</div>
|
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
</div>
|
|
342
342
|
|
|
343
343
|
<div id="footer">
|
|
344
|
-
Generated on
|
|
344
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
345
345
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
346
346
|
0.8.7.6 (ruby-2.3.0).
|
|
347
347
|
</div>
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
</div>
|
|
367
367
|
|
|
368
368
|
<div id="footer">
|
|
369
|
-
Generated on
|
|
369
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
370
370
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
371
371
|
0.8.7.6 (ruby-2.3.0).
|
|
372
372
|
</div>
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
</div>
|
|
364
364
|
|
|
365
365
|
<div id="footer">
|
|
366
|
-
Generated on
|
|
366
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
367
367
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
368
368
|
0.8.7.6 (ruby-2.3.0).
|
|
369
369
|
</div>
|
|
@@ -631,7 +631,7 @@
|
|
|
631
631
|
</div>
|
|
632
632
|
|
|
633
633
|
<div id="footer">
|
|
634
|
-
Generated on
|
|
634
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
635
635
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
636
636
|
0.8.7.6 (ruby-2.3.0).
|
|
637
637
|
</div>
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
</div>
|
|
364
364
|
|
|
365
365
|
<div id="footer">
|
|
366
|
-
Generated on
|
|
366
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
367
367
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
368
368
|
0.8.7.6 (ruby-2.3.0).
|
|
369
369
|
</div>
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
</div>
|
|
364
364
|
|
|
365
365
|
<div id="footer">
|
|
366
|
-
Generated on
|
|
366
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
367
367
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
368
368
|
0.8.7.6 (ruby-2.3.0).
|
|
369
369
|
</div>
|
data/doc/Apes/Version.html
CHANGED
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
|
|
150
150
|
</div>
|
|
151
151
|
</dt>
|
|
152
|
-
<dd><pre class="code"><span class='int'>
|
|
152
|
+
<dd><pre class="code"><span class='int'>1</span></pre></dd>
|
|
153
153
|
|
|
154
154
|
<dt id="STRING-constant" class="">STRING =
|
|
155
155
|
<div class="docstring">
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
</div>
|
|
181
181
|
|
|
182
182
|
<div id="footer">
|
|
183
|
-
Generated on
|
|
183
|
+
Generated on Tue Jun 14 10:21:04 2016 by
|
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
185
185
|
0.8.7.6 (ruby-2.3.0).
|
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
|
@@ -426,7 +426,7 @@
|
|
|
426
426
|
</div>
|
|
427
427
|
|
|
428
428
|
<div id="footer">
|
|
429
|
-
Generated on
|
|
429
|
+
Generated on Tue Jun 14 10:21:03 2016 by
|
|
430
430
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
431
431
|
0.8.7.6 (ruby-2.3.0).
|
|
432
432
|
</div>
|
data/doc/file.README.html
CHANGED
|
@@ -243,7 +243,7 @@ end</p>
|
|
|
243
243
|
</div></div>
|
|
244
244
|
|
|
245
245
|
<div id="footer">
|
|
246
|
-
Generated on
|
|
246
|
+
Generated on Tue Jun 14 10:21:03 2016 by
|
|
247
247
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
248
248
|
0.8.7.6 (ruby-2.3.0).
|
|
249
249
|
</div>
|
data/doc/index.html
CHANGED
|
@@ -243,7 +243,7 @@ end</p>
|
|
|
243
243
|
</div></div>
|
|
244
244
|
|
|
245
245
|
<div id="footer">
|
|
246
|
-
Generated on
|
|
246
|
+
Generated on Tue Jun 14 10:21:03 2016 by
|
|
247
247
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
248
248
|
0.8.7.6 (ruby-2.3.0).
|
|
249
249
|
</div>
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
</div>
|
|
104
104
|
|
|
105
105
|
<div id="footer">
|
|
106
|
-
Generated on
|
|
106
|
+
Generated on Tue Jun 14 10:21:03 2016 by
|
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
108
108
|
0.8.7.6 (ruby-2.3.0).
|
|
109
109
|
</div>
|
|
@@ -12,9 +12,7 @@ module Apes
|
|
|
12
12
|
|
|
13
13
|
# Sets headers for CORS handling.
|
|
14
14
|
def request_handle_cors
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
headers["Access-Control-Allow-Origin"] = cors_source
|
|
15
|
+
headers["Access-Control-Allow-Origin"] = request.headers["Origin"] || Apes::RuntimeConfiguration.cors_source
|
|
18
16
|
headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS"
|
|
19
17
|
headers["Access-Control-Allow-Headers"] = "Content-Type, X-User-Email, X-User-Token"
|
|
20
18
|
headers["Access-Control-Max-Age"] = 1.year.to_i.to_s
|
|
@@ -56,7 +56,7 @@ module Apes
|
|
|
56
56
|
#
|
|
57
57
|
# @param default [String] The fallback if no valid CORS source is found in Rails secrets file.
|
|
58
58
|
# @return [String] The CORS source used by Apes.
|
|
59
|
-
def cors_source(default = "localhost")
|
|
59
|
+
def cors_source(default = "http://localhost")
|
|
60
60
|
fetch_with_fallback(default) { Rails.application.secrets.cors_source }
|
|
61
61
|
end
|
|
62
62
|
|
data/lib/apes/version.rb
CHANGED
|
@@ -44,13 +44,27 @@ describe Apes::Concerns::Request do
|
|
|
44
44
|
|
|
45
45
|
describe "#request_handle_cors" do
|
|
46
46
|
it "should set the right headers" do
|
|
47
|
+
allow(subject.request).to receive(:headers).and_return({})
|
|
48
|
+
allow(subject).to receive(:request_source_host).and_return("FOO")
|
|
49
|
+
|
|
50
|
+
subject.request_handle_cors
|
|
51
|
+
expect(subject.headers).to eq({
|
|
52
|
+
"Access-Control-Allow-Headers" => "Content-Type, X-User-Email, X-User-Token",
|
|
53
|
+
"Access-Control-Allow-Methods" => "POST, GET, PUT, DELETE, OPTIONS",
|
|
54
|
+
"Access-Control-Allow-Origin" => "http://localhost",
|
|
55
|
+
"Access-Control-Max-Age" => "31557600"
|
|
56
|
+
})
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "should use the Origin request header when appropriate" do
|
|
60
|
+
allow(subject.request).to receive(:headers).and_return({"Origin" => "http://whatever.com:123"})
|
|
47
61
|
allow(subject).to receive(:request_source_host).and_return("FOO")
|
|
48
62
|
|
|
49
63
|
subject.request_handle_cors
|
|
50
64
|
expect(subject.headers).to eq({
|
|
51
65
|
"Access-Control-Allow-Headers" => "Content-Type, X-User-Email, X-User-Token",
|
|
52
66
|
"Access-Control-Allow-Methods" => "POST, GET, PUT, DELETE, OPTIONS",
|
|
53
|
-
"Access-Control-Allow-Origin" => "http://
|
|
67
|
+
"Access-Control-Allow-Origin" => "http://whatever.com:123",
|
|
54
68
|
"Access-Control-Max-Age" => "31557600"
|
|
55
69
|
})
|
|
56
70
|
end
|
|
@@ -81,7 +81,7 @@ describe Apes::RuntimeConfiguration do
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "should fallback to a default" do
|
|
84
|
-
expect(Apes::RuntimeConfiguration.cors_source).to eq("localhost")
|
|
84
|
+
expect(Apes::RuntimeConfiguration.cors_source).to eq("http://localhost")
|
|
85
85
|
expect(Apes::RuntimeConfiguration.cors_source("DEFAULT")).to eq("DEFAULT")
|
|
86
86
|
end
|
|
87
87
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shogun
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-06-
|
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lazier
|