hobby-auth 0.0.2 → 0.1.0
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/LICENSE +12 -0
- data/hobby-auth.gemspec +1 -1
- data/lib/hobby/auth.rb +1 -1
- data/readme.adoc +3 -3
- data/spec/http_spec.rb +3 -3
- data/spec/name_shadowing_spec.rb +4 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9e4f9272d9c6b9f3d2a76986e911c2ff2a2c1e4
|
4
|
+
data.tar.gz: e88da906873448c2118cf2b31f80aa7810a6bf44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baf86d458c052ed7923eb4df0c3d1db6987ea934986088fc6f40f15ec1cf010f85401a807b1bd563083fa023faeb861da6da92273f6f1a501e769b40ca1a5faf
|
7
|
+
data.tar.gz: d8578d125aa9a354e537f2504856f3a8eea0429d8b1a351003bc6aafc3ee7bf15543a3e820a5831ada3ad3eb60c0d6bf908ed7f16fed8ad950db46e8a07b4eb7
|
data/LICENSE
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Copyright (C) 2017 by Anatoly Chernow <chertoly@gmail.com>
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
purpose with or without fee is hereby granted.
|
5
|
+
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
7
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
8
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
9
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
10
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
11
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
12
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
data/hobby-auth.gemspec
CHANGED
data/lib/hobby/auth.rb
CHANGED
data/readme.adoc
CHANGED
@@ -58,12 +58,12 @@ class App
|
|
58
58
|
include Hobby
|
59
59
|
include Auth[Manager, Driver]
|
60
60
|
|
61
|
-
|
61
|
+
Manager post('/managers_route') {
|
62
62
|
# do something only managers can do
|
63
63
|
user # will return a `Manager` instance
|
64
64
|
}
|
65
65
|
|
66
|
-
|
66
|
+
Driver get('/drivers_route') {
|
67
67
|
# do something only drivers can do
|
68
68
|
user # will return a `Driver` instance
|
69
69
|
}
|
@@ -75,7 +75,7 @@ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization[Authoriz
|
|
75
75
|
If no user were found, the response's status will be set to
|
76
76
|
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403[403].
|
77
77
|
|
78
|
-
NOTE: If your user models have
|
78
|
+
NOTE: If your user models have same short names
|
79
79
|
(for example, `Manager` and `SomeNamespace::Manager`),
|
80
80
|
a `Hobby::Auth::SameNames` error will be raised.
|
81
81
|
|
data/spec/http_spec.rb
CHANGED
@@ -8,8 +8,8 @@ Hobby::Devtools::RSpec.describe do
|
|
8
8
|
include Hobby
|
9
9
|
include Hobby::Auth[Getter, Namespaced::Poster]
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
Getter get { 'oh my get' }
|
12
|
+
Poster post { "the user's token is #{user.token}" }
|
13
13
|
|
14
14
|
|
15
15
|
def self.append_decorator route
|
@@ -18,7 +18,7 @@ Hobby::Devtools::RSpec.describe do
|
|
18
18
|
route
|
19
19
|
end
|
20
20
|
|
21
|
-
append_decorator
|
21
|
+
append_decorator Getter get('/decorator') { 'decorator' }
|
22
22
|
end.new
|
23
23
|
end
|
24
24
|
end
|
data/spec/name_shadowing_spec.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class SameName
|
4
4
|
def self.find_by_token _token
|
5
5
|
new
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
9
|
module Namespaced
|
10
|
-
class
|
10
|
+
class SameName
|
11
11
|
def self.find_by_token _token
|
12
12
|
new
|
13
13
|
end
|
@@ -19,9 +19,9 @@ describe Hobby::Auth do
|
|
19
19
|
expect {
|
20
20
|
Class.new do
|
21
21
|
include Hobby
|
22
|
-
include Hobby::Auth[
|
22
|
+
include Hobby::Auth[SameName, Namespaced::SameName]
|
23
23
|
end
|
24
24
|
}.to raise_error Hobby::Auth::SameNames,
|
25
|
-
'The short names of
|
25
|
+
'The short names of SameName and Namespaced::SameName are the same: SameName.'
|
26
26
|
end
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobby-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoly Chernow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -18,6 +18,7 @@ extra_rdoc_files: []
|
|
18
18
|
files:
|
19
19
|
- ".gitignore"
|
20
20
|
- Gemfile
|
21
|
+
- LICENSE
|
21
22
|
- hobby-auth.gemspec
|
22
23
|
- lib/hobby/auth.rb
|
23
24
|
- readme.adoc
|
@@ -47,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
48
|
version: '0'
|
48
49
|
requirements: []
|
49
50
|
rubyforge_project:
|
50
|
-
rubygems_version: 2.6.
|
51
|
+
rubygems_version: 2.6.13
|
51
52
|
signing_key:
|
52
53
|
specification_version: 4
|
53
54
|
summary: A Hobby extension to authorize routes.
|