paddle 2.5.2 → 2.7.0

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: 71e0e3132d58b4212af739b9f9038ffe69a38e97b957a7f8b5c716a19cb12e97
4
- data.tar.gz: 3cba717fe19593113c4f5f08d6e659b42033635bd8b39bfd4cfc60774cb3526a
3
+ metadata.gz: 30077dce563178db3e9407b4ef168bb1a24aabb324370a00ea37730eb926dbe6
4
+ data.tar.gz: 5ae2b0845d75b6fdcc001aadcf204c879d7596c13ab544f34d42192d5984cb04
5
5
  SHA512:
6
- metadata.gz: 1e4a5ee39bb69fcfa8fcf6ada329c4b37c8e13822bfb379e34612d3080fd7560f766002f57fcc5eadf2b6d1189508472f2466247f8dc3b7e6981a8a6f8c5e255
7
- data.tar.gz: e6531690ae2c71245364d98a14254dee36a896783d039df34bf090603f78ee1bbe0cb5098353fe35a67957eddd650dbfff9f3c64b0c7e7e3d7d1d119c59ce36a
6
+ metadata.gz: 2f4ed6ef5a1be40bb0c447c22b6ebe27f8527c9b69f0d7ca2ea6f17fd52470d8581f6b6039d7f245a66a936219bce1e4b97a97556042da95c9d2d57930169fdf
7
+ data.tar.gz: 8eafdbd49ed16fe04f0f815e99889578f0e6045115ede50c3b17aaf21203110a5f9349b8e8aeeced3e4b8145e443ca481bf6c11c810e9e055bab771ed1c58e10
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paddle (2.5.2)
4
+ paddle (2.7.0)
5
5
  faraday (~> 2.11.0)
6
6
  ostruct (~> 0.6.0)
7
7
 
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.5"
10
+ gem "paddle", "~> 2.6"
11
11
  ```
12
12
 
13
13
  ## Billing API
@@ -336,6 +336,16 @@ Paddle::Subscription.cancel(id: "sub_abc123", effective_from: "immediately")
336
336
  Paddle::Subscription.activate(id: "sub_abc123")
337
337
  ```
338
338
 
339
+ ### Customer Portal Sessions
340
+
341
+ ```ruby
342
+ # Create a Customer Portal Session
343
+ # https://developer.paddle.com/api-reference/customer-portals/create-customer-portal-session
344
+ Paddle::PortalSession.create customer: "ctm_abc123"
345
+ Paddle::PortalSession.create customer: "ctm_abc123", subscription_ids: ["sub_abc123"]
346
+ ```
347
+
348
+
339
349
  ### Adjustments
340
350
 
341
351
  ```ruby
@@ -358,6 +368,12 @@ Paddle::Adjustment.create(
358
368
  }
359
369
  ]
360
370
  )
371
+
372
+ # Get a credit note for an adjustment
373
+ # disposition defaults to "attachment"
374
+ # Returns a raw URL. This URL is not permanent and will expire.
375
+ # https://developer.paddle.com/api-reference/adjustments/get-credit-note-pdf
376
+ Paddle::Adjustment.credit_note(id: "adj_abc123", disposition: "inline")
361
377
  ```
362
378
 
363
379
  ### Event Types
@@ -461,6 +477,53 @@ Paddle::Report.create(
461
477
  )
462
478
  ```
463
479
 
480
+ ### Webhook Simulation Types
481
+
482
+ Retrieves a list of Simulation Types - https://developer.paddle.com/api-reference/simulation-types/overview
483
+
484
+ ```ruby
485
+ Paddle::SimulationType.list
486
+ ```
487
+
488
+ ### Webhook Simulations
489
+
490
+ ```ruby
491
+ # List all simulations
492
+ Paddle::Simulation.list
493
+ Paddle::Simulation.list(status: "archived")
494
+ Paddle::Simulation.list(notification_setting_id: "nftset_abc123")
495
+
496
+ # Create a simulation
497
+ # https://developer.paddle.com/api-reference/simulations/create-simulation
498
+ Paddle::Simulation.create(notification_setting_id: "ntfset_abc123", name: "Customer Create", type: "customer.completed")
499
+ Paddle::Simulation.create(notification_setting_id: "ntfset_abc123", name: "Subscription Created", type: "subscription_creation")
500
+
501
+ # Retrieve a simulation
502
+ Paddle::Simulation.retrieve(id: "ntfsim_abc123")
503
+
504
+ # Update a simulation
505
+ # https://developer.paddle.com/api-reference/simulations/update-simulation
506
+ Paddle::Simulation.update(id: "ntfsim_abc123", name: "Simulation 2")
507
+ Paddle::Simulation.update(id: "ntfsim_abc123", status: "archived")
508
+
509
+ # List all simulation runs
510
+ Paddle::Simulation.runs(id: "ntfsim_abc123")
511
+
512
+ # Create a simulation run
513
+ # https://developer.paddle.com/api-reference/simulations/create-simulation-run
514
+ Paddle::SimulationRun.create(simulation_id: "ntfsim_abc123")
515
+
516
+ # Retrieve a simulation run
517
+ Paddle::SimulationRun.retrieve(simulation_id: "ntfsim_abc123", id: "ntfsimrun_abc123")
518
+
519
+ # List all simulation run events
520
+ Paddle::SimulationRun.events(simulation_id: "ntfsim_abc123", run_id: "ntfsimrun_abc123")
521
+
522
+ # Replay a simulation run event
523
+ # https://developer.paddle.com/api-reference/simulations/replay-simulation-run-event
524
+ Paddle::SimulationRunEvent.replay(simulation_id: "ntfsim_abc123", run_id: "ntfsimrun_abc123", id: "ntfsimevt_abc123")
525
+ ```
526
+
464
527
  ## Classic API
465
528
 
466
529
  For accessing the Paddle Classic API
@@ -11,6 +11,13 @@ module Paddle
11
11
  response = Client.post_request("adjustments", body: attrs.merge(params))
12
12
  Adjustment.new(response.body["data"])
13
13
  end
14
+
15
+ def credit_note(id:, disposition: "attachment")
16
+ response = Client.get_request("adjustments/#{id}/credit-note?disposition=#{disposition}")
17
+ if response.success?
18
+ response.body["data"]["url"]
19
+ end
20
+ end
14
21
  end
15
22
  end
16
23
  end
@@ -0,0 +1,10 @@
1
+ module Paddle
2
+ class PortalSession < Object
3
+ class << self
4
+ def create(customer:, **params)
5
+ response = Client.post_request("customers/#{customer}/portal-sessions", body: params)
6
+ PortalSession.new(response.body["data"])
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,31 @@
1
+ module Paddle
2
+ class Simulation < Object
3
+ class << self
4
+ def list(**params)
5
+ response = Client.get_request("simulations", params: params)
6
+ Collection.from_response(response, type: Simulation)
7
+ end
8
+
9
+ def create(setting_id:, name:, type:, **params)
10
+ attrs = { notification_setting_id: setting_id, name: name, type: type }
11
+ response = Client.post_request("simulations", body: attrs.merge(params))
12
+ Simulation.new(response.body["data"])
13
+ end
14
+
15
+ def retrieve(id:)
16
+ response = Client.get_request("simulations/#{id}")
17
+ Simulation.new(response.body["data"])
18
+ end
19
+
20
+ def update(id:, **params)
21
+ response = Client.patch_request("simulations/#{id}", body: params)
22
+ Simulation.new(response.body["data"])
23
+ end
24
+
25
+ def runs(id:)
26
+ response = Client.get_request("simulations/#{id}/runs")
27
+ Collection.from_response(response, type: SimulationRun)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ module Paddle
2
+ class SimulationRun < Object
3
+ class << self
4
+ def create(simulation_id:, **params)
5
+ response = Client.post_request("simulations/#{simulation_id}/runs", body: {})
6
+ SimulationRun.new(response.body["data"])
7
+ end
8
+
9
+ def retrieve(simulation_id:, id:)
10
+ response = Client.get_request("simulations/#{simulation_id}/runs/#{id}")
11
+ SimulationRun.new(response.body["data"])
12
+ end
13
+
14
+ def events(simulation_id:, id:)
15
+ response = Client.get_request("simulations/#{simulation_id}/runs/#{id}/events")
16
+ Collection.from_response(response, type: SimulationRunEvent)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ module Paddle
2
+ class SimulationRunEvent < Object
3
+ class << self
4
+ def retrieve(simulation_id:, run_id:, id:)
5
+ response = Client.get_request("simulations/#{simulation_id}/runs/#{run_id}/events/#{id}")
6
+ SimulationRunEvent.new(response.body["data"])
7
+ end
8
+
9
+ def replay(simulation_id:, run_id:, id:)
10
+ response = Client.post_request("simulations/#{simulation_id}/runs/#{run_id}/events/#{id}/replay")
11
+ SimulationRunEvent.new(response.body["data"])
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ module Paddle
2
+ class SimulationType < Object
3
+ class << self
4
+ def list
5
+ response = Client.get_request("simulation-types")
6
+ Collection.from_response(response, type: SimulationType)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paddle
4
- VERSION = "2.5.2"
4
+ VERSION = "2.7.0"
5
5
  end
data/lib/paddle.rb CHANGED
@@ -43,6 +43,11 @@ module Paddle
43
43
  autoload :NotificationSetting, "paddle/models/notification_setting"
44
44
  autoload :Notification, "paddle/models/notification"
45
45
  autoload :Report, "paddle/models/report"
46
+ autoload :SimulationType, "paddle/models/simulation_type"
47
+ autoload :Simulation, "paddle/models/simulation"
48
+ autoload :SimulationRun, "paddle/models/simulation_run"
49
+ autoload :SimulationRunEvent, "paddle/models/simulation_run_event"
50
+ autoload :PortalSession, "paddle/models/portal_session"
46
51
 
47
52
  autoload :NotificationLog, "paddle/models/notification_log"
48
53
  autoload :CreditBalance, "paddle/models/credit_balance"
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.5.2
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
11
+ date: 2024-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -97,10 +97,15 @@ files:
97
97
  - lib/paddle/models/notification.rb
98
98
  - lib/paddle/models/notification_log.rb
99
99
  - lib/paddle/models/notification_setting.rb
100
+ - lib/paddle/models/portal_session.rb
100
101
  - lib/paddle/models/price.rb
101
102
  - lib/paddle/models/pricing_preview.rb
102
103
  - lib/paddle/models/product.rb
103
104
  - lib/paddle/models/report.rb
105
+ - lib/paddle/models/simulation.rb
106
+ - lib/paddle/models/simulation_run.rb
107
+ - lib/paddle/models/simulation_run_event.rb
108
+ - lib/paddle/models/simulation_type.rb
104
109
  - lib/paddle/models/subscription.rb
105
110
  - lib/paddle/models/transaction.rb
106
111
  - lib/paddle/object.rb
@@ -126,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
131
  - !ruby/object:Gem::Version
127
132
  version: '0'
128
133
  requirements: []
129
- rubygems_version: 3.5.11
134
+ rubygems_version: 3.5.16
130
135
  signing_key:
131
136
  specification_version: 4
132
137
  summary: Ruby library for the Paddle Billing & Classic APIs