monza 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 +4 -4
- data/README.md +3 -0
- data/lib/monza/verification_response.rb +11 -1
- data/lib/monza/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: 2333e5c5c78dc623cd42815e38543cbd1828329f
|
4
|
+
data.tar.gz: d826c632a53edefd2308f5f25ff56212d98a86ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5c679b821e72871737c806c631e43b70c319e5d9c94c816bafb8bd13887a528a63e855a48d0c2632ce3ea8264fe7025fdb5430d6ea7a22a3fdbdeffe0a6e324
|
7
|
+
data.tar.gz: ee0401f99b07f3b9081042caddc544161e59e45365d2fa5216f0e44e3daeb56845057bce6f44974f922c2c6e8580d428ee093650c7b63908305ad753550155b0
|
data/README.md
CHANGED
@@ -46,6 +46,9 @@ response.is_subscription_active? # => true or false
|
|
46
46
|
# this is helpful in case the most recent transaction was cancelled but the user still has a previous transaction or subscription that is active
|
47
47
|
response.is_any_subscription_active? # => true or false
|
48
48
|
|
49
|
+
# Returns the active subscription TransactionReceipt or nil
|
50
|
+
response.latest_active_transaction_receipt # => TransactionReceipt instance
|
51
|
+
|
49
52
|
# Check most recent expiry date
|
50
53
|
# ActiveSupport::TimeWithZone
|
51
54
|
response.latest_expiry_date # => Fri, 17 Jun 2016 01:57:28 UTC +00:00
|
@@ -43,7 +43,7 @@ module Monza
|
|
43
43
|
false
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def is_any_subscription_active?
|
48
48
|
expires_dates_ms = @latest_receipt_info.map(&:expires_date_ms)
|
49
49
|
latest_expires_date_ms = expires_dates_ms.max
|
@@ -55,6 +55,16 @@ module Monza
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
def latest_active_transaction_receipt
|
59
|
+
latest_active_sub = @latest_receipt_info.sort_by(&:expires_date_ms).last
|
60
|
+
|
61
|
+
if latest_active_sub && latest_active_sub.expires_date_ms >= Time.zone.now
|
62
|
+
return latest_active_sub
|
63
|
+
else
|
64
|
+
return nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
58
68
|
def latest_expiry_date
|
59
69
|
@latest_receipt_info.last.expires_date_ms if @latest_receipt_info.last
|
60
70
|
end
|
data/lib/monza/version.rb
CHANGED