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 +4 -4
- data/CHANGELOG.md +0 -2
- data/README.md +1 -9
- data/lib/billingrails/client.rb +7 -6
- data/lib/billingrails/resources/fees.rb +1 -1
- data/lib/billingrails/resources/offerings.rb +106 -0
- data/lib/billingrails/resources/prices.rb +1 -1
- data/lib/billingrails/resources/{plans.rb → products.rb} +36 -14
- data/lib/billingrails/version.rb +1 -1
- data/lib/billingrails.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a5b67a14d5de893e9a3ee00b839d59c99661274987a60d80daf906962ad45a6
|
|
4
|
+
data.tar.gz: 698cd398f19a126ba47bc1f045d36baf17d8e60968c4cbd6c0cdd35f82605115
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d60ec418d12ada5c355e3fc1e5a121f38458ab9ba5ca727cfb333a215f6e5b98267c7fdc53eb9180fb71cfee600411611349b4975108c1c47e2cd2692ea0ebf9
|
|
7
|
+
data.tar.gz: 5ec2da2339853212f4ca5ffc504fe6b7d3861344a196cb79ebc682da86ca3a2c4cf5342da3797b6f9874bcc30a900d0fa110485cfaaff690fa1704352f06b326
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://rubygems.org/gems/billingrails)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
Official Ruby SDK for the [Billingrails](https://billingrails.com) API
|
|
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).
|
data/lib/billingrails/client.rb
CHANGED
|
@@ -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(
|
|
34
|
+
@checkout_sessions = Resources::CheckoutSessions.new(self)
|
|
35
35
|
|
|
36
|
-
@subscriptions = Resources::Subscriptions.new(
|
|
37
|
-
@
|
|
36
|
+
@subscriptions = Resources::Subscriptions.new(self)
|
|
37
|
+
@products = Resources::Products.new(self)
|
|
38
38
|
@fees = Resources::Fees.new(self)
|
|
39
|
-
@prices = Resources::Prices.new(
|
|
40
|
-
@
|
|
41
|
-
@
|
|
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)
|
|
@@ -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
|
|
@@ -4,59 +4,81 @@
|
|
|
4
4
|
|
|
5
5
|
module Billingrails
|
|
6
6
|
module Resources
|
|
7
|
-
#
|
|
8
|
-
class
|
|
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
|
|
14
|
+
# List products
|
|
15
15
|
#
|
|
16
|
-
# Retrieves a list of
|
|
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 = "/
|
|
21
|
+
path = "/products"
|
|
22
22
|
@client.request(:get, path, params: params)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
# Create a
|
|
25
|
+
# Create a product
|
|
26
26
|
#
|
|
27
|
-
# Creates a
|
|
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 = "/
|
|
32
|
+
path = "/products"
|
|
33
33
|
@client.request(:post, path, body: data)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
# Retrieve a
|
|
36
|
+
# Retrieve a product
|
|
37
37
|
#
|
|
38
|
-
# Retrieves
|
|
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 = "/
|
|
44
|
+
path = "/products/#{id}"
|
|
45
45
|
@client.request(:get, path, params: params)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# Update a
|
|
48
|
+
# Update a product
|
|
49
49
|
#
|
|
50
|
-
# Updates a
|
|
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 = "/
|
|
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
|
data/lib/billingrails/version.rb
CHANGED
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/
|
|
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.
|
|
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
|