tribune_recurly_api 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58af8cbf779fe4fd7123c8721b9047742bfe3c5cf65e198d684cb1db47e69948
|
4
|
+
data.tar.gz: 5fc8b5e12bf3875fb0804c2832a13ed540680ac0c8c8a8be1c2414889155ff9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b446b40811f68202554293ad18450eb81da9e36ce9e3a5a5f0282cb39bb8303f79c62766edb3a7e491c77567bc9c7e2665a8f07ad127b1a8a34effb8cf137ece
|
7
|
+
data.tar.gz: 461e45b651ffe4b3d8b31ba6d8d25b21f12b13ea2686316ad2925b5b16e60829604dc30ffc12c60c575c56e5ace61d5f07db2310001957700523a0a8b7e82a9c
|
@@ -5,18 +5,18 @@ module RecurlyApi
|
|
5
5
|
class Client
|
6
6
|
# Fetch Account Info--
|
7
7
|
# { https://developers.recurly.com/api/v2021-02-25/index.html#operation/get_account }
|
8
|
-
# @param ssor_id [String]
|
9
|
-
#
|
8
|
+
# @param ssor_id [String], Recurly Account Code(i.e SsorID)
|
9
|
+
# - The unique identifier of the Recurly account
|
10
10
|
def account_info(ssor_id:, **optional_params)
|
11
|
-
request_api(path_name: "accounts
|
11
|
+
request_api(path_name: "accounts/code-#{ssor_id}", **optional_params) # cache_key_name: cache_key_name
|
12
12
|
end
|
13
13
|
|
14
14
|
# Deactivate account ---
|
15
15
|
# { https://developers.recurly.com/api/v2021-02-25/index.html#operation/deactivate_account }
|
16
|
-
# @param ssor_id [String]
|
17
|
-
#
|
16
|
+
# @param ssor_id [String], Recurly Account Code(i.e SsorID)
|
17
|
+
# - The unique identifier of the Recurly account
|
18
18
|
def deactivate_account(ssor_id:)
|
19
|
-
path = "accounts
|
19
|
+
path = "accounts/code-#{ssor_id}"
|
20
20
|
request_api(path_name: path, http_method: :delete)
|
21
21
|
end
|
22
22
|
end
|
@@ -8,7 +8,7 @@ module RecurlyApi
|
|
8
8
|
# @param ssor_id [String] Recurly Account ID(SsorID) or code.
|
9
9
|
# For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
10
10
|
def coupon_redemptions(ssor_id:, **optional_params)
|
11
|
-
request_api(path_name: "accounts
|
11
|
+
request_api(path_name: "accounts/code-#{ssor_id}/coupon_redemptions", **optional_params)
|
12
12
|
end
|
13
13
|
|
14
14
|
# Other request any.....
|
@@ -5,12 +5,11 @@ module RecurlyApi
|
|
5
5
|
class Client
|
6
6
|
# Fetch Account Subscriptions ---
|
7
7
|
# { https://developers.recurly.com/api/v2021-02-25/index.html#operation/list_account_subscriptions }
|
8
|
-
# @param ssor_id [String] Account
|
9
|
-
#
|
10
|
-
#
|
11
|
-
# for other params ref documentation
|
8
|
+
# @param ssor_id [String], Recurly Account Code(i.e SsorID)
|
9
|
+
# - The unique identifier of the Recurly account
|
10
|
+
# for other params refer documentation
|
12
11
|
def account_subscriptions(ssor_id:, recurly_query_params: {}, **optional_params)
|
13
|
-
path = "accounts
|
12
|
+
path = "accounts/code-#{ssor_id}/subscriptions"
|
14
13
|
self.cache_expires_in = optional_params[:cache_expires_in] || cache_settings[:subscription_expiry] unless bypass_caching?
|
15
14
|
request_api(path_name: path, query_params: recurly_query_params, **optional_params) # cache_key_name: cache_key_name
|
16
15
|
end
|
@@ -19,17 +18,19 @@ module RecurlyApi
|
|
19
18
|
# Checking if user has a subscription for particular plan by its code
|
20
19
|
# ---------------
|
21
20
|
# @param ssor_id [String] required, Recurly Account Code(i.e SsorID)
|
21
|
+
# - The unique identifier of the Recurly account
|
22
22
|
# @param plan_code [String] optional,
|
23
23
|
# - if present then checks if user has subscription for that particular plan by its code
|
24
24
|
# Usage ex:
|
25
25
|
# client.check_user_subscription(ssor_id: '4900-0272-6875', plan_code: '000150d03d')
|
26
|
-
# response => { :success=>true, :
|
26
|
+
# response => { :success=>true, :status_code=>200, :has_subscription=>true }
|
27
27
|
def check_user_subscription(ssor_id:, plan_code: nil)
|
28
|
-
|
28
|
+
query_params = { limit: 2 }
|
29
|
+
resp = account_subscriptions(ssor_id: ssor_id, recurly_query_params: query_params)
|
29
30
|
if resp[:success]
|
30
31
|
has_subscription = false
|
31
|
-
subs = resp[:data]
|
32
|
-
has_subscription = true if subs
|
32
|
+
subs = resp[:payload]['data']
|
33
|
+
has_subscription = true if subs&.any?
|
33
34
|
if plan_code
|
34
35
|
sub = subs.detect { |s| s['plan']['code'].eql?(plan_code) }
|
35
36
|
has_subscription = sub ? true : false
|
data/lib/recurly_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tribune_recurly_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- udevulapally
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|