active_record_api-rest 1.0.25 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d239ea4b885b7a23cd1a6aceea8fb4983f7d7b88479073cefbdc54b1e1936009
4
- data.tar.gz: dd3fe58ff56e744f0f0ea03734fa7809aee7166549f9a2e7eab4824e0b59d0ae
3
+ metadata.gz: 30207d6586cff266c4f9979030c85bfe9b5e60cb6b4eb1ce9272168e9fe4f74e
4
+ data.tar.gz: b632b903fdfb6dd151c9c0859ddec560a00c467a375d317a73d2f1501f2c3a0e
5
5
  SHA512:
6
- metadata.gz: 7566a3dc5f4639f865481eb01cfc0e55f27cba747da59a3e90ffa8b2b7506cab3bf65e86e2350d0de384c45fee30a06d510f150f3224ed8d5b50b45a07f3c058
7
- data.tar.gz: 74cb70373030a512359dae3bc7c3430566161d17d0d225e42c365a9e1414058785808a8472990dab0064f3fc938fe0dc76d94551185e5fa0c904522f419c8df5
6
+ metadata.gz: 2bb9d74de180ef38de876dceb371e60ed08ea0bcb1d0ddeb92fc4fe4bb0363ccbee5ee82fc8611b6ffe708d5b263f59a71d958496927939b9ab6ac3979fce8b4
7
+ data.tar.gz: bba1e427407944eb1e10c3521f5f61d9ce669c5741a4a492ee0b37c819c89dac918c1191f4ac32e037819c78dadf445696373bf6d9647d0097b77431dbcaf66e
@@ -16,15 +16,15 @@ module ActiveRecordApi
16
16
  end
17
17
 
18
18
  def can?
19
- @can ||= scope.can?
19
+ @can ||= policy.can?
20
20
  end
21
21
 
22
22
  def authorized_models
23
- @authorized_models ||= scope.authorized_models
23
+ @authorized_models ||= policy.authorized_models
24
24
  end
25
25
 
26
- def scope
27
- @scope ||= scope_klass.new(
26
+ def policy
27
+ @policy ||= policy_klass.new(
28
28
  session: session,
29
29
  model_klass: model_klass,
30
30
  action_name: action_name,
@@ -34,8 +34,8 @@ module ActiveRecordApi
34
34
  )
35
35
  end
36
36
 
37
- def scope_klass
38
- "#{self.class.name.remove(/Controller$/)}Scope".safe_constantize || Scope
37
+ def policy_klass
38
+ "#{self.class.name.remove(/Controller$/)}Policy".safe_constantize || Policy
39
39
  end
40
40
  end
41
41
  end
@@ -1,7 +1,7 @@
1
1
  module ActiveRecordApi
2
2
  module Rest
3
3
  module Auth
4
- class Scope
4
+ class Policy
5
5
  include ActiveAttr::Model
6
6
  attr_accessor :session, :model_klass, :action_name, :modifiable_params, :queryable_params
7
7
 
@@ -10,7 +10,7 @@ module ActiveRecordApi
10
10
  end
11
11
 
12
12
  def can?
13
- send("#{action_name}?")
13
+ send("can_#{action_name}?")
14
14
  end
15
15
 
16
16
  def can_manage?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecordApi
4
4
  module Rest
5
- VERSION = '1.0.25'.freeze
5
+ VERSION = '1.0.26'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_api-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.25
4
+ version: 1.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Full Measure Education
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2019-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,7 +147,7 @@ files:
147
147
  - lib/active_record_api/rest/auth/access_denied_exception.rb
148
148
  - lib/active_record_api/rest/auth/bad_session_exception.rb
149
149
  - lib/active_record_api/rest/auth/controller.rb
150
- - lib/active_record_api/rest/auth/scope.rb
150
+ - lib/active_record_api/rest/auth/policy.rb
151
151
  - lib/active_record_api/rest/controller.rb
152
152
  - lib/active_record_api/rest/graceful_errors.rb
153
153
  - lib/active_record_api/rest/parameters.rb