billingrails 0.1.3 → 0.1.5

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: 0afc8782d1a0cb29269523d547085dc3be039a06a01799f02fb45da80f7955ad
4
- data.tar.gz: 0c6137d1ef84e8b8c2bd6af4f620070412e9779a11a08483477e240a8df8c6bd
3
+ metadata.gz: 7a5b67a14d5de893e9a3ee00b839d59c99661274987a60d80daf906962ad45a6
4
+ data.tar.gz: 698cd398f19a126ba47bc1f045d36baf17d8e60968c4cbd6c0cdd35f82605115
5
5
  SHA512:
6
- metadata.gz: e3b8d82e571b1518e748ac67f96dd383769eb0a623049bb1af01c49a3c47fb1e17bac4a682c60fbce317ac1b920cccf0acd015c9e130349b050f965a64a62ef8
7
- data.tar.gz: c8024c193dd04c62c2916ebdba05aae826e38515d6b14e0b9080baf2435bed065921867868fcbb483e1a56df1d8724f01c2ba11491df87ab177d121c08d926fd
6
+ metadata.gz: d60ec418d12ada5c355e3fc1e5a121f38458ab9ba5ca727cfb333a215f6e5b98267c7fdc53eb9180fb71cfee600411611349b4975108c1c47e2cd2692ea0ebf9
7
+ data.tar.gz: 5ec2da2339853212f4ca5ffc504fe6b7d3861344a196cb79ebc682da86ca3a2c4cf5342da3797b6f9874bcc30a900d0fa110485cfaaff690fa1704352f06b326
data/CHANGELOG.md CHANGED
@@ -12,5 +12,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
  - Complete API client with authentication
13
13
  - Resource-based API structure
14
14
  - Comprehensive error handling
15
- - Retry logic with exponential backoff
16
- - Full test coverage
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/billingrails.svg)](https://rubygems.org/gems/billingrails)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Official Ruby SDK for the [Billingrails](https://billingrails.com) API - Flexible, composable, and intuitive API-first commerce platform.
6
+ Official Ruby SDK for the [Billingrails](https://billingrails.com) API
7
7
 
8
8
  ## Installation
9
9
 
@@ -101,14 +101,6 @@ client = Billingrails::Client.new(
101
101
  )
102
102
  ```
103
103
 
104
- ## Development
105
-
106
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
107
-
108
- ## Contributing
109
-
110
- Bug reports and pull requests are welcome on GitHub at https://github.com/billingrails/billingrails-ruby.
111
-
112
104
  ## License
113
105
 
114
106
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -31,14 +31,15 @@ module Billingrails
31
31
  @invoices = Resources::Invoices.new(self)
32
32
  @payments = Resources::Payments.new(self)
33
33
  @payment_pages = Resources::PaymentLinks.new(self)
34
- @checkout_sessions = Resources::CheckoutSessions.new(client)
34
+ @checkout_sessions = Resources::CheckoutSessions.new(self)
35
35
 
36
- @subscriptions = Resources::Subscriptions.new(client)
37
- @plans = Resources::Plans.new(client)
36
+ @subscriptions = Resources::Subscriptions.new(self)
37
+ @products = Resources::Products.new(self)
38
38
  @fees = Resources::Fees.new(self)
39
- @prices = Resources::Prices.new(client)
40
- @events = Resources::Events.new(client)
41
- @meters = Resources::Meters.new(client)
39
+ @prices = Resources::Prices.new(self)
40
+ @offerings = Resources::Offerings.new(self)
41
+ @events = Resources::Events.new(self)
42
+ @meters = Resources::Meters.new(self)
42
43
 
43
44
  @credit_grants = Resources::CreditGrants.new(self)
44
45
  @discounts = Resources::Discounts.new(self)
@@ -84,7 +84,7 @@ module Billingrails
84
84
  #
85
85
  # @param id [String] Resource ID
86
86
  # @return [Hash] Response data
87
- def undo_archive(id)
87
+ def unarchive(id)
88
88
  path = "/fees/#{id}/unarchive"
89
89
  @client.request(:post, path)
90
90
  end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated. Do not edit manually.
4
+
5
+ module Billingrails
6
+ module Resources
7
+ # Offerings resource
8
+ class Offerings
9
+ # @param client [Client] The API client
10
+ def initialize(client)
11
+ @client = client
12
+ end
13
+
14
+ # List offerings
15
+ #
16
+ # Retrieves a list of offerings.
17
+ #
18
+ # @param params [Hash, nil] Query parameters
19
+ # @return [Hash] Response data
20
+ def list(params: nil)
21
+ path = "/offerings"
22
+ @client.request(:get, path, params: params)
23
+ end
24
+
25
+ # Create an offering
26
+ #
27
+ # Creates an offering with optional items (products/fees and prices).
28
+ #
29
+ # @param data [Hash] Request body
30
+ # @return [Hash] Response data
31
+ def create(data)
32
+ path = "/offerings"
33
+ @client.request(:post, path, body: data)
34
+ end
35
+
36
+ # Retrieve an offering
37
+ #
38
+ # Retrieves an offering 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 = "/offerings/#{id}"
45
+ @client.request(:get, path, params: params)
46
+ end
47
+
48
+ # Update an offering
49
+ #
50
+ # Updates an offering (name, description, trial_period_days, items). Fails if the offering is used by any subscription.
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 = "/offerings/#{id}"
57
+ @client.request(:put, path, body: data)
58
+ end
59
+
60
+ # Delete an offering
61
+ #
62
+ # Soft-deletes an offering. Fails if the offering is used by any subscription.
63
+ #
64
+ # @param id [String] Resource ID
65
+ # @return [Hash] Response data
66
+ def delete(id)
67
+ path = "/offerings/#{id}"
68
+ @client.request(:delete, path)
69
+ end
70
+
71
+ # Archive an offering
72
+ #
73
+ # Archives an offering. Fails if the offering is used by any subscription.
74
+ #
75
+ # @param id [String] Resource ID
76
+ # @return [Hash] Response data
77
+ def archive(id)
78
+ path = "/offerings/#{id}/archive"
79
+ @client.request(:post, path)
80
+ end
81
+
82
+ # Unarchive an offering
83
+ #
84
+ # Restores an archived offering to active status.
85
+ #
86
+ # @param id [String] Resource ID
87
+ # @return [Hash] Response data
88
+ def unarchive(id)
89
+ path = "/offerings/#{id}/unarchive"
90
+ @client.request(:post, path)
91
+ end
92
+
93
+ # Duplicate an offering
94
+ #
95
+ # Creates a new offering with the same attributes and items. The new offering's origin_id is set to the source offering.
96
+ #
97
+ # @param id [String] Resource ID
98
+ # @return [Hash] Response data
99
+ def duplicate(id)
100
+ path = "/offerings/#{id}/duplicate"
101
+ @client.request(:post, path)
102
+ end
103
+
104
+ end
105
+ end
106
+ end
@@ -74,7 +74,7 @@ module Billingrails
74
74
  #
75
75
  # @param id [String] Resource ID
76
76
  # @return [Hash] Response data
77
- def undo_archive(id)
77
+ def unarchive(id)
78
78
  path = "/prices/#{id}/unarchive"
79
79
  @client.request(:post, path)
80
80
  end
@@ -4,59 +4,81 @@
4
4
 
5
5
  module Billingrails
6
6
  module Resources
7
- # Plans resource
8
- class Plans
7
+ # Products resource
8
+ class Products
9
9
  # @param client [Client] The API client
10
10
  def initialize(client)
11
11
  @client = client
12
12
  end
13
13
 
14
- # List plans
14
+ # List products
15
15
  #
16
- # Retrieves a list of plans.
16
+ # Retrieves a list of products.
17
17
  #
18
18
  # @param params [Hash, nil] Query parameters
19
19
  # @return [Hash] Response data
20
20
  def list(params: nil)
21
- path = "/plans"
21
+ path = "/products"
22
22
  @client.request(:get, path, params: params)
23
23
  end
24
24
 
25
- # Create a plan
25
+ # Create a product
26
26
  #
27
- # Creates a plan.
27
+ # Creates a product.
28
28
  #
29
29
  # @param data [Hash] Request body
30
30
  # @return [Hash] Response data
31
31
  def create(data)
32
- path = "/plans"
32
+ path = "/products"
33
33
  @client.request(:post, path, body: data)
34
34
  end
35
35
 
36
- # Retrieve a plan
36
+ # Retrieve a product
37
37
  #
38
- # Retrieves plan by ID.
38
+ # Retrieves product by ID.
39
39
  #
40
40
  # @param id [String] Resource ID
41
41
  # @param params [Hash, nil] Query parameters
42
42
  # @return [Hash] Response data
43
43
  def retrieve(id, params: nil)
44
- path = "/plans/#{id}"
44
+ path = "/products/#{id}"
45
45
  @client.request(:get, path, params: params)
46
46
  end
47
47
 
48
- # Update a plan
48
+ # Update a product
49
49
  #
50
- # Updates a plan.
50
+ # Updates a product.
51
51
  #
52
52
  # @param id [String] Resource ID
53
53
  # @param data [Hash] Request body
54
54
  # @return [Hash] Response data
55
55
  def update(id, data)
56
- path = "/plans/#{id}"
56
+ path = "/products/#{id}"
57
57
  @client.request(:put, path, body: data)
58
58
  end
59
59
 
60
+ # Archive a product
61
+ #
62
+ # Archives a product, making it inactive for new subscriptions.
63
+ #
64
+ # @param id [String] Resource ID
65
+ # @return [Hash] Response data
66
+ def archive(id)
67
+ path = "/products/#{id}/archive"
68
+ @client.request(:post, path)
69
+ end
70
+
71
+ # Unarchive a product
72
+ #
73
+ # Restores an archived product to active status.
74
+ #
75
+ # @param id [String] Resource ID
76
+ # @return [Hash] Response data
77
+ def unarchive(id)
78
+ path = "/products/#{id}/unarchive"
79
+ @client.request(:post, path)
80
+ end
81
+
60
82
  end
61
83
  end
62
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Billingrails
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.5'
5
5
  end
data/lib/billingrails.rb CHANGED
@@ -10,8 +10,9 @@ require_relative 'billingrails/resources/accounts'
10
10
  require_relative 'billingrails/resources/checkout_sessions'
11
11
  require_relative 'billingrails/resources/events'
12
12
  require_relative 'billingrails/resources/fees'
13
+ require_relative 'billingrails/resources/offerings'
13
14
  require_relative 'billingrails/resources/meters'
14
- require_relative 'billingrails/resources/plans'
15
+ require_relative 'billingrails/resources/products'
15
16
  require_relative 'billingrails/resources/subscriptions'
16
17
  require_relative 'billingrails/resources/tax_rates'
17
18
  require_relative 'billingrails/resources/credit_grants'
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.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billingrails
@@ -87,10 +87,11 @@ files:
87
87
  - lib/billingrails/resources/fees.rb
88
88
  - lib/billingrails/resources/invoices.rb
89
89
  - lib/billingrails/resources/meters.rb
90
+ - lib/billingrails/resources/offerings.rb
90
91
  - lib/billingrails/resources/payment_links.rb
91
92
  - lib/billingrails/resources/payments.rb
92
- - lib/billingrails/resources/plans.rb
93
93
  - lib/billingrails/resources/prices.rb
94
+ - lib/billingrails/resources/products.rb
94
95
  - lib/billingrails/resources/subscriptions.rb
95
96
  - lib/billingrails/resources/tax_rates.rb
96
97
  - lib/billingrails/version.rb