api_guard_grape 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -37
- data/Rakefile +1 -1
- data/app/controllers/{api_guard_grape → api_guard}/application_controller.rb +1 -1
- data/app/controllers/{api_guard_grape → api_guard}/authentication_controller.rb +6 -6
- data/app/controllers/{api_guard_grape → api_guard}/passwords_controller.rb +4 -4
- data/app/controllers/{api_guard_grape → api_guard}/registration_controller.rb +4 -4
- data/app/controllers/{api_guard_grape → api_guard}/tokens_controller.rb +6 -6
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +2 -2
- data/lib/{api_guard_grape.rb → api_guard.rb} +9 -9
- data/lib/{api_guard_grape → api_guard}/app_secret_key.rb +1 -1
- data/lib/{api_guard_grape → api_guard}/engine.rb +4 -4
- data/lib/{api_guard_grape → api_guard}/jwt_auth/authentication.rb +16 -16
- data/lib/{api_guard_grape → api_guard}/jwt_auth/blacklist_token.rb +1 -1
- data/lib/api_guard/jwt_auth/json_web_token.rb +143 -0
- data/lib/{api_guard_grape/jwt_auth/json_web_token.rb → api_guard/jwt_auth/refresh_jwt_token.rb} +10 -107
- data/lib/api_guard/models/concerns.rb +27 -0
- data/lib/api_guard/modules.rb +26 -0
- data/lib/{api_guard_grape → api_guard}/resource_mapper.rb +3 -3
- data/lib/{api_guard_grape → api_guard}/response_formatters/renderer.rb +3 -3
- data/lib/{api_guard_grape → api_guard}/route_mapper.rb +10 -10
- data/lib/api_guard/test/controller_helper.rb +13 -0
- data/lib/api_guard/version.rb +5 -0
- data/lib/generators/{api_guard_grape → api_guard}/controllers/USAGE +1 -1
- data/lib/generators/{api_guard_grape → api_guard}/controllers/controllers_generator.rb +1 -1
- data/lib/generators/{api_guard_grape → api_guard}/controllers/templates/authentication_controller.rb +5 -5
- data/lib/generators/{api_guard_grape → api_guard}/controllers/templates/passwords_controller.rb +3 -3
- data/lib/generators/{api_guard_grape → api_guard}/controllers/templates/registration_controller.rb +3 -3
- data/lib/generators/{api_guard_grape → api_guard}/controllers/templates/tokens_controller.rb +5 -5
- data/lib/generators/{api_guard_grape → api_guard}/initializer/USAGE +2 -2
- data/lib/generators/{api_guard_grape → api_guard}/initializer/initializer_generator.rb +2 -2
- data/lib/generators/{api_guard_grape → api_guard}/initializer/templates/initializer.rb +1 -1
- metadata +30 -30
- data/lib/api_guard_grape/jwt_auth/refresh_jwt_token.rb +0 -46
- data/lib/api_guard_grape/models/concerns.rb +0 -27
- data/lib/api_guard_grape/modules.rb +0 -26
- data/lib/api_guard_grape/test/controller_helper.rb +0 -13
- data/lib/api_guard_grape/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03fd89353f83f1dff916ed717aeb63ab7a957c867f82849e7b9db0c59f8b495e
|
4
|
+
data.tar.gz: 3934bf4a9824a8d81d28e4ec1eed7d4a4a4fa0fc526154375ad35316fdc10c84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16190fb470832b3f483d8879dd41dc4eff235fe84a3274ad4ca31ced70f503a165270b9745ed83c4ae894ac614097adde6fb35434a8659fe9e1b154a93c9bfb3
|
7
|
+
data.tar.gz: 6345f644b9a59ffd6da22f9f5284baf2a8ac4ef572a95263d15e73c4f5448bb181f7a891f081edfc27422e5b4ca35293b8eb68c8d16dfa63570b2a6eba61c6b3
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# API Guard
|
2
2
|
|
3
|
-
[![Version](https://img.shields.io/gem/v/
|
4
|
-
[![Build Status](https://github.com/
|
5
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/ced3e74a26a66ed915cb/maintainability)](https://codeclimate.com/github/
|
3
|
+
[![Version](https://img.shields.io/gem/v/api_guard.svg?color=green)](https://rubygems.org/gems/api_guard)
|
4
|
+
[![Build Status](https://github.com/Gokul595/api_guard/workflows/build/badge.svg?branch=master)](https://github.com/Gokul595/api_guard/actions?query=workflow%3Abuild)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/ced3e74a26a66ed915cb/maintainability)](https://codeclimate.com/github/Gokul595/api_guard/maintainability)
|
6
6
|
|
7
7
|
|
8
8
|
[JSON Web Token (JWT)](https://jwt.io/) based authentication solution with token refreshing & blacklisting for APIs
|
@@ -38,8 +38,8 @@ for cryptographic signing.
|
|
38
38
|
* [Override finding resource](#override-finding-resource)
|
39
39
|
* [Customizing / translating response messages using I18n](#customizing--translating-response-messages-using-i18n)
|
40
40
|
* [Testing](#testing)
|
41
|
-
* [Wiki](https://github.com/
|
42
|
-
* [Using API Guard with Devise](https://github.com/
|
41
|
+
* [Wiki](https://github.com/Gokul595/api_guard/wiki)
|
42
|
+
* [Using API Guard with Devise](https://github.com/Gokul595/api_guard/wiki/Using-API-Guard-with-Devise)
|
43
43
|
* [Contributing](#contributing)
|
44
44
|
* [License](#license)
|
45
45
|
|
@@ -48,7 +48,7 @@ for cryptographic signing.
|
|
48
48
|
Add this line to your application's Gemfile:
|
49
49
|
|
50
50
|
```ruby
|
51
|
-
gem '
|
51
|
+
gem 'api_guard'
|
52
52
|
```
|
53
53
|
|
54
54
|
And then execute in your terminal:
|
@@ -58,7 +58,7 @@ $ bundle install
|
|
58
58
|
|
59
59
|
Or install it yourself as:
|
60
60
|
```bash
|
61
|
-
$ gem install
|
61
|
+
$ gem install api_guard
|
62
62
|
```
|
63
63
|
|
64
64
|
## Getting Started
|
@@ -82,7 +82,7 @@ $ rails db:migrate
|
|
82
82
|
Add [has_secure_password](https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html#method-i-has_secure_password)
|
83
83
|
in `User` model for password authentication.
|
84
84
|
|
85
|
-
> Refer [this Wiki](https://github.com/
|
85
|
+
> Refer [this Wiki](https://github.com/Gokul595/api_guard/wiki/Using-API-Guard-with-Devise#authentication) for configuring API Guard authentication to work with Devise instead of using `has_secure_password`.
|
86
86
|
|
87
87
|
```ruby
|
88
88
|
class User < ApplicationRecord
|
@@ -109,12 +109,12 @@ $ bundle install
|
|
109
109
|
Add this line to the application routes (`config/routes.rb`) file:
|
110
110
|
|
111
111
|
```ruby
|
112
|
-
|
112
|
+
api_guard_routes for: 'users'
|
113
113
|
```
|
114
114
|
|
115
115
|
This will generate default routes such as sign up, sign in, sign out, token refresh, password change for User.
|
116
116
|
|
117
|
-
> Refer [this Wiki](https://github.com/
|
117
|
+
> Refer [this Wiki](https://github.com/Gokul595/api_guard/wiki/Using-API-Guard-with-Devise#routes) for configuring API Guard routes to work with Devise.
|
118
118
|
|
119
119
|
### Registration
|
120
120
|
|
@@ -128,7 +128,7 @@ POST "/users/sign_up"
|
|
128
128
|
|
129
129
|
# Request body
|
130
130
|
{
|
131
|
-
"email": "user@
|
131
|
+
"email": "user@apiguard.com",
|
132
132
|
"password": "api_password",
|
133
133
|
"password_confirmation": "api_password"
|
134
134
|
}
|
@@ -174,7 +174,7 @@ POST "/users/sign_in"
|
|
174
174
|
|
175
175
|
# Request body
|
176
176
|
{
|
177
|
-
"email": "user@
|
177
|
+
"email": "user@apiguard.com",
|
178
178
|
"password": "api_password"
|
179
179
|
}
|
180
180
|
```
|
@@ -347,18 +347,18 @@ Example response:
|
|
347
347
|
To configure the API Guard you need to first create an initializer using
|
348
348
|
|
349
349
|
```bash
|
350
|
-
$ rails generate
|
350
|
+
$ rails generate api_guard:initializer
|
351
351
|
```
|
352
352
|
|
353
|
-
This will generate an initializer named **
|
353
|
+
This will generate an initializer named **api_guard.rb** in your app **config/initializers** directory with default
|
354
354
|
configurations.
|
355
355
|
|
356
356
|
### Default configuration
|
357
357
|
|
358
|
-
**config/initializers/
|
358
|
+
**config/initializers/api_guard.rb**
|
359
359
|
|
360
360
|
```ruby
|
361
|
-
|
361
|
+
ApiGuard.setup do |config|
|
362
362
|
# Validity of the JWT access token
|
363
363
|
# Default: 1 day
|
364
364
|
# config.token_validity = 1.day
|
@@ -434,11 +434,11 @@ $ rails db:migrate
|
|
434
434
|
>**Note:** Replace `user` in the above command with your model name if your model is not User.
|
435
435
|
|
436
436
|
After creating model and table for refresh token configure the association in the resource model using
|
437
|
-
`
|
437
|
+
`api_guard_associations` method
|
438
438
|
|
439
439
|
```ruby
|
440
440
|
class User < ApplicationRecord
|
441
|
-
|
441
|
+
api_guard_associations refresh_token: 'refresh_tokens'
|
442
442
|
has_many :refresh_tokens, dependent: :delete_all
|
443
443
|
end
|
444
444
|
```
|
@@ -446,7 +446,7 @@ end
|
|
446
446
|
If you also have token blacklisting enabled you need to specify both associations as below
|
447
447
|
|
448
448
|
```ruby
|
449
|
-
|
449
|
+
api_guard_associations refresh_token: 'refresh_tokens', blacklisted_token: 'blacklisted_tokens'
|
450
450
|
```
|
451
451
|
|
452
452
|
### Token blacklisting
|
@@ -470,11 +470,11 @@ $ rails db:migrate
|
|
470
470
|
>**Note:** Replace `user` in the above command with your model name if your model is not User.
|
471
471
|
|
472
472
|
After creating model and table for blacklisted token configure the association in the resource model using
|
473
|
-
`
|
473
|
+
`api_guard_associations` method
|
474
474
|
|
475
475
|
```ruby
|
476
476
|
class User < ApplicationRecord
|
477
|
-
|
477
|
+
api_guard_associations blacklisted_token: 'blacklisted_tokens'
|
478
478
|
has_many :blacklisted_tokens, dependent: :delete_all
|
479
479
|
end
|
480
480
|
```
|
@@ -482,7 +482,7 @@ end
|
|
482
482
|
If you also have token refreshing enabled you need to specify both associations as below
|
483
483
|
|
484
484
|
```ruby
|
485
|
-
|
485
|
+
api_guard_associations refresh_token: 'refresh_tokens', blacklisted_token: 'blacklisted_tokens'
|
486
486
|
```
|
487
487
|
|
488
488
|
And, as this creates rows in `blacklisted_tokens` table you need to have a mechanism to delete the expired blacklisted
|
@@ -506,7 +506,7 @@ You can override the default API Guard controllers and customize the code as you
|
|
506
506
|
your app
|
507
507
|
|
508
508
|
```bash
|
509
|
-
$ rails generate
|
509
|
+
$ rails generate api_guard:controllers users
|
510
510
|
```
|
511
511
|
|
512
512
|
In above command `users` is the scope of the controllers. If needed, you can replace `users` with your own scope.
|
@@ -516,7 +516,7 @@ This will generate all default controllers for `users` in the directory **app/co
|
|
516
516
|
Then, configure this controller in the routes
|
517
517
|
|
518
518
|
```ruby
|
519
|
-
|
519
|
+
api_guard_routes for: 'users', controller: {
|
520
520
|
registration: 'users/registration',
|
521
521
|
authentication: 'users/authentication',
|
522
522
|
passwords: 'users/passwords',
|
@@ -527,7 +527,7 @@ api_guard_grape_routes for: 'users', controller: {
|
|
527
527
|
You can also specify the controllers that you need to generate using `-c` or `--controllers` option.
|
528
528
|
|
529
529
|
```bash
|
530
|
-
$ rails generate
|
530
|
+
$ rails generate api_guard:controllers users -c registration authentication
|
531
531
|
```
|
532
532
|
|
533
533
|
>**Available controllers:** registration, authentication, tokens, passwords
|
@@ -537,7 +537,7 @@ $ rails generate api_guard_grape:controllers users -c registration authenticatio
|
|
537
537
|
You can skip specific controller routes generated by API Guard
|
538
538
|
|
539
539
|
```ruby
|
540
|
-
|
540
|
+
api_guard_routes for: 'users', except: [:registration]
|
541
541
|
```
|
542
542
|
|
543
543
|
Above config will skip registration related API Guard controller routes for the resource user.
|
@@ -546,21 +546,21 @@ Above config will skip registration related API Guard controller routes for the
|
|
546
546
|
You can also specify only the controller routes you need,
|
547
547
|
|
548
548
|
```ruby
|
549
|
-
|
549
|
+
api_guard_routes for: 'users', only: [:authentication]
|
550
550
|
```
|
551
551
|
|
552
552
|
>**Available controllers:** registration, authentication, tokens, passwords
|
553
553
|
|
554
554
|
**Customizing the route path:**
|
555
555
|
|
556
|
-
You can customize the path of the default routes of the API Guard using the `
|
556
|
+
You can customize the path of the default routes of the API Guard using the `api_guard_scope` as below,
|
557
557
|
|
558
558
|
```ruby
|
559
|
-
|
559
|
+
api_guard_routes for: 'users', except: [:registration]
|
560
560
|
|
561
|
-
|
562
|
-
post 'account/create' => '
|
563
|
-
delete 'account/delete' => '
|
561
|
+
api_guard_scope 'users' do
|
562
|
+
post 'account/create' => 'api_guard/registration#create'
|
563
|
+
delete 'account/delete' => 'api_guard/registration#destroy'
|
564
564
|
end
|
565
565
|
```
|
566
566
|
|
@@ -626,14 +626,14 @@ locale file and customize the messages for any language.
|
|
626
626
|
|
627
627
|
```yaml
|
628
628
|
en:
|
629
|
-
|
629
|
+
api_guard:
|
630
630
|
authentication:
|
631
631
|
signed_in: 'Signed in successfully'
|
632
632
|
signed_out: 'Signed out successfully'
|
633
633
|
```
|
634
634
|
|
635
635
|
You can find the complete list of available keys in this file:
|
636
|
-
https://github.com/
|
636
|
+
https://github.com/Gokul595/api_guard/blob/master/config/locales/en.yml
|
637
637
|
|
638
638
|
## Testing
|
639
639
|
|
@@ -648,7 +648,7 @@ If you're using RSpec as your test framework then include the helper in **spec/r
|
|
648
648
|
|
649
649
|
```ruby
|
650
650
|
RSpec.configure do |config|
|
651
|
-
config.include
|
651
|
+
config.include ApiGuard::Test::ControllerHelper
|
652
652
|
end
|
653
653
|
```
|
654
654
|
|
@@ -657,7 +657,7 @@ end
|
|
657
657
|
If you're using Minitest as your test framework then include the helper in your test file
|
658
658
|
|
659
659
|
```ruby
|
660
|
-
include
|
660
|
+
include ApiGuard::Test::ControllerHelper
|
661
661
|
```
|
662
662
|
|
663
663
|
After including the helper, you can use this method to create the JWT access token and refresh token for the resource
|
@@ -680,7 +680,7 @@ Then, you can set the access token and refresh token in appropriate request head
|
|
680
680
|
|
681
681
|
## Contributing
|
682
682
|
|
683
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
683
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Gokul595/api_guard.
|
684
684
|
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
|
685
685
|
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
686
686
|
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ require 'rdoc/task'
|
|
10
10
|
|
11
11
|
RDoc::Task.new(:rdoc) do |rdoc|
|
12
12
|
rdoc.rdoc_dir = 'rdoc'
|
13
|
-
rdoc.title = '
|
13
|
+
rdoc.title = 'ApiGuard'
|
14
14
|
rdoc.options << '--line-numbers'
|
15
15
|
rdoc.rdoc_files.include('README.md')
|
16
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_dependency '
|
3
|
+
require_dependency 'api_guard/application_controller'
|
4
4
|
|
5
|
-
module
|
5
|
+
module ApiGuard
|
6
6
|
class AuthenticationController < ApplicationController
|
7
7
|
before_action :find_resource, only: [:create]
|
8
8
|
before_action :authenticate_resource, only: [:destroy]
|
@@ -10,22 +10,22 @@ module ApiGuardGrape
|
|
10
10
|
def create
|
11
11
|
if resource.authenticate(params[:password])
|
12
12
|
create_token_and_set_header(resource, resource_name)
|
13
|
-
render_success(message: I18n.t('
|
13
|
+
render_success(message: I18n.t('api_guard.authentication.signed_in'))
|
14
14
|
else
|
15
|
-
render_error(422, message: I18n.t('
|
15
|
+
render_error(422, message: I18n.t('api_guard.authentication.invalid_login_credentials'))
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def destroy
|
20
20
|
blacklist_token
|
21
|
-
render_success(message: I18n.t('
|
21
|
+
render_success(message: I18n.t('api_guard.authentication.signed_out'))
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def find_resource
|
27
27
|
self.resource = resource_class.find_by(email: params[:email].downcase.strip) if params[:email].present?
|
28
|
-
render_error(422, message: I18n.t('
|
28
|
+
render_error(422, message: I18n.t('api_guard.authentication.invalid_login_credentials')) unless resource
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_dependency '
|
3
|
+
require_dependency 'api_guard/application_controller'
|
4
4
|
|
5
|
-
module
|
5
|
+
module ApiGuard
|
6
6
|
class PasswordsController < ApplicationController
|
7
7
|
before_action :authenticate_resource, only: [:update]
|
8
8
|
|
@@ -10,11 +10,11 @@ module ApiGuardGrape
|
|
10
10
|
invalidate_old_jwt_tokens(current_resource)
|
11
11
|
|
12
12
|
if current_resource.update(password_params)
|
13
|
-
blacklist_token unless
|
13
|
+
blacklist_token unless ApiGuard.invalidate_old_tokens_on_password_change
|
14
14
|
destroy_all_refresh_tokens(current_resource)
|
15
15
|
|
16
16
|
create_token_and_set_header(current_resource, resource_name)
|
17
|
-
render_success(message: I18n.t('
|
17
|
+
render_success(message: I18n.t('api_guard.password.changed'))
|
18
18
|
else
|
19
19
|
render_error(422, object: current_resource)
|
20
20
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_dependency '
|
3
|
+
require_dependency 'api_guard/application_controller'
|
4
4
|
|
5
|
-
module
|
5
|
+
module ApiGuard
|
6
6
|
class RegistrationController < ApplicationController
|
7
7
|
before_action :authenticate_resource, only: [:destroy]
|
8
8
|
|
@@ -10,7 +10,7 @@ module ApiGuardGrape
|
|
10
10
|
init_resource(sign_up_params)
|
11
11
|
if resource.save
|
12
12
|
create_token_and_set_header(resource, resource_name)
|
13
|
-
render_success(message: I18n.t('
|
13
|
+
render_success(message: I18n.t('api_guard.registration.signed_up'))
|
14
14
|
else
|
15
15
|
render_error(422, object: resource)
|
16
16
|
end
|
@@ -18,7 +18,7 @@ module ApiGuardGrape
|
|
18
18
|
|
19
19
|
def destroy
|
20
20
|
current_resource.destroy
|
21
|
-
render_success(message: I18n.t('
|
21
|
+
render_success(message: I18n.t('api_guard.registration.account_deleted'))
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_dependency '
|
3
|
+
require_dependency 'api_guard/application_controller'
|
4
4
|
|
5
|
-
module
|
5
|
+
module ApiGuard
|
6
6
|
class TokensController < ApplicationController
|
7
7
|
before_action :authenticate_resource, only: [:create]
|
8
8
|
before_action :find_refresh_token, only: [:create]
|
@@ -11,9 +11,9 @@ module ApiGuardGrape
|
|
11
11
|
create_token_and_set_header(current_resource, resource_name)
|
12
12
|
|
13
13
|
@refresh_token.destroy
|
14
|
-
blacklist_token if
|
14
|
+
blacklist_token if ApiGuard.blacklist_token_after_refreshing
|
15
15
|
|
16
|
-
render_success(message: I18n.t('
|
16
|
+
render_success(message: I18n.t('api_guard.access_token.refreshed'))
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
@@ -23,9 +23,9 @@ module ApiGuardGrape
|
|
23
23
|
|
24
24
|
if refresh_token_from_header
|
25
25
|
@refresh_token = find_refresh_token_of(current_resource, refresh_token_from_header)
|
26
|
-
return render_error(401, message: I18n.t('
|
26
|
+
return render_error(401, message: I18n.t('api_guard.refresh_token.invalid')) unless @refresh_token
|
27
27
|
else
|
28
|
-
render_error(401, message: I18n.t('
|
28
|
+
render_error(401, message: I18n.t('api_guard.refresh_token.missing'))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/config/locales/en.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
require 'api_guard/engine'
|
4
|
+
require 'api_guard/route_mapper'
|
5
|
+
require 'api_guard/modules'
|
6
6
|
|
7
|
-
module
|
8
|
-
autoload :AppSecretKey, '
|
7
|
+
module ApiGuard
|
8
|
+
autoload :AppSecretKey, 'api_guard/app_secret_key'
|
9
9
|
|
10
10
|
module Test
|
11
|
-
autoload :ControllerHelper, '
|
11
|
+
autoload :ControllerHelper, 'api_guard/test/controller_helper'
|
12
12
|
end
|
13
13
|
|
14
14
|
mattr_accessor :token_validity
|
@@ -23,8 +23,8 @@ module ApiGuardGrape
|
|
23
23
|
mattr_accessor :blacklist_token_after_refreshing
|
24
24
|
self.blacklist_token_after_refreshing = false
|
25
25
|
|
26
|
-
mattr_accessor :
|
27
|
-
self.
|
26
|
+
mattr_accessor :api_guard_associations
|
27
|
+
self.api_guard_associations = {}
|
28
28
|
|
29
29
|
mattr_reader :mapped_resource do
|
30
30
|
{}
|
@@ -35,6 +35,6 @@ module ApiGuardGrape
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.map_resource(routes_for, class_name)
|
38
|
-
mapped_resource[routes_for.to_sym] =
|
38
|
+
mapped_resource[routes_for.to_sym] = ApiGuard::ResourceMapper.new(routes_for, class_name)
|
39
39
|
end
|
40
40
|
end
|