omniauth-applicaster 1.3.1 → 1.3.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f704347222f07a39ad3eee27ac673a39a49088a5
|
4
|
+
data.tar.gz: edccf6d47d1e11c850bfb08c2bf4e7a2c441ed16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee0f5f9776bb3e5f8569f17cf2b94c4516a0799bffa32aabf15cdd50c237ca79aa49bc9608efba55379d5b9133c73aa759e4d534160e69be402746f7a71fa79b
|
7
|
+
data.tar.gz: e5825b4bb9ce32815f503f6d1f5e618dc2245a9595a510389ccbc207010f729ab5b4547bb4ca06eca4a9a9b88e2a83da3476d5044aadee57173d7e933ea79a00
|
@@ -7,12 +7,16 @@ module Applicaster
|
|
7
7
|
attribute :name, String
|
8
8
|
attribute :email, String
|
9
9
|
attribute :global_roles, Array[String]
|
10
|
-
attribute :permissions, Array
|
10
|
+
attribute :permissions, Array[Permission]
|
11
11
|
attribute :admin, Boolean
|
12
12
|
|
13
13
|
def admin?
|
14
14
|
!!admin
|
15
15
|
end
|
16
|
+
|
17
|
+
def permission_for_account_id(account_id)
|
18
|
+
permissions.find { |p| p.account_id == account_id }
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
data/lib/applicaster/accounts.rb
CHANGED
@@ -5,8 +5,9 @@ require "virtus"
|
|
5
5
|
module Applicaster
|
6
6
|
class Accounts
|
7
7
|
autoload :Account, "applicaster/accounts/account"
|
8
|
-
autoload :User, "applicaster/accounts/user"
|
9
8
|
autoload :Configuration, "applicaster/accounts/configuration"
|
9
|
+
autoload :Permission, "applicaster/accounts/permission"
|
10
|
+
autoload :User, "applicaster/accounts/user"
|
10
11
|
|
11
12
|
RETRYABLE_STATUS_CODES = [500, 503, 502]
|
12
13
|
|
@@ -52,7 +53,7 @@ module Applicaster
|
|
52
53
|
.body
|
53
54
|
)
|
54
55
|
rescue Faraday::ClientError => e
|
55
|
-
if e.response[:status] == 401
|
56
|
+
if e.response && e.response[:status] == 401
|
56
57
|
nil
|
57
58
|
else
|
58
59
|
raise
|
@@ -90,6 +90,20 @@ RSpec.describe Applicaster::Accounts do
|
|
90
90
|
expect(return_value).to be nil
|
91
91
|
end
|
92
92
|
end
|
93
|
+
|
94
|
+
context "when request times out" do
|
95
|
+
before do
|
96
|
+
stub_request(:get, "https://#{accounts_host}/api/v1/users/current.json")
|
97
|
+
.with(query: { access_token: "valid-access-token" })
|
98
|
+
.to_timeout
|
99
|
+
end
|
100
|
+
|
101
|
+
it "raises Faraday::TimeoutError" do
|
102
|
+
expect {
|
103
|
+
Applicaster::Accounts.user_from_token("valid-access-token")
|
104
|
+
}.to raise_error(Faraday::TimeoutError)
|
105
|
+
end
|
106
|
+
end
|
93
107
|
end
|
94
108
|
|
95
109
|
describe ".accounts_from_token" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-applicaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neer Friedman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/applicaster/accounts.rb
|
139
139
|
- lib/applicaster/accounts/account.rb
|
140
140
|
- lib/applicaster/accounts/configuration.rb
|
141
|
+
- lib/applicaster/accounts/permission.rb
|
141
142
|
- lib/applicaster/accounts/user.rb
|
142
143
|
- lib/applicaster/auth_helpers.rb
|
143
144
|
- lib/applicaster/sessions_controller_mixin.rb
|