paddle 2.8 → 2.9

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: 688edb526349f04a5e5b255f6ca8620388e18f431d152501689b73eee572efaf
4
- data.tar.gz: 2ce860d28169ed75275c97043c1cc5511460da8377b4e14283be97895f03f71a
3
+ metadata.gz: cc578ecefeacc14fa58ae9fc433429c3180d5c5bc6015493bc66afc50172cccd
4
+ data.tar.gz: 03d85b6ee1f8fedb0c5b56028dfb741d32155471bfda087b7cf61bd2872f60ef
5
5
  SHA512:
6
- metadata.gz: b3a2fe51d7a3d636f8f1f6cb5427863760da0c7149cc45dcc0c1901a236df86ab97f9ae233f29ddca16ef0c4dd6f08ede0bc727b93d8187f243d2d41c73125eb
7
- data.tar.gz: 3444042854883edd1ec749d501498fdb242f25f643acb0d8b3d49ef31d1168e4257d8e8c1f07c4cbfcc753a4603c783adf4d6ce0b5cb0c38f3e934848a4548bf
6
+ metadata.gz: 4ecdcde91d5d11a03c7f5e1506f923b3cfd738bbc70113436891768e2cdbdc194694a67e9e452256b6d8be5918b0eed315ce27ab9e5a7a5920312023f3ed3acc
7
+ data.tar.gz: 851daa7f4a126c94891cf136b80761f7a98745cd3a21455cadb8af1e7f782f3972a8e0123585320052d6335bd25598706e212e1224aaabd93c18c100f195c16b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paddle (2.8)
4
+ paddle (2.9)
5
5
  cgi
6
6
  faraday (~> 2.11)
7
7
  ostruct (~> 0.6.0)
@@ -56,7 +56,7 @@ GEM
56
56
  rainbow (3.1.1)
57
57
  rake (13.3.1)
58
58
  regexp_parser (2.11.3)
59
- rubocop (1.81.7)
59
+ rubocop (1.82.1)
60
60
  json (~> 2.3)
61
61
  language_server-protocol (~> 3.17.0.2)
62
62
  lint_roller (~> 1.1.0)
@@ -64,7 +64,7 @@ GEM
64
64
  parser (>= 3.3.0.2)
65
65
  rainbow (>= 2.2.2, < 4.0)
66
66
  regexp_parser (>= 2.9.3, < 3.0)
67
- rubocop-ast (>= 1.47.1, < 2.0)
67
+ rubocop-ast (>= 1.48.0, < 2.0)
68
68
  ruby-progressbar (~> 1.7)
69
69
  unicode-display_width (>= 2.4.0, < 4.0)
70
70
  rubocop-ast (1.48.0)
@@ -90,7 +90,7 @@ GEM
90
90
  concurrent-ruby (~> 1.0)
91
91
  unicode-display_width (3.2.0)
92
92
  unicode-emoji (~> 4.1)
93
- unicode-emoji (4.1.0)
93
+ unicode-emoji (4.2.0)
94
94
  uri (1.1.1)
95
95
  vcr (6.3.1)
96
96
  base64
@@ -107,4 +107,4 @@ DEPENDENCIES
107
107
  vcr
108
108
 
109
109
  BUNDLED WITH
110
- 2.5.9
110
+ 4.0.3
data/README.md CHANGED
@@ -7,7 +7,7 @@ The easiest and most complete Ruby library for the Paddle APIs, both Classic and
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem "paddle", "~> 2.6"
10
+ gem "paddle", "~> 2.8"
11
11
  ```
12
12
 
13
13
  ## Billing API
@@ -221,6 +221,37 @@ discount.update(description: "An updated description")
221
221
  Paddle::Discount.update(id: "dsc_abc123", description: "An updated description")
222
222
  ```
223
223
 
224
+ ### Discount Groups
225
+
226
+ ```ruby
227
+ # List all discount groups
228
+ # https://developer.paddle.com/api-reference/discount-groups/list-discount-groups
229
+ Paddle::DiscountGroup.list
230
+ Paddle::DiscountGroup.list(status: "active")
231
+
232
+ # Create a discount group
233
+ # https://developer.paddle.com/api-reference/discount-groups/create-discount-group
234
+ Paddle::DiscountGroup.create(name: "Black Friday Promotion")
235
+
236
+ # Retrieve a discount group
237
+ # https://developer.paddle.com/api-reference/discount-groups/get-discount-group
238
+ discount_group = Paddle::DiscountGroup.retrieve(id: "dsg_abc123")
239
+
240
+ # Update a discount group
241
+ # https://developer.paddle.com/api-reference/discount-groups/update-discount-group
242
+ discount_group.update(name: "Updated name")
243
+ # or
244
+ Paddle::DiscountGroup.update(id: "dsg_abc123", name: "Updated name")
245
+
246
+ # Create a discount in a discount group
247
+ discount_group.create_discount(description: "$10 off", type: "flat", amount: "1000", currency_code: "USD")
248
+ # or
249
+ Paddle::Discount.create(discount_group_id: discount_group.id, description: "$10 off", type: "flat", amount: "1000", currency_code: "USD")
250
+
251
+ # List discounts in a discount group
252
+ discounts = discount_group.discounts
253
+ ```
254
+
224
255
  ### Customers
225
256
 
226
257
  ```ruby
@@ -0,0 +1,34 @@
1
+ module Paddle
2
+ class DiscountGroup < Object
3
+ class << self
4
+ def list(**params)
5
+ response = Client.get_request("discount-groups", params: params)
6
+ Collection.from_response(response, type: DiscountGroup)
7
+ end
8
+
9
+ def create(name:, **params)
10
+ attrs = { name: name }
11
+ response = Client.post_request("discount-groups", body: attrs.merge(params))
12
+ DiscountGroup.new(response.body["data"])
13
+ end
14
+
15
+ def retrieve(id:)
16
+ response = Client.get_request("discount-groups/#{id}")
17
+ DiscountGroup.new(response.body["data"])
18
+ end
19
+
20
+ def update(id:, **params)
21
+ response = Client.patch_request("discount-groups/#{id}", body: params)
22
+ DiscountGroup.new(response.body["data"])
23
+ end
24
+ end
25
+
26
+ def create_discount(**params)
27
+ Discount.create(discount_group_id: id, **params)
28
+ end
29
+
30
+ def discounts(**params)
31
+ Discount.list(discount_group_id: id, **params)
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paddle
4
- VERSION = "2.8"
4
+ VERSION = "2.9"
5
5
  end
data/lib/paddle.rb CHANGED
@@ -32,6 +32,7 @@ module Paddle
32
32
  autoload :Price, "paddle/models/price"
33
33
  autoload :PricingPreview, "paddle/models/pricing_preview"
34
34
  autoload :Discount, "paddle/models/discount"
35
+ autoload :DiscountGroup, "paddle/models/discount_group"
35
36
  autoload :Customer, "paddle/models/customer"
36
37
  autoload :Address, "paddle/models/address"
37
38
  autoload :Business, "paddle/models/business"
data/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ ruby = "4.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paddle
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.8'
4
+ version: '2.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
@@ -106,6 +106,7 @@ files:
106
106
  - lib/paddle/models/customer.rb
107
107
  - lib/paddle/models/customer_auth_token.rb
108
108
  - lib/paddle/models/discount.rb
109
+ - lib/paddle/models/discount_group.rb
109
110
  - lib/paddle/models/event.rb
110
111
  - lib/paddle/models/event_type.rb
111
112
  - lib/paddle/models/notification.rb
@@ -125,6 +126,7 @@ files:
125
126
  - lib/paddle/models/transaction.rb
126
127
  - lib/paddle/object.rb
127
128
  - lib/paddle/version.rb
129
+ - mise.toml
128
130
  - paddle.gemspec
129
131
  homepage: https://github.com/deanpcmad/paddle
130
132
  licenses: []
@@ -145,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
147
  - !ruby/object:Gem::Version
146
148
  version: '0'
147
149
  requirements: []
148
- rubygems_version: 4.0.1
150
+ rubygems_version: 4.0.3
149
151
  specification_version: 4
150
152
  summary: Ruby library for the Paddle Billing & Classic APIs
151
153
  test_files: []