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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fd7308d5de3ee1087bf4829558efeb555f18433
4
- data.tar.gz: 383fd2c09d0fc8a72d63e0f6f6857df11439b690
3
+ metadata.gz: c9e4f9272d9c6b9f3d2a76986e911c2ff2a2c1e4
4
+ data.tar.gz: e88da906873448c2118cf2b31f80aa7810a6bf44
5
5
  SHA512:
6
- metadata.gz: bfc2f279d0e4f7979ea66adb086067c19f5e4320ea0a9aea0a7cb865ae6a9c4b5939e2e305902db56b222f0567b707c5c8ef3d14790d9bbc4f6e9492d9639345
7
- data.tar.gz: c57175fc1f465f1524d0000342b36c2f1a192dfd37da8c5a78167ed409ab42d93a5487895eedfd0d9be4f3b33ce1ca715ae9c53340c9c2787979aa359e9e82b5
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.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |g|
2
2
  g.name = 'hobby-auth'
3
3
  g.files = `git ls-files`.split($/)
4
- g.version = '0.0.2'
4
+ g.version = '0.1.0'
5
5
  g.summary = 'A Hobby extension to authorize routes.'
6
6
  g.authors = ['Anatoly Chernow']
7
7
  end
@@ -49,7 +49,7 @@ module Hobby
49
49
  end
50
50
 
51
51
  def self.short_name_of user_model
52
- user_model.name.split('::').last.downcase
52
+ user_model.name.split('::').last
53
53
  end
54
54
  end
55
55
  end
@@ -58,12 +58,12 @@ class App
58
58
  include Hobby
59
59
  include Auth[Manager, Driver]
60
60
 
61
- manager post('/managers_route') {
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
- driver get('/drivers_route') {
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 names leading to the same decorator name
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
 
@@ -8,8 +8,8 @@ Hobby::Devtools::RSpec.describe do
8
8
  include Hobby
9
9
  include Hobby::Auth[Getter, Namespaced::Poster]
10
10
 
11
- getter get { 'oh my get' }
12
- poster post { "the user's token is #{user.token}" }
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 getter get('/decorator') { 'decorator' }
21
+ append_decorator Getter get('/decorator') { 'decorator' }
22
22
  end.new
23
23
  end
24
24
  end
@@ -1,13 +1,13 @@
1
1
  require 'helper'
2
2
 
3
- class Same
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 Same
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[Same, Namespaced::Same]
22
+ include Hobby::Auth[SameName, Namespaced::SameName]
23
23
  end
24
24
  }.to raise_error Hobby::Auth::SameNames,
25
- 'The short names of Same and Namespaced::Same are the same: same.'
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.2
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-06-14 00:00:00.000000000 Z
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.11
51
+ rubygems_version: 2.6.13
51
52
  signing_key:
52
53
  specification_version: 4
53
54
  summary: A Hobby extension to authorize routes.