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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97bc7941a0f62a48ec62f39d74f6cf7eef095791
4
- data.tar.gz: 44810f722383e6df294bf660b15982a5a986634d
3
+ metadata.gz: eb9f056a6da7569e3adf30aefac1cdf8e68051c5
4
+ data.tar.gz: c4d011c233e994576d44479a8efcc935e4dfb8c3
5
5
  SHA512:
6
- metadata.gz: f6a0173bf9a1a02c9cc04ed835889e2b002744c8fa735aa15e38366f1a8eda1f640bc17272efc9b0222377814a3ce59135a64ee3c1f1ef2c3f0e1d87b5990208
7
- data.tar.gz: cefb0aaaf550be8903cf70cdb5dda455fa115dfc996d72a8689879903cf3a275843292f5d7f1404e4df35e56b5b10b01fc155b2f984529a00c68ef26df93f4e4
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
@@ -1,3 +1,3 @@
1
1
  module Wbase
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - CJ Avilla