paddle 2.5.1 → 2.6.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: 1f2fe0be6f1d67cf05754443625e3215781b9287eb5f9ae392628bea8946d123
4
- data.tar.gz: 9beae56495831d56f8e4f7514e98a103e7d2de4f2c10d261492af3155769c4cc
3
+ metadata.gz: 607f60ab0594b5db91351073eeb83eec476bd3c2ddcf4cf52ff9815f83c13991
4
+ data.tar.gz: e7b3ba70a236938302823fa40828229cbe60c6c1c88bcb1cee0b40a06c5a32c0
5
5
  SHA512:
6
- metadata.gz: 4ef63cdeefc3866e18364a28b76e65ad769d434107c19751bdaee7e1df8c10e64c53c5209c9e49184ba53b762899a97a7024f2d23d5a16e5afe9143065249def
7
- data.tar.gz: c02668566acec530cf75e35aea6ba49d385a000d5a6f251ce2c348ada34be126252de860499ebc7a76bff51b94a316f89d67da4ab286612742add69460b6dfd9
6
+ metadata.gz: ffcc395ce5bb7de1ba92ace950bbeab8abb537609df89ea1c635e574f7519a519549b85570cda7226b6db52a5a85d69d7ad59c8a51bed1c59e187cd12b72d485
7
+ data.tar.gz: c5b224ba8bdbe5e60db6a28880ec1580c8c08cda5c230338f499a876e8792bf5862be6a75ae31b70fc93b4402508be98febbbef51c8e0117beeff5eaded62b37
data/Gemfile.lock CHANGED
@@ -1,74 +1,76 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paddle (2.5.1)
5
- faraday (~> 2.0)
4
+ paddle (2.6.0)
5
+ faraday (~> 2.11.0)
6
+ ostruct (~> 0.6.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- activesupport (7.1.3.4)
11
+ activesupport (7.2.1)
11
12
  base64
12
13
  bigdecimal
13
- concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ concurrent-ruby (~> 1.0, >= 1.3.1)
14
15
  connection_pool (>= 2.2.5)
15
16
  drb
16
17
  i18n (>= 1.6, < 2)
18
+ logger (>= 1.4.2)
17
19
  minitest (>= 5.1)
18
- mutex_m
19
- tzinfo (~> 2.0)
20
+ securerandom (>= 0.3)
21
+ tzinfo (~> 2.0, >= 2.0.5)
20
22
  ast (2.4.2)
21
- base64 (0.1.1)
23
+ base64 (0.2.0)
22
24
  bigdecimal (3.1.8)
23
- concurrent-ruby (1.3.3)
25
+ concurrent-ruby (1.3.4)
24
26
  connection_pool (2.4.1)
25
- dotenv (2.7.6)
27
+ dotenv (3.1.2)
26
28
  drb (2.2.1)
27
- faraday (2.7.11)
28
- base64
29
- faraday-net_http (>= 2.0, < 3.1)
30
- ruby2_keywords (>= 0.0.4)
31
- faraday-net_http (3.0.2)
29
+ faraday (2.11.0)
30
+ faraday-net_http (>= 2.0, < 3.4)
31
+ logger
32
+ faraday-net_http (3.3.0)
33
+ net-http
32
34
  i18n (1.14.5)
33
35
  concurrent-ruby (~> 1.0)
34
36
  json (2.7.2)
35
37
  language_server-protocol (3.17.0.3)
36
- minitest (5.19.0)
37
- mutex_m (0.2.0)
38
- parallel (1.25.1)
39
- parser (3.3.3.0)
38
+ logger (1.6.1)
39
+ minitest (5.25.1)
40
+ net-http (0.4.1)
41
+ uri
42
+ ostruct (0.6.0)
43
+ parallel (1.26.3)
44
+ parser (3.3.5.0)
40
45
  ast (~> 2.4.1)
41
46
  racc
42
- racc (1.8.0)
47
+ racc (1.8.1)
43
48
  rack (3.1.7)
44
49
  rainbow (3.1.1)
45
50
  rake (13.2.1)
46
51
  regexp_parser (2.9.2)
47
- rexml (3.3.6)
48
- strscan
49
- rubocop (1.64.1)
52
+ rubocop (1.66.1)
50
53
  json (~> 2.3)
51
54
  language_server-protocol (>= 3.17.0)
52
55
  parallel (~> 1.10)
53
56
  parser (>= 3.3.0.2)
54
57
  rainbow (>= 2.2.2, < 4.0)
55
- regexp_parser (>= 1.8, < 3.0)
56
- rexml (>= 3.2.5, < 4.0)
57
- rubocop-ast (>= 1.31.1, < 2.0)
58
+ regexp_parser (>= 2.4, < 3.0)
59
+ rubocop-ast (>= 1.32.2, < 2.0)
58
60
  ruby-progressbar (~> 1.7)
59
61
  unicode-display_width (>= 2.4.0, < 3.0)
60
- rubocop-ast (1.31.3)
62
+ rubocop-ast (1.32.3)
61
63
  parser (>= 3.3.1.0)
62
- rubocop-minitest (0.35.0)
64
+ rubocop-minitest (0.36.0)
63
65
  rubocop (>= 1.61, < 2.0)
64
66
  rubocop-ast (>= 1.31.1, < 2.0)
65
- rubocop-performance (1.21.0)
67
+ rubocop-performance (1.21.1)
66
68
  rubocop (>= 1.48.1, < 2.0)
67
69
  rubocop-ast (>= 1.31.1, < 2.0)
68
- rubocop-rails (2.25.0)
70
+ rubocop-rails (2.26.0)
69
71
  activesupport (>= 4.2.0)
70
72
  rack (>= 1.1)
71
- rubocop (>= 1.33.0, < 2.0)
73
+ rubocop (>= 1.52.0, < 2.0)
72
74
  rubocop-ast (>= 1.31.1, < 2.0)
73
75
  rubocop-rails-omakase (1.0.0)
74
76
  rubocop
@@ -76,12 +78,13 @@ GEM
76
78
  rubocop-performance
77
79
  rubocop-rails
78
80
  ruby-progressbar (1.13.0)
79
- ruby2_keywords (0.0.5)
80
- strscan (3.1.0)
81
+ securerandom (0.3.1)
81
82
  tzinfo (2.0.6)
82
83
  concurrent-ruby (~> 1.0)
83
84
  unicode-display_width (2.5.0)
84
- vcr (6.2.0)
85
+ uri (0.13.1)
86
+ vcr (6.3.1)
87
+ base64
85
88
 
86
89
  PLATFORMS
87
90
  x86_64-linux
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
@@ -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
@@ -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.1"
4
+ VERSION = "2.6.0"
5
5
  end
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"
data/paddle.gemspec CHANGED
@@ -26,5 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = [ "lib" ]
28
28
 
29
- spec.add_dependency "faraday", "~> 2.0"
29
+ spec.add_dependency "faraday", "~> 2.11.0"
30
+ spec.add_dependency "ostruct", "~> 0.6.0"
30
31
  end
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.1
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-04 00:00:00.000000000 Z
11
+ date: 2024-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 2.11.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: 2.11.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: ostruct
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.0
27
41
  description:
28
42
  email:
29
43
  - dean@deanpcmad.com
@@ -87,6 +101,10 @@ files:
87
101
  - lib/paddle/models/pricing_preview.rb
88
102
  - lib/paddle/models/product.rb
89
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
90
108
  - lib/paddle/models/subscription.rb
91
109
  - lib/paddle/models/transaction.rb
92
110
  - lib/paddle/object.rb