aptible-rails 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aptible/rails/controller.rb +24 -1
- data/lib/aptible/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bedece438efef08d383ca8934a4ac8b5eba9c9a
|
4
|
+
data.tar.gz: de3005acca106a6367146199741f2a54ef9e1a97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b49e260842abce4b9f72c785258a77d601c75136b5f97cd041454dffdb7edbbba301b54f4974d9f7a53243b4ec86760219252f8286cab72d6c874cf5f6916d
|
7
|
+
data.tar.gz: 3f84c5b183c18e6265eb22b36f27e9510080da55bf034fd6ead6181563144eab8b90a9a212623de26bece3d1dfb72efec148a057d74f68c332048e4807aeaa79
|
@@ -8,7 +8,9 @@ module Aptible
|
|
8
8
|
|
9
9
|
included do
|
10
10
|
helper_method :auth, :api, :current_aptible_user,
|
11
|
-
:current_organization
|
11
|
+
:current_organization, :subscribed?,
|
12
|
+
:has_acccount?, :email_verified?,
|
13
|
+
:subscribed_and_verified?
|
12
14
|
end
|
13
15
|
|
14
16
|
def auth
|
@@ -29,6 +31,27 @@ module Aptible
|
|
29
31
|
session[:organization_url] ||= auth.organizations.first.href
|
30
32
|
url = [session[:organization_url], token: service_token]
|
31
33
|
@current_organization ||= Aptible::Auth::Organization.find_by_url(*url)
|
34
|
+
rescue
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
# rubocop:disable PredicateName
|
39
|
+
def has_account?
|
40
|
+
current_organization && current_organization.accounts.any?
|
41
|
+
end
|
42
|
+
# rubocop:enable PredicateName
|
43
|
+
|
44
|
+
def subscribed?
|
45
|
+
@has_subscription ||= has_account? &&
|
46
|
+
current_organization.accounts.any?(&:has_subscription?)
|
47
|
+
end
|
48
|
+
|
49
|
+
def email_verified?
|
50
|
+
current_aptible_user && current_aptible_user.verified?
|
51
|
+
end
|
52
|
+
|
53
|
+
def subscribed_and_verified?
|
54
|
+
has_account? && subscribed? && email_verified?
|
32
55
|
end
|
33
56
|
|
34
57
|
def service_token
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|