paddle 2.1.4 → 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: 18ca722e2dfa03afa07ccc605919184d6f13ebb594c163c5f4ea0ff2bb4ab242
4
- data.tar.gz: d4d42ff9ab6370b90ecc965a26a936fcabffd455f98d88a1bc43ed39779e6f91
3
+ metadata.gz: b0c36c67374aa35e91a2497199311888ef26eb0265cd14dddf57f535e7dabb6e
4
+ data.tar.gz: 287d3e39a116eb4b19bba68baaa0772c67306e0f47249c81c815a29ab5a82f0f
5
5
  SHA512:
6
- metadata.gz: 9a33e4d7f8462e8c4a987d6bc621b920e29b6aada8cc1076f204e38f9cac69fa733dfed1f12e5447ec4dd148db25b0a0fd01ef39641534dc2ba7466b95416451
7
- data.tar.gz: 697890a2b7465aa1b563fef5e4a388792dbe4325e22582fa16d8b727b5dab2d49702fd90859bbdd056709cba7ad16977706ef463965b1d51ebf35c7a1216c46b
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.4)
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
@@ -369,6 +369,30 @@ Paddle::Notification.replay(id: "ntf_abc123")
369
369
  Paddle::Notification.logs(id: "ntf_abc123")
370
370
  ```
371
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
+ ```
372
396
 
373
397
  ## Classic API
374
398
 
@@ -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.4"
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paddle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
@@ -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
@@ -108,7 +109,7 @@ 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.22
112
+ rubygems_version: 3.5.9
112
113
  signing_key:
113
114
  specification_version: 4
114
115
  summary: Ruby library for the Paddle Billing & Classic APIs