paddle 2.1.3 → 2.2.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: 457fd5bd63d3324da10687d2796e4582e2693021ab8a6fa7bfeddbfa7b47dda0
4
- data.tar.gz: 38ef8f0c9baf2ddc2515d1a3a1c9a032e5c3a8788299052762e4741f1f81e236
3
+ metadata.gz: b0c36c67374aa35e91a2497199311888ef26eb0265cd14dddf57f535e7dabb6e
4
+ data.tar.gz: 287d3e39a116eb4b19bba68baaa0772c67306e0f47249c81c815a29ab5a82f0f
5
5
  SHA512:
6
- metadata.gz: c2c14b85b564116f6b5c3d771b010b4fefa66ef9e899960c6bd3fc9e0919a9e864b398d73106318e62c2bb8c4684a8a2f5b211ff9e6ec67fcdfd337b1b6465a8
7
- data.tar.gz: c604c94ac7770198ed78f57318327efcbf293d68a127bfdfcb419a4aa52aa7ee4db8ac7542df3d9045b662d5a5b6a3cbea9aa3f02be7559b8e04232db6eb6c33
6
+ metadata.gz: 30ab0451e76ea879e948373553f707359e9847f92f9a06a1d962dad8f327e471d89858b505e27e7e030570db5413d161943b6aa29b7efe68dc26cdb9723bad7b
7
+ data.tar.gz: 10fd334a894063e6f14c69fb9e03d1931e9153877037b786cc127fec82d2ba4d0cf992ec1441ca4550ae469dcf444e8abf64404f4478573e28f834ab00d745e5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paddle (2.1.3)
4
+ paddle (2.2.0)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
@@ -30,4 +30,4 @@ DEPENDENCIES
30
30
  vcr
31
31
 
32
32
  BUNDLED WITH
33
- 2.4.21
33
+ 2.5.9
data/README.md CHANGED
@@ -7,7 +7,7 @@ A Ruby library for the Paddle APIs, both Classic and Billing.
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem "paddle", "~> 2.1"
10
+ gem "paddle", "~> 2.2"
11
11
  ```
12
12
 
13
13
  ## Billing API
@@ -33,6 +33,11 @@ Paddle.configure do |config|
33
33
  end
34
34
  ```
35
35
 
36
+ ### Caveats
37
+
38
+ The Paddle API doesn't take `nil` values for optional parameters. If you want to
39
+ remove a value, you'll need to pass `"null"` instead.
40
+
36
41
  ### Products
37
42
 
38
43
  ```ruby
@@ -119,6 +124,7 @@ Paddle::Discount.update(id: "dsc_abc123", description: "An updated description")
119
124
  # https://developer.paddle.com/api-reference/customers/list-customers
120
125
  Paddle::Customer.list
121
126
  Paddle::Customer.list(status: "active")
127
+ Paddle::Customer.list(email: "me@mydomain.com")
122
128
 
123
129
  # Create a customer
124
130
  # https://developer.paddle.com/api-reference/customers/create-customer
@@ -363,6 +369,30 @@ Paddle::Notification.replay(id: "ntf_abc123")
363
369
  Paddle::Notification.logs(id: "ntf_abc123")
364
370
  ```
365
371
 
372
+ ### Reports
373
+
374
+ ```ruby
375
+ # List all reports
376
+ Paddle::Report.list
377
+
378
+ # Retrieve a report
379
+ Paddle::Report.retrieve(id: "rpt_abc123")
380
+
381
+ # Get CSV download link for a report
382
+ # Returns a raw URL. This URL is not permanent and will expire.
383
+ # https://developer.paddle.com/api-reference/reports/get-report-csv
384
+ Paddle::Report.csv(id: "rpt_abc123")
385
+
386
+ # Create a Report
387
+ # https://developer.paddle.com/api-reference/reports/create-report
388
+ Paddle::Report.create(
389
+ type: "transactions",
390
+ filters: [
391
+ {name: "updated_at", operator: "lt", value: "2024-04-30"},
392
+ {name: "updated_at", operator: "gte", value: "2024-04-01"}
393
+ ]
394
+ )
395
+ ```
366
396
 
367
397
  ## Classic API
368
398
 
@@ -14,7 +14,7 @@ module Paddle
14
14
  end
15
15
 
16
16
  def environment=(env)
17
- env = env.to_sym
17
+ env = env.nil? ? :production : env.to_sym
18
18
  unless [:development, :sandbox, :production].include?(env)
19
19
  raise ArgumentError, "#{env.inspect} is not a valid environment"
20
20
  end
@@ -0,0 +1,32 @@
1
+ module Paddle
2
+ class Report < Object
3
+
4
+ class << self
5
+
6
+ def list(**params)
7
+ response = Client.get_request("reports", params: params)
8
+ Collection.from_response(response, type: Report)
9
+ end
10
+
11
+ def create(type:, filters:, **params)
12
+ attrs = {type: type, filters: filters}
13
+ response = Client.post_request("reports", body: attrs.merge(params))
14
+ Report.new(response.body["data"])
15
+ end
16
+
17
+ def retrieve(id:)
18
+ response = Client.get_request("reports/#{id}")
19
+ Report.new(response.body["data"])
20
+ end
21
+
22
+ def csv(id:)
23
+ response = Client.get_request("reports/#{id}/download-url")
24
+ if response.success?
25
+ return response.body["data"]["url"]
26
+ end
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paddle
4
- VERSION = "2.1.3"
4
+ VERSION = "2.2.0"
5
5
  end
data/lib/paddle.rb CHANGED
@@ -39,6 +39,7 @@ 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
+ autoload :Report, "paddle/models/report"
42
43
 
43
44
  autoload :NotificationLog, "paddle/models/notification_log"
44
45
  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.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-05 00:00:00.000000000 Z
11
+ date: 2024-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
- description:
27
+ description:
28
28
  email:
29
29
  - dean@deanpcmad.com
30
30
  executables: []
@@ -83,6 +83,7 @@ files:
83
83
  - lib/paddle/models/price.rb
84
84
  - lib/paddle/models/pricing_preview.rb
85
85
  - lib/paddle/models/product.rb
86
+ - lib/paddle/models/report.rb
86
87
  - lib/paddle/models/subscription.rb
87
88
  - lib/paddle/models/transaction.rb
88
89
  - lib/paddle/object.rb
@@ -93,7 +94,7 @@ licenses: []
93
94
  metadata:
94
95
  homepage_uri: https://github.com/deanpcmad/paddle
95
96
  source_code_uri: https://github.com/deanpcmad/paddle
96
- post_install_message:
97
+ post_install_message:
97
98
  rdoc_options: []
98
99
  require_paths:
99
100
  - lib
@@ -108,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  requirements: []
111
- rubygems_version: 3.4.21
112
- signing_key:
112
+ rubygems_version: 3.5.9
113
+ signing_key:
113
114
  specification_version: 4
114
115
  summary: Ruby library for the Paddle Billing & Classic APIs
115
116
  test_files: []