billingrails 0.2.0 → 0.2.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: 59e4d384a706ec067003e90ace439aaf4ff35590636afe6b1f1b6ebc7fe4933e
4
- data.tar.gz: d1ab7933b186d46c9df8ba048b2b331e8384ec2f8a08cfa3bd87919946e93fdf
3
+ metadata.gz: 9799e24f7f9e55633b5d63cf7e8869f4b00ad54d681c3440289945947d53c008
4
+ data.tar.gz: '00099c78db41d07a60d1c110ac069fcdfb9e90aa6b8cf4e9be9434a4189cd258'
5
5
  SHA512:
6
- metadata.gz: c4c25b6d11a168d8353d252fce17e083d7643f937f77a7c1322403182e5687e5c99aa7b57d3bf30fd6c7fab877071a7aa7723614368cb153a8c2e93ae1757dc8
7
- data.tar.gz: 7f8c10777419884ce6d5c37a83a265c24994da25e4fb4c5bc1d65d3a152fb8e71adc060a44830f844377a3fa1a19db9548c80c226b221d4cd337cef62380e5c9
6
+ metadata.gz: a642d974337f57e72415f7df51de826e73e0c4e7c8e57f86e60a44522bca38500e1fed97f469cd78365e22ff0c757313a25f43c8c9f3530adfcff3cd482e18fe
7
+ data.tar.gz: eff17708789b8e6ad2dbf661c106745f40d9321a28175556d0973014a0ab64ed3e39719a800bb16cabd6881a7e8b75da0288b4fea29a7e950d9a6620dd2d1c03
@@ -33,22 +33,21 @@ module Billingrails
33
33
 
34
34
  # Initialize top-level resources
35
35
  @accounts = Resources::Accounts.new(self)
36
- @invoices = Resources::Invoices.new(self)
36
+ @benefits = Resources::Benefits.new(self)
37
37
  @charges = Resources::Charges.new(self)
38
+ @checkout_sessions = Resources::CheckoutSessions.new(self)
39
+ @credit_assets = Resources::CreditAssets.new(self)
40
+ @credit_grants = Resources::CreditGrants.new(self)
41
+ @discounts = Resources::Discounts.new(self)
42
+ @events = Resources::Events.new(self)
43
+ @invoices = Resources::Invoices.new(self)
44
+ @meters = Resources::Meters.new(self)
38
45
  @payments = Resources::Payments.new(self)
39
46
  @payment_links = Resources::PaymentLinks.new(self)
40
- @checkout_sessions = Resources::CheckoutSessions.new(self)
41
-
42
- @products = Resources::Products.new(self)
43
- @prices = Resources::Prices.new(self)
44
47
  @plans = Resources::Plans.new(self)
48
+ @prices = Resources::Prices.new(self)
49
+ @products = Resources::Products.new(self)
45
50
  @subscriptions = Resources::Subscriptions.new(self)
46
- @meters = Resources::Meters.new(self)
47
- @events = Resources::Events.new(self)
48
-
49
- @credit_grants = Resources::CreditGrants.new(self)
50
- @credit_assets = Resources::CreditAssets.new(self)
51
- @discounts = Resources::Discounts.new(self)
52
51
  @tax_rates = Resources::TaxRates.new(self)
53
52
  end
54
53
 
@@ -59,7 +59,7 @@ module Billingrails
59
59
 
60
60
  # Get balances
61
61
  #
62
- # Retrieve credit balances for an account.
62
+ # Retrieves credit balances for an account.
63
63
  #
64
64
  # @param id [String] Resource ID
65
65
  # @param params [Hash, nil] Query parameters
@@ -77,10 +77,22 @@ module Billingrails
77
77
  # @param data [Hash] Request body
78
78
  # @return [Hash] Response data
79
79
  def debit_balance(id, data)
80
- path = "/accounts/#{id}/debit_balance"
80
+ path = "/accounts/#{id}/debit-balance"
81
81
  @client.request(:post, path, body: data)
82
82
  end
83
83
 
84
+ # Get entitlements
85
+ #
86
+ # Retrieves entitlements for an account grouped by benefit code.
87
+ #
88
+ # @param id [String] Resource ID
89
+ # @param params [Hash, nil] Query parameters
90
+ # @return [Hash] Response data
91
+ def get_entitlements(id, params: nil)
92
+ path = "/accounts/#{id}/entitlements"
93
+ @client.request(:get, path, params: params)
94
+ end
95
+
84
96
  end
85
97
  end
86
98
  end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated. Do not edit manually.
4
+
5
+ module Billingrails
6
+ module Resources
7
+ # Benefits resource
8
+ class Benefits
9
+ # @param client [Client] The API client
10
+ def initialize(client)
11
+ @client = client
12
+ end
13
+
14
+ # List benefits
15
+ #
16
+ # Retrieves a list of benefits.
17
+ #
18
+ # @param params [Hash, nil] Query parameters
19
+ # @return [Hash] Response data
20
+ def list(params: nil)
21
+ path = "/benefits"
22
+ @client.request(:get, path, params: params)
23
+ end
24
+
25
+ # Create a benefit
26
+ #
27
+ # Creates a benefit.
28
+ #
29
+ # @param data [Hash] Request body
30
+ # @return [Hash] Response data
31
+ def create(data)
32
+ path = "/benefits"
33
+ @client.request(:post, path, body: data)
34
+ end
35
+
36
+ # Retrieve a benefit
37
+ #
38
+ # Retrieves a benefit by ID.
39
+ #
40
+ # @param id [String] Resource ID
41
+ # @param params [Hash, nil] Query parameters
42
+ # @return [Hash] Response data
43
+ def retrieve(id, params: nil)
44
+ path = "/benefits/#{id}"
45
+ @client.request(:get, path, params: params)
46
+ end
47
+
48
+ # Update a benefit
49
+ #
50
+ # Updates a benefit.
51
+ #
52
+ # @param id [String] Resource ID
53
+ # @param data [Hash] Request body
54
+ # @return [Hash] Response data
55
+ def update(id, data)
56
+ path = "/benefits/#{id}"
57
+ @client.request(:patch, path, body: data)
58
+ end
59
+
60
+ # Delete a benefit
61
+ #
62
+ # Deletes a benefit by ID. Allowed only when the benefit is not assigned to any product, price or entitlements.
63
+ #
64
+ # @param id [String] Resource ID
65
+ # @return [Hash] Response data
66
+ def delete(id)
67
+ path = "/benefits/#{id}"
68
+ @client.request(:delete, path)
69
+ end
70
+
71
+ # Archive a benefit
72
+ #
73
+ # Archives a benefit.
74
+ #
75
+ # @param id [String] Resource ID
76
+ # @return [Hash] Response data
77
+ def archive(id)
78
+ path = "/benefits/#{id}/archive"
79
+ @client.request(:post, path)
80
+ end
81
+
82
+ # Unarchive a benefit
83
+ #
84
+ # Unarchives a benefit.
85
+ #
86
+ # @param id [String] Resource ID
87
+ # @return [Hash] Response data
88
+ def unarchive(id)
89
+ path = "/benefits/#{id}/unarchive"
90
+ @client.request(:post, path)
91
+ end
92
+
93
+ end
94
+ end
95
+ end
@@ -18,7 +18,7 @@ module Billingrails
18
18
  # @param data [Hash] Request body
19
19
  # @return [Hash] Response data
20
20
  def create(data)
21
- path = "/checkout_sessions"
21
+ path = "/checkout-sessions"
22
22
  @client.request(:post, path, body: data)
23
23
  end
24
24
 
@@ -30,7 +30,7 @@ module Billingrails
30
30
  # @param params [Hash, nil] Query parameters
31
31
  # @return [Hash] Response data
32
32
  def retrieve(id, params: nil)
33
- path = "/checkout_sessions/#{id}"
33
+ path = "/checkout-sessions/#{id}"
34
34
  @client.request(:get, path, params: params)
35
35
  end
36
36
 
@@ -42,7 +42,7 @@ module Billingrails
42
42
  # @param data [Hash] Request body
43
43
  # @return [Hash] Response data
44
44
  def update(id, data)
45
- path = "/checkout_sessions/#{id}"
45
+ path = "/checkout-sessions/#{id}"
46
46
  @client.request(:patch, path, body: data)
47
47
  end
48
48
 
@@ -18,7 +18,7 @@ module Billingrails
18
18
  # @param params [Hash, nil] Query parameters
19
19
  # @return [Hash] Response data
20
20
  def list(params: nil)
21
- path = "/credit_assets"
21
+ path = "/credit-assets"
22
22
  @client.request(:get, path, params: params)
23
23
  end
24
24
 
@@ -29,7 +29,7 @@ module Billingrails
29
29
  # @param data [Hash] Request body
30
30
  # @return [Hash] Response data
31
31
  def create(data)
32
- path = "/credit_assets"
32
+ path = "/credit-assets"
33
33
  @client.request(:post, path, body: data)
34
34
  end
35
35
 
@@ -41,7 +41,7 @@ module Billingrails
41
41
  # @param params [Hash, nil] Query parameters
42
42
  # @return [Hash] Response data
43
43
  def retrieve(id, params: nil)
44
- path = "/credit_assets/#{id}"
44
+ path = "/credit-assets/#{id}"
45
45
  @client.request(:get, path, params: params)
46
46
  end
47
47
 
@@ -53,7 +53,7 @@ module Billingrails
53
53
  # @param data [Hash] Request body
54
54
  # @return [Hash] Response data
55
55
  def update(id, data)
56
- path = "/credit_assets/#{id}"
56
+ path = "/credit-assets/#{id}"
57
57
  @client.request(:patch, path, body: data)
58
58
  end
59
59
 
@@ -17,7 +17,7 @@ module Billingrails
17
17
  #
18
18
  # @return [Hash] Response data
19
19
  def list()
20
- path = "/credit_grants"
20
+ path = "/credit-grants"
21
21
  @client.request(:get, path)
22
22
  end
23
23
 
@@ -28,7 +28,7 @@ module Billingrails
28
28
  # @param data [Hash] Request body
29
29
  # @return [Hash] Response data
30
30
  def create(data)
31
- path = "/credit_grants"
31
+ path = "/credit-grants"
32
32
  @client.request(:post, path, body: data)
33
33
  end
34
34
 
@@ -40,7 +40,7 @@ module Billingrails
40
40
  # @param params [Hash, nil] Query parameters
41
41
  # @return [Hash] Response data
42
42
  def retrieve(id, params: nil)
43
- path = "/credit_grants/#{id}"
43
+ path = "/credit-grants/#{id}"
44
44
  @client.request(:get, path, params: params)
45
45
  end
46
46
 
@@ -52,7 +52,7 @@ module Billingrails
52
52
  # @param data [Hash] Request body
53
53
  # @return [Hash] Response data
54
54
  def apply(id, data)
55
- path = "/credit_grants/#{id}/apply"
55
+ path = "/credit-grants/#{id}/apply"
56
56
  @client.request(:post, path, body: data)
57
57
  end
58
58
 
@@ -63,7 +63,7 @@ module Billingrails
63
63
  # @param id [String] Resource ID
64
64
  # @return [Hash] Response data
65
65
  def expire(id)
66
- path = "/credit_grants/#{id}/expire"
66
+ path = "/credit-grants/#{id}/expire"
67
67
  @client.request(:post, path)
68
68
  end
69
69
 
@@ -74,7 +74,7 @@ module Billingrails
74
74
  # @param id [String] Resource ID
75
75
  # @return [Hash] Response data
76
76
  def void(id)
77
- path = "/credit_grants/#{id}/void"
77
+ path = "/credit-grants/#{id}/void"
78
78
  @client.request(:post, path)
79
79
  end
80
80
 
@@ -86,7 +86,7 @@ module Billingrails
86
86
  # @param data [Hash] Request body
87
87
  # @return [Hash] Response data
88
88
  def reverse_transaction(id, data)
89
- path = "/credit_grants/#{id}/reverse_transaction"
89
+ path = "/credit-grants/#{id}/reverse-transaction"
90
90
  @client.request(:post, path, body: data)
91
91
  end
92
92
 
@@ -59,7 +59,7 @@ module Billingrails
59
59
 
60
60
  # Delete a meter
61
61
  #
62
- # Deletes a meter when no subscription uses a price associated with it.
62
+ # Deletes a meter. Allowed only when no price, benefit or subscription is associated with it.
63
63
  #
64
64
  # @param id [String] Resource ID
65
65
  # @return [Hash] Response data
@@ -18,7 +18,7 @@ module Billingrails
18
18
  # @param params [Hash, nil] Query parameters
19
19
  # @return [Hash] Response data
20
20
  def list(params: nil)
21
- path = "/payment_links"
21
+ path = "/payment-links"
22
22
  @client.request(:get, path, params: params)
23
23
  end
24
24
 
@@ -29,7 +29,7 @@ module Billingrails
29
29
  # @param data [Hash] Request body
30
30
  # @return [Hash] Response data
31
31
  def create(data)
32
- path = "/payment_links"
32
+ path = "/payment-links"
33
33
  @client.request(:post, path, body: data)
34
34
  end
35
35
 
@@ -41,7 +41,7 @@ module Billingrails
41
41
  # @param params [Hash, nil] Query parameters
42
42
  # @return [Hash] Response data
43
43
  def retrieve(id, params: nil)
44
- path = "/payment_links/#{id}"
44
+ path = "/payment-links/#{id}"
45
45
  @client.request(:get, path, params: params)
46
46
  end
47
47
 
@@ -53,7 +53,7 @@ module Billingrails
53
53
  # @param data [Hash] Request body
54
54
  # @return [Hash] Response data
55
55
  def update(id, data)
56
- path = "/payment_links/#{id}"
56
+ path = "/payment-links/#{id}"
57
57
  @client.request(:patch, path, body: data)
58
58
  end
59
59
 
@@ -59,7 +59,7 @@ module Billingrails
59
59
 
60
60
  # Delete a plan
61
61
  #
62
- # Deletes a plan.
62
+ # Deletes a plan. Allowed only when the plan has not been used in any subscription.
63
63
  #
64
64
  # @param id [String] Resource ID
65
65
  # @return [Hash] Response data
@@ -59,7 +59,7 @@ module Billingrails
59
59
 
60
60
  # Delete a price
61
61
  #
62
- # Deletes a price by ID.
62
+ # Deletes a price. Allowed only when it is not used in any subscription or invoices.
63
63
  #
64
64
  # @param id [String] Resource ID
65
65
  # @return [Hash] Response data
@@ -59,7 +59,7 @@ module Billingrails
59
59
 
60
60
  # Delete a product
61
61
  #
62
- # Deletes a product when it is not used in any subscription and not referenced on invoices.
62
+ # Deletes a product. Allowed only when it is not used in any subscription or invoices.
63
63
  #
64
64
  # @param id [String] Resource ID
65
65
  # @return [Hash] Response data
@@ -57,9 +57,33 @@ module Billingrails
57
57
  @client.request(:patch, path, body: data)
58
58
  end
59
59
 
60
+ # Cancel a subscription
61
+ #
62
+ # Cancels an active subscription.
63
+ #
64
+ # @param id [String] Resource ID
65
+ # @param data [Hash] Request body
66
+ # @return [Hash] Response data
67
+ def cancel(id, data)
68
+ path = "/subscriptions/#{id}/cancel"
69
+ @client.request(:post, path, body: data)
70
+ end
71
+
72
+ # Get entitlements
73
+ #
74
+ # Retrieves entitlements for a subscription grouped by benefit code.
75
+ #
76
+ # @param id [String] Resource ID
77
+ # @param params [Hash, nil] Query parameters
78
+ # @return [Hash] Response data
79
+ def get_entitlements(id, params: nil)
80
+ path = "/subscriptions/#{id}/entitlements"
81
+ @client.request(:get, path, params: params)
82
+ end
83
+
60
84
  # Resume a paused subscription
61
85
  #
62
- # Creates a subscription resumption checkout session, triggers payment, and returns the payment link. The subscription must be paused. Requires an active payment integration (site payment routes or an active integration). The customer is redirected to the payment link to pay the resumption invoice; after payment the subscription becomes active again.
86
+ # Creates a subscription resumption checkout session, triggers payment, and returns the payment link. The subscription must be paused. Requires an active payment integration (biller payment routes or an active integration). The customer is redirected to the payment link to pay the resumption invoice; after payment the subscription becomes active again.
63
87
  #
64
88
  # @param id [String] Resource ID
65
89
  # @param data [Hash] Request body
@@ -18,7 +18,7 @@ module Billingrails
18
18
  # @param params [Hash, nil] Query parameters
19
19
  # @return [Hash] Response data
20
20
  def list(params: nil)
21
- path = "/tax_rates"
21
+ path = "/tax-rates"
22
22
  @client.request(:get, path, params: params)
23
23
  end
24
24
 
@@ -29,7 +29,7 @@ module Billingrails
29
29
  # @param data [Hash] Request body
30
30
  # @return [Hash] Response data
31
31
  def create(data)
32
- path = "/tax_rates"
32
+ path = "/tax-rates"
33
33
  @client.request(:post, path, body: data)
34
34
  end
35
35
 
@@ -41,7 +41,7 @@ module Billingrails
41
41
  # @param params [Hash, nil] Query parameters
42
42
  # @return [Hash] Response data
43
43
  def retrieve(id, params: nil)
44
- path = "/tax_rates/#{id}"
44
+ path = "/tax-rates/#{id}"
45
45
  @client.request(:get, path, params: params)
46
46
  end
47
47
 
@@ -53,7 +53,7 @@ module Billingrails
53
53
  # @param data [Hash] Request body
54
54
  # @return [Hash] Response data
55
55
  def update(id, data)
56
- path = "/tax_rates/#{id}"
56
+ path = "/tax-rates/#{id}"
57
57
  @client.request(:patch, path, body: data)
58
58
  end
59
59
 
@@ -64,7 +64,7 @@ module Billingrails
64
64
  # @param id [String] Resource ID
65
65
  # @return [Hash] Response data
66
66
  def delete(id)
67
- path = "/tax_rates/#{id}"
67
+ path = "/tax-rates/#{id}"
68
68
  @client.request(:delete, path)
69
69
  end
70
70
 
@@ -75,7 +75,7 @@ module Billingrails
75
75
  # @param id [String] Resource ID
76
76
  # @return [Hash] Response data
77
77
  def archive(id)
78
- path = "/tax_rates/#{id}/archive"
78
+ path = "/tax-rates/#{id}/archive"
79
79
  @client.request(:post, path)
80
80
  end
81
81
 
@@ -86,7 +86,7 @@ module Billingrails
86
86
  # @param id [String] Resource ID
87
87
  # @return [Hash] Response data
88
88
  def unarchive(id)
89
- path = "/tax_rates/#{id}/unarchive"
89
+ path = "/tax-rates/#{id}/unarchive"
90
90
  @client.request(:post, path)
91
91
  end
92
92
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Billingrails
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.2'
5
5
  end
data/lib/billingrails.rb CHANGED
@@ -5,6 +5,7 @@ require_relative 'billingrails/errors'
5
5
  require_relative 'billingrails/client'
6
6
 
7
7
  require_relative 'billingrails/resources/accounts'
8
+ require_relative 'billingrails/resources/benefits'
8
9
  require_relative 'billingrails/resources/charges'
9
10
  require_relative 'billingrails/resources/credit_assets'
10
11
  require_relative 'billingrails/resources/checkout_sessions'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billingrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billingrails
@@ -80,6 +80,7 @@ files:
80
80
  - lib/billingrails/client.rb
81
81
  - lib/billingrails/errors.rb
82
82
  - lib/billingrails/resources/accounts.rb
83
+ - lib/billingrails/resources/benefits.rb
83
84
  - lib/billingrails/resources/charges.rb
84
85
  - lib/billingrails/resources/checkout_sessions.rb
85
86
  - lib/billingrails/resources/credit_assets.rb