paddle 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +54 -1
- data/lib/paddle/models/adjustment.rb +7 -0
- data/lib/paddle/models/simulation.rb +31 -0
- data/lib/paddle/models/simulation_run.rb +20 -0
- data/lib/paddle/models/simulation_run_event.rb +15 -0
- data/lib/paddle/models/simulation_type.rb +10 -0
- data/lib/paddle/version.rb +1 -1
- data/lib/paddle.rb +4 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 607f60ab0594b5db91351073eeb83eec476bd3c2ddcf4cf52ff9815f83c13991
|
4
|
+
data.tar.gz: e7b3ba70a236938302823fa40828229cbe60c6c1c88bcb1cee0b40a06c5a32c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffcc395ce5bb7de1ba92ace950bbeab8abb537609df89ea1c635e574f7519a519549b85570cda7226b6db52a5a85d69d7ad59c8a51bed1c59e187cd12b72d485
|
7
|
+
data.tar.gz: c5b224ba8bdbe5e60db6a28880ec1580c8c08cda5c230338f499a876e8792bf5862be6a75ae31b70fc93b4402508be98febbbef51c8e0117beeff5eaded62b37
|
data/Gemfile.lock
CHANGED
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.
|
10
|
+
gem "paddle", "~> 2.6"
|
11
11
|
```
|
12
12
|
|
13
13
|
## Billing API
|
@@ -358,6 +358,12 @@ Paddle::Adjustment.create(
|
|
358
358
|
}
|
359
359
|
]
|
360
360
|
)
|
361
|
+
|
362
|
+
# Get a credit note for an adjustment
|
363
|
+
# disposition defaults to "attachment"
|
364
|
+
# Returns a raw URL. This URL is not permanent and will expire.
|
365
|
+
# https://developer.paddle.com/api-reference/adjustments/get-credit-note-pdf
|
366
|
+
Paddle::Adjustment.credit_note(id: "adj_abc123", disposition: "inline")
|
361
367
|
```
|
362
368
|
|
363
369
|
### Event Types
|
@@ -461,6 +467,53 @@ Paddle::Report.create(
|
|
461
467
|
)
|
462
468
|
```
|
463
469
|
|
470
|
+
### Webhook Simulation Types
|
471
|
+
|
472
|
+
Retrieves a list of Simulation Types - https://developer.paddle.com/api-reference/simulation-types/overview
|
473
|
+
|
474
|
+
```ruby
|
475
|
+
Paddle::SimulationType.list
|
476
|
+
```
|
477
|
+
|
478
|
+
### Webhook Simulations
|
479
|
+
|
480
|
+
```ruby
|
481
|
+
# List all simulations
|
482
|
+
Paddle::Simulation.list
|
483
|
+
Paddle::Simulation.list(status: "archived")
|
484
|
+
Paddle::Simulation.list(notification_setting_id: "nftset_abc123")
|
485
|
+
|
486
|
+
# Create a simulation
|
487
|
+
# https://developer.paddle.com/api-reference/simulations/create-simulation
|
488
|
+
Paddle::Simulation.create(notification_setting_id: "ntfset_abc123", name: "Customer Create", type: "customer.completed")
|
489
|
+
Paddle::Simulation.create(notification_setting_id: "ntfset_abc123", name: "Subscription Created", type: "subscription_creation")
|
490
|
+
|
491
|
+
# Retrieve a simulation
|
492
|
+
Paddle::Simulation.retrieve(id: "ntfsim_abc123")
|
493
|
+
|
494
|
+
# Update a simulation
|
495
|
+
# https://developer.paddle.com/api-reference/simulations/update-simulation
|
496
|
+
Paddle::Simulation.update(id: "ntfsim_abc123", name: "Simulation 2")
|
497
|
+
Paddle::Simulation.update(id: "ntfsim_abc123", status: "archived")
|
498
|
+
|
499
|
+
# List all simulation runs
|
500
|
+
Paddle::Simulation.runs(id: "ntfsim_abc123")
|
501
|
+
|
502
|
+
# Create a simulation run
|
503
|
+
# https://developer.paddle.com/api-reference/simulations/create-simulation-run
|
504
|
+
Paddle::SimulationRun.create(simulation_id: "ntfsim_abc123")
|
505
|
+
|
506
|
+
# Retrieve a simulation run
|
507
|
+
Paddle::SimulationRun.retrieve(simulation_id: "ntfsim_abc123", id: "ntfsimrun_abc123")
|
508
|
+
|
509
|
+
# List all simulation run events
|
510
|
+
Paddle::SimulationRun.events(simulation_id: "ntfsim_abc123", run_id: "ntfsimrun_abc123")
|
511
|
+
|
512
|
+
# Replay a simulation run event
|
513
|
+
# https://developer.paddle.com/api-reference/simulations/replay-simulation-run-event
|
514
|
+
Paddle::SimulationRunEvent.replay(simulation_id: "ntfsim_abc123", run_id: "ntfsimrun_abc123", id: "ntfsimevt_abc123")
|
515
|
+
```
|
516
|
+
|
464
517
|
## Classic API
|
465
518
|
|
466
519
|
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,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
|
data/lib/paddle/version.rb
CHANGED
data/lib/paddle.rb
CHANGED
@@ -43,6 +43,10 @@ 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"
|
46
50
|
|
47
51
|
autoload :NotificationLog, "paddle/models/notification_log"
|
48
52
|
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.
|
4
|
+
version: 2.6.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-
|
11
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -101,6 +101,10 @@ files:
|
|
101
101
|
- lib/paddle/models/pricing_preview.rb
|
102
102
|
- lib/paddle/models/product.rb
|
103
103
|
- lib/paddle/models/report.rb
|
104
|
+
- lib/paddle/models/simulation.rb
|
105
|
+
- lib/paddle/models/simulation_run.rb
|
106
|
+
- lib/paddle/models/simulation_run_event.rb
|
107
|
+
- lib/paddle/models/simulation_type.rb
|
104
108
|
- lib/paddle/models/subscription.rb
|
105
109
|
- lib/paddle/models/transaction.rb
|
106
110
|
- lib/paddle/object.rb
|