porteiro 0.0.1 → 0.0.2

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: 2796cb24e22ccb1603b16a55eb06b41f6fb6d061
4
- data.tar.gz: 657fdc47611b5326edb73df3663f8e929545d5c4
3
+ metadata.gz: b77cc84a577a1df25f973f6bda15683bf29cbe12
4
+ data.tar.gz: cacbfc99a998376384e8d0a11576db479c7eee30
5
5
  SHA512:
6
- metadata.gz: 0cfb3c97c0590a2794d446a56d820615f41e2f0b63e9b79e19cec509472483dcb131b713b5cd5405452661d53ff6f756a7e8db97a4d7d849b405d070ba01be49
7
- data.tar.gz: 62d2e6868c0d5c9684c8107ad8eea4c059936f7061dd1577d7a4489156ae9937a33b04cf004215e0422bcdb648f39840a67ad303e0ef052b4f70d4a852f6c931
6
+ metadata.gz: 7fe16b33a0880c7fc182a15e2a1b71cbfdd048d59264b1142c18a729054fce5c93aa4ab5cc05fcfbec8b6a21ada45dc143580c13e3125c219afd35185c9d8195
7
+ data.tar.gz: c7243128339a02a3e2a491f4c9eeb59eff5bfd543927c6269d2adaf214eb039f0ccbf8d2856e5fdfe6916914b65f8fcafddb44bcf2a8b4d691a77b00290f9517
data/lib/porteiro/base.rb CHANGED
@@ -6,11 +6,6 @@ module Porteiro
6
6
  @params = params
7
7
  end
8
8
  attr_reader :user, :params
9
-
10
- def authorize_action!
11
- controller_action = params.fetch(:action)
12
- self.send("#{controller_action}?") ? true : (raise NotAuthorizedError, "You aren't permitted to access this resource")
13
- end
14
-
9
+
15
10
  end
16
11
  end
@@ -1,3 +1,3 @@
1
1
  module Porteiro
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/porteiro.rb CHANGED
@@ -40,7 +40,9 @@ module Porteiro
40
40
  ##
41
41
 
42
42
  def authorize_user_access!
43
- policy.authorize_action!
43
+ policy_obj = policy
44
+ controller_action = policy_obj.params.fetch(:action)
45
+ policy_obj.send("#{controller_action}?") ? true : (raise NotAuthorizedError, "You aren't permitted to access this resource")
44
46
  end
45
47
 
46
48
  def policy
@@ -99,11 +99,6 @@ describe Porteiro do
99
99
  expect(policy.params).to eq controller.params
100
100
  end
101
101
 
102
- it "#authorize_action!" do
103
- policy = Porteiro::PolicyFinder.new(controller.current_user, controller.params).find!
104
- expect(policy.authorize_action!).to eq true
105
- end
106
-
107
102
  end
108
103
 
109
104
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: porteiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bradwheel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-01 00:00:00.000000000 Z
11
+ date: 2014-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport