ballast 1.1.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8838024de6682d876a4dd3fdb4d57f3fda2d0d2
4
- data.tar.gz: 9ed8b341289200f31225a3c8f278f1a31bfe5712
3
+ metadata.gz: 96bbf671f803a5034149d924d4030cdb89582fe5
4
+ data.tar.gz: eabe6347f93c5cb97f58f7cb1b1cedc73dda934e
5
5
  SHA512:
6
- metadata.gz: 5b566f331d9fe3443c5624246bc2b5cc43076f9fa9eb66396956705ddacdaff1ffabb818572ba7fe878bcd2aec1dac880c38f4834d77ec8e56aef682af667a51
7
- data.tar.gz: cb565f2dbd53b62eb3e279e06b3748446b16dd101c2eb0a3d053d871d12aa6bacacb1a86080d4474f98d2d3f9b01e4ed6c2a74f479cfd74ea2098fa94cb17b21
6
+ metadata.gz: 4e3e3b9026d53322563e9c2b685ce8d8cdfe7ae36f57b9b97ac13c34af6e625f9e72ea9b9914c7dab068eb56ce2c36cda355e3cddea3b7f8b7b27aeb81dafc7b
7
+ data.tar.gz: d90d12d537af952daea0803499cc2a648eebbbdffa8c2e910f67285581e3064509bceac335d35067b9e41cff4c3d8f0bbee9d8851ff0046a066585669b4507b4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 1.1.1 / 2013-12-25
2
+
3
+ * Fixed authentication error handling.
4
+
1
5
  ### 1.1.0 / 2013-12-25
2
6
 
3
7
  * Added domain handling.
@@ -797,7 +797,7 @@
797
797
  </div>
798
798
 
799
799
  <div id="footer">
800
- Generated on Wed Dec 25 14:18:00 2013 by
800
+ Generated on Wed Dec 25 14:38:16 2013 by
801
801
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
802
802
  0.8.7.3 (ruby-2.0.0).
803
803
  </div>
@@ -361,10 +361,7 @@
361
361
  88
362
362
  89
363
363
  90
364
- 91
365
- 92
366
- 93
367
- 94</pre>
364
+ 91</pre>
368
365
  </td>
369
366
  <td>
370
367
  <pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 81</span>
@@ -377,10 +374,7 @@
377
374
 
378
375
  <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_authenticated'>authenticated</span> <span class='kw'>then</span>
379
376
  <span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>WWW-Authenticate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Basic realm=\&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_area'>area</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span>
380
- <span class='ivar'>@error_title</span> <span class='op'>=</span> <span class='id identifier rubyid_title'>title</span>
381
- <span class='ivar'>@error_code</span> <span class='op'>=</span> <span class='int'>401</span>
382
- <span class='ivar'>@error_message</span> <span class='op'>=</span> <span class='id identifier rubyid_message'>message</span>
383
- <span class='id identifier rubyid_handle_error'>handle_error</span>
377
+ <span class='id identifier rubyid_handle_error'>handle_error</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>status:</span> <span class='int'>401</span><span class='comma'>,</span> <span class='label'>title:</span> <span class='id identifier rubyid_title'>title</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span><span class='rbrace'>}</span><span class='rparen'>)</span>
384
378
  <span class='kw'>end</span>
385
379
  <span class='kw'>end</span></pre>
386
380
  </td>
@@ -891,7 +885,7 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
891
885
  </div>
892
886
 
893
887
  <div id="footer">
894
- Generated on Wed Dec 25 14:18:00 2013 by
888
+ Generated on Wed Dec 25 14:38:16 2013 by
895
889
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
896
890
  0.8.7.3 (ruby-2.0.0).
897
891
  </div>
@@ -90,7 +90,7 @@
90
90
 
91
91
  <h2>Overview</h2><div class="docstring">
92
92
  <div class="discussion">
93
- <p>A concern to handle errors.</p>
93
+ <p>A concern to handle errors. It requires the Ajax concern.</p>
94
94
 
95
95
 
96
96
  </div>
@@ -254,7 +254,7 @@
254
254
  <span class='ivar'>@error_title</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Debug</span><span class='tstring_end'>&quot;</span></span>
255
255
  <span class='ivar'>@error_code</span> <span class='op'>=</span> <span class='int'>503</span>
256
256
  <span class='kw'>elsif</span> <span class='ivar'>@error</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
257
- <span class='ivar'>@error_title</span> <span class='op'>=</span> <span class='id identifier rubyid_title'>title</span>
257
+ <span class='ivar'>@error_title</span> <span class='op'>=</span> <span class='ivar'>@error</span><span class='lbracket'>[</span><span class='symbol'>:title</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_title'>title</span>
258
258
  <span class='ivar'>@error_code</span> <span class='op'>=</span> <span class='ivar'>@error</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span>
259
259
  <span class='ivar'>@error_message</span> <span class='op'>=</span> <span class='ivar'>@error</span><span class='lbracket'>[</span><span class='symbol'>:error</span><span class='rbracket'>]</span>
260
260
  <span class='kw'>else</span>
@@ -274,7 +274,7 @@
274
274
  </div>
275
275
 
276
276
  <div id="footer">
277
- Generated on Wed Dec 25 14:18:00 2013 by
277
+ Generated on Wed Dec 25 14:38:16 2013 by
278
278
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
279
279
  0.8.7.3 (ruby-2.0.0).
280
280
  </div>
@@ -655,7 +655,7 @@
655
655
  </div>
656
656
 
657
657
  <div id="footer">
658
- Generated on Wed Dec 25 14:18:00 2013 by
658
+ Generated on Wed Dec 25 14:38:16 2013 by
659
659
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
660
660
  0.8.7.3 (ruby-2.0.0).
661
661
  </div>
@@ -118,7 +118,7 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Wed Dec 25 14:18:00 2013 by
121
+ Generated on Wed Dec 25 14:38:16 2013 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
123
  0.8.7.3 (ruby-2.0.0).
124
124
  </div>
@@ -408,7 +408,7 @@
408
408
  </div>
409
409
 
410
410
  <div id="footer">
411
- Generated on Wed Dec 25 14:18:00 2013 by
411
+ Generated on Wed Dec 25 14:38:16 2013 by
412
412
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
413
413
  0.8.7.3 (ruby-2.0.0).
414
414
  </div>
@@ -317,7 +317,7 @@
317
317
  </div>
318
318
 
319
319
  <div id="footer">
320
- Generated on Wed Dec 25 14:18:00 2013 by
320
+ Generated on Wed Dec 25 14:38:16 2013 by
321
321
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
322
322
  0.8.7.3 (ruby-2.0.0).
323
323
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed Dec 25 14:18:00 2013 by
151
+ Generated on Wed Dec 25 14:38:16 2013 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.8.7.3 (ruby-2.0.0).
154
154
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed Dec 25 14:18:00 2013 by
151
+ Generated on Wed Dec 25 14:38:16 2013 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.8.7.3 (ruby-2.0.0).
154
154
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed Dec 25 14:18:00 2013 by
151
+ Generated on Wed Dec 25 14:38:16 2013 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.8.7.3 (ruby-2.0.0).
154
154
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Wed Dec 25 14:18:00 2013 by
119
+ Generated on Wed Dec 25 14:38:16 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.7.3 (ruby-2.0.0).
122
122
  </div>
@@ -345,7 +345,7 @@
345
345
  </div>
346
346
 
347
347
  <div id="footer">
348
- Generated on Wed Dec 25 14:18:00 2013 by
348
+ Generated on Wed Dec 25 14:38:16 2013 by
349
349
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
350
350
  0.8.7.3 (ruby-2.0.0).
351
351
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Wed Dec 25 14:18:00 2013 by
119
+ Generated on Wed Dec 25 14:38:16 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.7.3 (ruby-2.0.0).
122
122
  </div>
@@ -1295,7 +1295,7 @@ as owner will be created.</p>
1295
1295
  </div>
1296
1296
 
1297
1297
  <div id="footer">
1298
- Generated on Wed Dec 25 14:18:00 2013 by
1298
+ Generated on Wed Dec 25 14:38:16 2013 by
1299
1299
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1300
1300
  0.8.7.3 (ruby-2.0.0).
1301
1301
  </div>
@@ -576,7 +576,7 @@ as owner will be created.</p>
576
576
  </div>
577
577
 
578
578
  <div id="footer">
579
- Generated on Wed Dec 25 14:18:00 2013 by
579
+ Generated on Wed Dec 25 14:38:16 2013 by
580
580
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
581
581
  0.8.7.3 (ruby-2.0.0).
582
582
  </div>
@@ -908,7 +908,7 @@
908
908
  </div>
909
909
 
910
910
  <div id="footer">
911
- Generated on Wed Dec 25 14:18:00 2013 by
911
+ Generated on Wed Dec 25 14:38:16 2013 by
912
912
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
913
913
  0.8.7.3 (ruby-2.0.0).
914
914
  </div>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
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 Wed Dec 25 14:18:00 2013 by
183
+ Generated on Wed Dec 25 14:38:16 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.7.3 (ruby-2.0.0).
186
186
  </div>
data/doc/Ballast.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 Wed Dec 25 14:18:00 2013 by
124
+ Generated on Wed Dec 25 14:38:16 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.7.3 (ruby-2.0.0).
127
127
  </div>
data/doc/_index.html CHANGED
@@ -303,7 +303,7 @@
303
303
  </div>
304
304
 
305
305
  <div id="footer">
306
- Generated on Wed Dec 25 14:17:59 2013 by
306
+ Generated on Wed Dec 25 14:38:15 2013 by
307
307
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
308
308
  0.8.7.3 (ruby-2.0.0).
309
309
  </div>
data/doc/file.README.html CHANGED
@@ -106,7 +106,7 @@
106
106
  </div></div>
107
107
 
108
108
  <div id="footer">
109
- Generated on Wed Dec 25 14:18:00 2013 by
109
+ Generated on Wed Dec 25 14:38:16 2013 by
110
110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
111
111
  0.8.7.3 (ruby-2.0.0).
112
112
  </div>
data/doc/index.html CHANGED
@@ -106,7 +106,7 @@
106
106
  </div></div>
107
107
 
108
108
  <div id="footer">
109
- Generated on Wed Dec 25 14:18:00 2013 by
109
+ Generated on Wed Dec 25 14:38:16 2013 by
110
110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
111
111
  0.8.7.3 (ruby-2.0.0).
112
112
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Wed Dec 25 14:18:00 2013 by
106
+ Generated on Wed Dec 25 14:38:16 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.7.3 (ruby-2.0.0).
109
109
  </div>
@@ -86,10 +86,7 @@ module Ballast
86
86
 
87
87
  if !authenticated then
88
88
  headers["WWW-Authenticate"] = "Basic realm=\"#{area}\""
89
- @error_title = title
90
- @error_code = 401
91
- @error_message = message
92
- handle_error
89
+ handle_error({status: 401, title: title, message: message})
93
90
  end
94
91
  end
95
92
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  module Ballast
7
7
  module Concerns
8
- # A concern to handle errors.
8
+ # A concern to handle errors. It requires the Ajax concern.
9
9
  module ErrorsHandling
10
10
  extend ActiveSupport::Concern
11
11
 
@@ -21,7 +21,7 @@ module Ballast
21
21
  @error_title = "Debug"
22
22
  @error_code = 503
23
23
  elsif @error.is_a?(Hash) then
24
- @error_title = title
24
+ @error_title = @error[:title] || title
25
25
  @error_code = @error[:status]
26
26
  @error_message = @error[:error]
27
27
  else
@@ -16,7 +16,7 @@ module Ballast
16
16
  MINOR = 1
17
17
 
18
18
  # The patch version.
19
- PATCH = 0
19
+ PATCH = 1
20
20
 
21
21
  # The current version of ballast.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -78,23 +78,18 @@ describe Ballast::Concerns::Common do
78
78
 
79
79
  it "in case of failure, it should set error" do
80
80
  expect(subject).to receive(:authenticate_with_http_basic).and_return(false)
81
- expect(subject).to receive(:handle_error)
82
- subject.authenticate_user
81
+ expect(subject).to receive(:handle_error).with({status: 401, title: "Authentication required.", message: "To view this resource you have to authenticate."})
83
82
 
83
+ subject.authenticate_user
84
84
  expect(subject.headers["WWW-Authenticate"]).to eq("Basic realm=\"Private Area\"")
85
- expect(subject.instance_variable_get(:@error_title)).to eq("Authentication required.")
86
- expect(subject.instance_variable_get(:@error_message)).to eq("To view this resource you have to authenticate.")
87
- expect(subject.instance_variable_get(:@error_code)).to eq(401)
88
85
  end
89
86
 
90
87
  it "in case of failure, it should show custom messages" do
91
88
  expect(subject).to receive(:authenticate_with_http_basic).and_return(false)
92
- expect(subject).to receive(:handle_error)
93
- subject.authenticate_user("AREA", "TITLE", "MESSAGE")
89
+ expect(subject).to receive(:handle_error).with({status: 401, title: "TITLE", message: "MESSAGE"})
94
90
 
91
+ subject.authenticate_user("AREA", "TITLE", "MESSAGE")
95
92
  expect(subject.headers["WWW-Authenticate"]).to eq("Basic realm=\"AREA\"")
96
- expect(subject.instance_variable_get(:@error_title)).to eq("TITLE")
97
- expect(subject.instance_variable_get(:@error_message)).to eq("MESSAGE")
98
93
  end
99
94
  end
100
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ballast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shogun