paddle 2.1.0 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa102f9ad5b6adcf43a522ef2fd512d16e8493b186aa8129c5c6014751fa4274
4
- data.tar.gz: 8d13d5a6cd7420bad3bca2f38057327ac44392db4022dac8edbc013cb1470091
3
+ metadata.gz: 7c5311f039c9752abbee3441651b3ce883a7510dd623adda0ad072ca2af5d1d8
4
+ data.tar.gz: baecbf364ccc785580d3773825065d7b53538f0f7f3961417e6f27714abc1809
5
5
  SHA512:
6
- metadata.gz: 2fdbf156519a8bce53914f2cf034b224a8249499029c773d7f7f167433252da2f90e733773ac0dcb9ff1b2314271b6dd7f22bfdddfe7acbc41e6772b6b71c508
7
- data.tar.gz: 1af00167e992c18f7af0110ebc66540dd0b7b1928ba3db77e69dd87c79a3f2505c1d66153447dce34f161b6c8c9eeb4317312e0531dd0a862eeb1806a2735240
6
+ metadata.gz: 366a5b93b873a672c301053766561e1df38198dcdbd19f6db6545c59e68b40f12c2717a0250e373286ba298e95d0baef5fa74784634666c9667590b7c9c7ecfb
7
+ data.tar.gz: b321361bd7ad221c3f2eab2a05c9a7db79cae069bd4963bac647f92b34a25c81b68998a2436870eae6aa26acddf50644b3c8791209aa9372e35b2d567b9183f4
data/Gemfile.lock CHANGED
@@ -1,14 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paddle (2.1.0)
4
+ paddle (2.1.2)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ base64 (0.1.1)
10
11
  dotenv (2.7.6)
11
- faraday (2.7.10)
12
+ faraday (2.7.11)
13
+ base64
12
14
  faraday-net_http (>= 2.0, < 3.1)
13
15
  ruby2_keywords (>= 0.0.4)
14
16
  faraday-net_http (3.0.2)
@@ -28,4 +30,4 @@ DEPENDENCIES
28
30
  vcr
29
31
 
30
32
  BUNDLED WITH
31
- 2.3.22
33
+ 2.4.21
data/README.md CHANGED
@@ -130,6 +130,10 @@ Paddle::Customer.retrieve(id: "ctm_abc123")
130
130
  # Update a customer
131
131
  # https://developer.paddle.com/api-reference/customers/update-customer
132
132
  Paddle::Customer.update(id: "ctm_abc123", status: "archived")
133
+
134
+ # Retrieve credit balance for a customer
135
+ # https://developer.paddle.com/api-reference/customers/list-credit-balances
136
+ Paddle::Customer.credit(id: "ctm_abc123")
133
137
  ```
134
138
 
135
139
  ### Addresses
@@ -214,6 +218,8 @@ Paddle::Subscription.list(customer_id: "ctm_abc123")
214
218
  Paddle::Subscription.list(price_id: "pri_abc123")
215
219
  Paddle::Subscription.list(status: "active")
216
220
  Paddle::Subscription.list(status: "canceled")
221
+ Paddle::Subscription.list(collection_mode: "automatic")
222
+ Paddle::Subscription.list(scheduled_change_action: "cancel")
217
223
 
218
224
  # Retrieve a subscription
219
225
  Paddle::Subscription.retrieve(id: "sub_abc123")
@@ -242,14 +248,21 @@ Paddle::Subscription.charge(id: "sub_abc123", items: [ { price_id: "pri_123abc",
242
248
  # https://developer.paddle.com/api-reference/subscriptions/pause-subscription
243
249
  Paddle::Subscription.pause(id: "sub_abc123")
244
250
  Paddle::Subscription.pause(id: "sub_abc123", effective_from: "next_billing_period")
251
+ Paddle::Subscription.pause(id: "sub_abc123", effective_from: "immediately")
245
252
 
246
253
  # Resume a paused subscription
247
254
  # https://developer.paddle.com/api-reference/subscriptions/resume-subscription
248
255
  Paddle::Subscription.resume(id: "sub_abc123", effective_from: "next_billing_period")
256
+ Paddle::Subscription.resume(id: "sub_abc123", effective_from: "immediately")
249
257
 
250
258
  # Cancel a subscription
251
259
  # https://developer.paddle.com/api-reference/subscriptions/cancel-subscription
252
260
  Paddle::Subscription.cancel(id: "sub_abc123", effective_from: "next_billing_period")
261
+ Paddle::Subscription.cancel(id: "sub_abc123", effective_from: "immediately")
262
+
263
+ # Activate a trialing subscription
264
+ # https://developer.paddle.com/api-reference/subscriptions/activate-subscription
265
+ Paddle::Subscription.activate(id: "sub_abc123")
253
266
  ```
254
267
 
255
268
  ### Adjustments
@@ -0,0 +1,4 @@
1
+ module Paddle
2
+ class CreditBalance < Object
3
+ end
4
+ end
@@ -9,7 +9,7 @@ module Paddle
9
9
  end
10
10
 
11
11
  def create(email:, **params)
12
- attrs = {email: email}
12
+ attrs = {email: email.gsub(/\s+/, "")}
13
13
  response = Client.post_request("customers", body: attrs.merge(params))
14
14
  Customer.new(response.body["data"])
15
15
  end
@@ -24,6 +24,11 @@ module Paddle
24
24
  Customer.new(response.body["data"])
25
25
  end
26
26
 
27
+ def credit(id:)
28
+ response = Client.get_request("customers/#{id}/credit-balances")
29
+ CreditBalance.new(response.body["data"][0])
30
+ end
31
+
27
32
  end
28
33
 
29
34
  end
@@ -16,7 +16,7 @@ module Paddle
16
16
 
17
17
  def get_transaction(id:)
18
18
  response = Client.get_request("subscriptions/#{id}/update-payment-method-transaction")
19
- Subscription.new(response.body["data"])
19
+ Transaction.new(response.body["data"])
20
20
  end
21
21
 
22
22
  def preview(id:, **params)
@@ -51,6 +51,11 @@ module Paddle
51
51
  Subscription.new(response.body["data"])
52
52
  end
53
53
 
54
+ def activate(id:)
55
+ response = Client.post_request("subscriptions/#{id}/activate")
56
+ Subscription.new(response.body["data"])
57
+ end
58
+
54
59
  end
55
60
 
56
61
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paddle
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.2"
5
5
  end
data/lib/paddle.rb CHANGED
@@ -39,7 +39,9 @@ module Paddle
39
39
  autoload :Event, "paddle/models/event"
40
40
  autoload :NotificationSetting, "paddle/models/notification_setting"
41
41
  autoload :Notification, "paddle/models/notification"
42
+
42
43
  autoload :NotificationLog, "paddle/models/notification_log"
44
+ autoload :CreditBalance, "paddle/models/credit_balance"
43
45
 
44
46
  # Load Classic APIs
45
47
  module Classic
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paddle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-30 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -72,6 +72,7 @@ files:
72
72
  - lib/paddle/models/address.rb
73
73
  - lib/paddle/models/adjustment.rb
74
74
  - lib/paddle/models/business.rb
75
+ - lib/paddle/models/credit_balance.rb
75
76
  - lib/paddle/models/customer.rb
76
77
  - lib/paddle/models/discount.rb
77
78
  - lib/paddle/models/event.rb
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  - !ruby/object:Gem::Version
108
109
  version: '0'
109
110
  requirements: []
110
- rubygems_version: 3.4.18
111
+ rubygems_version: 3.4.10
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Ruby library for the Paddle Billing & Classic APIs