wbase 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/wbase/userable.rb +21 -0
- data/lib/wbase/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb9f056a6da7569e3adf30aefac1cdf8e68051c5
|
4
|
+
data.tar.gz: c4d011c233e994576d44479a8efcc935e4dfb8c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cebc3d627140fb1ab16c8d94d71a083979059430ad0ec4675e362c07ba2639b0b00ffb7699ac0ed3bacb8a61e195a6da827dfd68905097465cb726f1c0aba67
|
7
|
+
data.tar.gz: c5a7531e7c040fc97190fba42766b436b6dcf6113ecb9db48d3f855df76dfb27027ec6c4cdecceb53ad0689ed8f4da1781bd59401031274e5dc03c690c1c9af5
|
@@ -9,6 +9,7 @@ module Wbase
|
|
9
9
|
validates :email, presence: true, uniqueness: true
|
10
10
|
validates :password, length: { minimum: 7, allow_nil: true }
|
11
11
|
has_one :subscription, class_name: 'Wbase::Subscription'
|
12
|
+
scope :verified, -> { where(verified: true) }
|
12
13
|
|
13
14
|
before_validation(on: :create) do
|
14
15
|
self.session_token ||= SecureRandom.hex
|
@@ -23,6 +24,26 @@ module Wbase
|
|
23
24
|
user
|
24
25
|
end
|
25
26
|
end
|
27
|
+
|
28
|
+
def active
|
29
|
+
verified.where(
|
30
|
+
'(id in (?) OR created_at > ?)',
|
31
|
+
Wbase::Subscription.current.pluck(:user_id),
|
32
|
+
14.days.ago
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def trialing
|
37
|
+
verified.where('created_at > ?', 14.days.ago)
|
38
|
+
end
|
39
|
+
|
40
|
+
def trial_expired
|
41
|
+
verified.where(
|
42
|
+
'created_at <= ? AND id not in (?)',
|
43
|
+
14.days.ago,
|
44
|
+
Wbase::Subscription.current.pluck(:user_id)
|
45
|
+
)
|
46
|
+
end
|
26
47
|
end
|
27
48
|
|
28
49
|
def status
|
data/lib/wbase/version.rb
CHANGED