touth 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: fb6f3f37d102cc22a9be19c43f1d56a174b32ed1
4
- data.tar.gz: f691dac5c428d62b7077ffdaa09eaa0df4ba29a1
3
+ metadata.gz: 469a3737bb35a3a5c9b14d4af257e0a2c7d2e0f6
4
+ data.tar.gz: 630d22bfbd1c42c70a376555826ec1e4aac5a585
5
5
  SHA512:
6
- metadata.gz: 2d166f9d6c80bf09865253d54c67e9338eb7888566df916203e798a2ed1823c0143c4200dedfa0de9788e125e4537920591593bfacf430ba030388008668bd18
7
- data.tar.gz: 4ac78b3026d68cc44331b71392e029e5bf54ca7d5241a72353cf045a8421e80bbed61a637b1aa294d05f79f159059ab7f3c349346c67174f9c6887cbaa274e67
6
+ metadata.gz: dfb8ea431513911ee94fa8df7997bf333b79dad68da0a3819fc5494981584693a2278c4f1600bc84e2d6043c4bb8d9ca91782b2b5b3011b25729fbfef79d30ae
7
+ data.tar.gz: ca035808f9b2fc84027c6a5fde3cbcbbf8ac2bf7937c3951cac4672184966b4d4057166955ff3bf267f23d0e73d0556fc4dd96983416f65c721e93ddb336d2fa
@@ -1,6 +1,8 @@
1
1
  require 'active_support'
2
2
 
3
3
 
4
+ # Touth
5
+ #-----------------------------------------------
4
6
  module Touth
5
7
 
6
8
  extend ActiveSupport::Autoload
@@ -54,4 +56,18 @@ module Touth
54
56
 
55
57
  end
56
58
 
59
+
60
+ # Setup
61
+ #-----------------------------------------------
57
62
  Touth.setup
63
+
64
+
65
+ # Load
66
+ #-----------------------------------------------
67
+ ActiveSupport.on_load(:action_controller) do
68
+ extend Touth::ActionControllerSupport::ClassMethods
69
+ include Touth::ActionControllerSupport::InstanceMethods
70
+ end
71
+ ActiveSupport.on_load(:active_record) do
72
+ extend Touth::ActiveRecordSupport::ClassMethods
73
+ end
@@ -31,20 +31,15 @@ module Touth
31
31
  def authenticate_token!
32
32
  token = request.headers[Touth.header_name]
33
33
 
34
- if Authenticator.valid_access_token? token
34
+ unless token && Authenticator.valid_access_token?(token)
35
35
  render nothing: true, status: :unauthorized
36
36
  return false
37
37
  end
38
38
 
39
39
  model = Authenticator.get_model token
40
- self.class.access_token_resources[model.name] = model
40
+ self.class.access_token_resources[model.class.name] = model
41
41
  end
42
42
 
43
43
  end
44
44
  end
45
45
  end
46
-
47
- ActiveSupport.on_load(:action_controller) do
48
- extend Touth::ActionControllerSupport::ClassMethods
49
- include Touth::ActionControllerSupport::InstanceMethods
50
- end
@@ -21,7 +21,3 @@ module Touth
21
21
  end
22
22
  end
23
23
  end
24
-
25
- ActiveSupport.on_load(:active_record) do
26
- extend Touth::ActiveRecordSupport::ClassMethods
27
- end
@@ -1,3 +1,3 @@
1
1
  module Touth
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touth
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
  - Yuki Iwanaga