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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca5a8b764dae4b1f902067e833058202619cb5b514fbc104016d2d5e78f01313
4
- data.tar.gz: 82c63035a66315b0891bd76c49e72d6405866f86139e7538c85e001af1d73563
3
+ metadata.gz: 4cabbd55e9adf58c1c43d55f2ffa55d7e908a71d5788f49e93de4534417d6f05
4
+ data.tar.gz: 621a1c186505c9661569e68086af31aff3445678a9d3105350ed88a929ea33c2
5
5
  SHA512:
6
- metadata.gz: 193a39db9033fff5e87af49e15fa42ca6945efbb8e8a65779c8e47140c2e6c517547d54d260795f71f0f681a74d32de5047d48c8be97535cee15724f968bfec6
7
- data.tar.gz: 88414b3354d28ac9924e8e36c644136366aeede634aa779e875f86aa52866aa420cd12967d10ad0f18ff301061496a8c70ff6588bc1de381d28d0c27d5e336ec
6
+ metadata.gz: b8bae12cc32ec34abd04593fe4d3514479e11a9125e17f54a612a48514954475d2e453cb1218a11310b4f8081b0d17ba5472e417ad8590e461a616dd0383a5e4
7
+ data.tar.gz: f90b9a773cee08b7c4cb8fe1d2794cb0c0cf961c0b0878f8c9bc228090043896727250cee95097fb6b605ac0c424e60f6f75ce28066d29d96f5480dd3322d0a1
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.2)
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
 
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" => "paddlerb/v#{VERSION} (github.com/deanpcmad/paddlerb)"
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
@@ -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.2"
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.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-12 00:00:00.000000000 Z
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