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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca5a8b764dae4b1f902067e833058202619cb5b514fbc104016d2d5e78f01313
4
- data.tar.gz: 82c63035a66315b0891bd76c49e72d6405866f86139e7538c85e001af1d73563
3
+ metadata.gz: 1f17be832d6c5c21fb071570a91e66cf9c30116bd4694e23e35bc0199aded923
4
+ data.tar.gz: 47a9ba8faf8b325d857aaff5d32a48176ba3fe95d72591a60cb0d16d224e128a
5
5
  SHA512:
6
- metadata.gz: 193a39db9033fff5e87af49e15fa42ca6945efbb8e8a65779c8e47140c2e6c517547d54d260795f71f0f681a74d32de5047d48c8be97535cee15724f968bfec6
7
- data.tar.gz: 88414b3354d28ac9924e8e36c644136366aeede634aa779e875f86aa52866aa420cd12967d10ad0f18ff301061496a8c70ff6588bc1de381d28d0c27d5e336ec
6
+ metadata.gz: 116f5798eefa20051a10a8dc290d0a9232e87d7b7d34dc9948669e8a65b789e5d784d4e795f19d9a0f6e39689bb59ca5d5781ecae83ecff880d56c2a2f354b9f
7
+ data.tar.gz: c91e17cca641255461e001d3487ba8459fc355308a49b7b1890dc7a6c7843d8336a4dc46ec651b2b95d8339cc73cbb7f5bd3118300f6d56be377f782b97b9134
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paddle (1.1.0)
4
+ paddle (1.1.1)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,15 +1,13 @@
1
- # PaddleRB
1
+ # Paddle Ruby Library
2
2
 
3
- PaddleRB is a Ruby library for interacting with the Paddle APIs, both Classic and Billing.
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 "paddlerb"
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/paddlerb.
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paddle
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
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.0
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-12 00:00:00.000000000 Z
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