paddle 1.1.0 → 1.1.2
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 +15 -13
- data/lib/paddle/client.rb +1 -1
- data/lib/paddle/models/pricing_preview.rb +15 -0
- data/lib/paddle/models/transaction.rb +0 -6
- data/lib/paddle/version.rb +1 -1
- data/lib/paddle.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cabbd55e9adf58c1c43d55f2ffa55d7e908a71d5788f49e93de4534417d6f05
|
4
|
+
data.tar.gz: 621a1c186505c9661569e68086af31aff3445678a9d3105350ed88a929ea33c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8bae12cc32ec34abd04593fe4d3514479e11a9125e17f54a612a48514954475d2e453cb1218a11310b4f8081b0d17ba5472e417ad8590e461a616dd0383a5e4
|
7
|
+
data.tar.gz: f90b9a773cee08b7c4cb8fe1d2794cb0c0cf961c0b0878f8c9bc228090043896727250cee95097fb6b605ac0c424e60f6f75ce28066d29d96f5480dd3322d0a1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# Paddle Ruby Library
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
**This library is currently under development for Paddle's new Billing APIs**
|
3
|
+
A Ruby library for the Paddle APIs, both Classic and Billing.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
7
|
Add this line to your application's Gemfile:
|
10
8
|
|
11
9
|
```ruby
|
12
|
-
gem "
|
10
|
+
gem "paddle"
|
13
11
|
```
|
14
12
|
|
15
13
|
## Billing API
|
@@ -78,6 +76,17 @@ Paddle::Price.retrieve(id: "pri_123abc")
|
|
78
76
|
Paddle::Price.update(id: "pri_123abc", description: "An updated description")
|
79
77
|
```
|
80
78
|
|
79
|
+
### Pricing Preview
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
# Preview calculations for one or more prices
|
83
|
+
# This is normally used when building pricing pages
|
84
|
+
# https://developer.paddle.com/api-reference/pricing-preview/preview-prices
|
85
|
+
Paddle::PricingPreview.generate(items: [ { price_id: "pri_123abc", quantity: 5 } ])
|
86
|
+
Paddle::PricingPreview.generate(items: [ { price_id: "pri_123abc", quantity: 5 } ], currency_code: "GBP")
|
87
|
+
Paddle::PricingPreview.generate(items: [ { price_id: "pri_123abc", quantity: 5 } ], customer_ip_address: "1.1.1.1")
|
88
|
+
```
|
89
|
+
|
81
90
|
### Discounts
|
82
91
|
|
83
92
|
```ruby
|
@@ -182,13 +191,6 @@ Paddle::Transaction.update(id: "txn_abc123", items: [ { price_id: "pri_abc123",
|
|
182
191
|
# https://developer.paddle.com/api-reference/transaction/preview-transaction
|
183
192
|
Paddle::Transaction.preview(items: [ { price_id: "pri_123abc", quantity: 5 } ])
|
184
193
|
|
185
|
-
# Preview calculations for one or more prices
|
186
|
-
# This is normally used when building pricing pages
|
187
|
-
# https://developer.paddle.com/api-reference/transaction/preview-prices
|
188
|
-
Paddle::Transaction.preview_prices(items: [ { price_id: "pri_123abc", quantity: 5 } ])
|
189
|
-
Paddle::Transaction.preview_prices(items: [ { price_id: "pri_123abc", quantity: 5 } ], currency_code: "GBP")
|
190
|
-
Paddle::Transaction.preview_prices(items: [ { price_id: "pri_123abc", quantity: 5 } ], customer_ip_address: "1.1.1.1")
|
191
|
-
|
192
194
|
# Get a PDF invoice for a transaction
|
193
195
|
# Returns a raw URL. This URL is not permanent and will expire.
|
194
196
|
# https://developer.paddle.com/api-reference/transaction/get-invoice-pdf
|
@@ -395,7 +397,7 @@ or [here for sandbox](https://sandbox-vendors.paddle.com/authentication)
|
|
395
397
|
|
396
398
|
## Contributing
|
397
399
|
|
398
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/
|
400
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/paddle.
|
399
401
|
|
400
402
|
## License
|
401
403
|
|
data/lib/paddle/client.rb
CHANGED
@@ -8,7 +8,7 @@ module Paddle
|
|
8
8
|
conn.request :authorization, :Bearer, Paddle.config.api_key
|
9
9
|
|
10
10
|
conn.headers = {
|
11
|
-
"User-Agent" => "
|
11
|
+
"User-Agent" => "paddle/v#{VERSION} (github.com/deanpcmad/paddle)"
|
12
12
|
}
|
13
13
|
|
14
14
|
conn.request :json
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Paddle
|
2
|
+
class PricingPreview < Object
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def generate(items:, **params)
|
7
|
+
attrs = {items: items}
|
8
|
+
response = Client.post_request("pricing-preview", body: attrs.merge(params))
|
9
|
+
PricingPreview.new(response.body["data"])
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -37,12 +37,6 @@ module Paddle
|
|
37
37
|
Transaction.new(response.body["data"])
|
38
38
|
end
|
39
39
|
|
40
|
-
def preview_prices(items:, **params)
|
41
|
-
attrs = {items: items}
|
42
|
-
response = Client.post_request("pricing-preview", body: attrs.merge(params))
|
43
|
-
Transaction.new(response.body["data"])
|
44
|
-
end
|
45
|
-
|
46
40
|
end
|
47
41
|
|
48
42
|
end
|
data/lib/paddle/version.rb
CHANGED
data/lib/paddle.rb
CHANGED
@@ -27,6 +27,7 @@ module Paddle
|
|
27
27
|
# Load Billing APIs
|
28
28
|
autoload :Product, "paddle/models/product"
|
29
29
|
autoload :Price, "paddle/models/price"
|
30
|
+
autoload :PricingPreview, "paddle/models/pricing_preview"
|
30
31
|
autoload :Discount, "paddle/models/discount"
|
31
32
|
autoload :Customer, "paddle/models/customer"
|
32
33
|
autoload :Address, "paddle/models/address"
|
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: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/paddle/models/notification_log.rb
|
81
81
|
- lib/paddle/models/notification_setting.rb
|
82
82
|
- lib/paddle/models/price.rb
|
83
|
+
- lib/paddle/models/pricing_preview.rb
|
83
84
|
- lib/paddle/models/product.rb
|
84
85
|
- lib/paddle/models/subscription.rb
|
85
86
|
- lib/paddle/models/transaction.rb
|