paddle 1.1.0 → 1.1.1
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/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: 1f17be832d6c5c21fb071570a91e66cf9c30116bd4694e23e35bc0199aded923
|
4
|
+
data.tar.gz: 47a9ba8faf8b325d857aaff5d32a48176ba3fe95d72591a60cb0d16d224e128a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 116f5798eefa20051a10a8dc290d0a9232e87d7b7d34dc9948669e8a65b789e5d784d4e795f19d9a0f6e39689bb59ca5d5781ecae83ecff880d56c2a2f354b9f
|
7
|
+
data.tar.gz: c91e17cca641255461e001d3487ba8459fc355308a49b7b1890dc7a6c7843d8336a4dc46ec651b2b95d8339cc73cbb7f5bd3118300f6d56be377f782b97b9134
|
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
|
|
@@ -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.1
|
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-19 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
|