paddle 2.0.0 → 2.1.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: 752f7683042e6de26cf820e4e1223ac99b697100fd65f7680b2808fe5d0e1f44
4
- data.tar.gz: c34ef3933969ef4a62277d68f42040883e886226e1b092a687075b5c03db33e0
3
+ metadata.gz: fa102f9ad5b6adcf43a522ef2fd512d16e8493b186aa8129c5c6014751fa4274
4
+ data.tar.gz: 8d13d5a6cd7420bad3bca2f38057327ac44392db4022dac8edbc013cb1470091
5
5
  SHA512:
6
- metadata.gz: 378eecb14a3a505c1c6e5e63cb08679cbc1f36487086e5d0b27cb37a61b9807aee53cb8d68e199a6bd950e11b539036750646544848cd98ef9bc946d1f43261b
7
- data.tar.gz: d214b18631249d7a8056c2ab82d9a414a3022982e93c4a4dbf2a7d370f99e7a3beeddbde95fd17e511891569839ed7111bbab307f7e0a6d8718916221e5da1b5
6
+ metadata.gz: 2fdbf156519a8bce53914f2cf034b224a8249499029c773d7f7f167433252da2f90e733773ac0dcb9ff1b2314271b6dd7f22bfdddfe7acbc41e6772b6b71c508
7
+ data.tar.gz: 1af00167e992c18f7af0110ebc66540dd0b7b1928ba3db77e69dd87c79a3f2505c1d66153447dce34f161b6c8c9eeb4317312e0531dd0a862eeb1806a2735240
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paddle (2.0.0)
4
+ paddle (2.1.0)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
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.0"
10
+ gem "paddle", "~> 2.1"
11
11
  ```
12
12
 
13
13
  ## Billing API
@@ -27,6 +27,9 @@ Paddle.configure do |config|
27
27
  # Or use :production for the Production API
28
28
  config.environment = :sandbox
29
29
  config.api_key = ENV["PADDLE_API_KEY"]
30
+
31
+ # Set the API version. Defaults to 1
32
+ config.version = 1
30
33
  end
31
34
  ```
32
35
 
@@ -183,6 +186,10 @@ Paddle::Transaction.create(items: [ { price_id: "pri_abc123", quantity: 1 } ])
183
186
  # Retrieve a transaction
184
187
  Paddle::Transaction.retrieve(id: "txn_abc123")
185
188
 
189
+ # Retrieve a transaction with extra information
190
+ # extra can be either "address", "adjustment", "adjustments_totals", "business", "customer", "discount"
191
+ Paddle::Transaction.retrieve(id: "txn_abc123", extra: "customer")
192
+
186
193
  # Update a transaction
187
194
  # https://developer.paddle.com/api-reference/transaction/update-transaction
188
195
  Paddle::Transaction.update(id: "txn_abc123", items: [ { price_id: "pri_abc123", quantity: 2 } ])
@@ -211,6 +218,10 @@ Paddle::Subscription.list(status: "canceled")
211
218
  # Retrieve a subscription
212
219
  Paddle::Subscription.retrieve(id: "sub_abc123")
213
220
 
221
+ # Retrieve a subscription with extra information
222
+ # extra can be either "next_transaction" or "recurring_transaction_details"
223
+ Paddle::Subscription.retrieve(id: "sub_abc123", extra: "next_transaction")
224
+
214
225
  # Preview an update to a subscription
215
226
  # https://developer.paddle.com/api-reference/subscriptions/preview-subscription
216
227
  Paddle::Subscription.preview(id: "sub_abc123", items: [ { price_id: "pri_123abc", quantity: 2 } ])
data/lib/paddle/client.rb CHANGED
@@ -8,7 +8,8 @@ module Paddle
8
8
  conn.request :authorization, :Bearer, Paddle.config.api_key
9
9
 
10
10
  conn.headers = {
11
- "User-Agent" => "paddle/v#{VERSION} (github.com/deanpcmad/paddle)"
11
+ "User-Agent" => "paddle/v#{VERSION} (github.com/deanpcmad/paddle)",
12
+ "Paddle-Version" => Paddle.config.version.to_s
12
13
  }
13
14
 
14
15
  conn.request :json
@@ -5,10 +5,12 @@ module Paddle
5
5
 
6
6
  attr_reader :environment
7
7
 
8
+ attr_accessor :version
8
9
  attr_accessor :api_key
9
10
 
10
11
  def initialize
11
12
  @environment ||= :production
13
+ @version ||= 1
12
14
  end
13
15
 
14
16
  def environment=(env)
@@ -8,8 +8,9 @@ module Paddle
8
8
  Collection.from_response(response, type: Subscription)
9
9
  end
10
10
 
11
- def retrieve(id:)
12
- response = Client.get_request("subscriptions/#{id}")
11
+ def retrieve(id:, extra: nil)
12
+ params = extra ? {include: extra} : {}
13
+ response = Client.get_request("subscriptions/#{id}", params: params)
13
14
  Subscription.new(response.body["data"])
14
15
  end
15
16
 
@@ -14,8 +14,9 @@ module Paddle
14
14
  Transaction.new(response.body["data"])
15
15
  end
16
16
 
17
- def retrieve(id:)
18
- response = Client.get_request("transactions/#{id}")
17
+ def retrieve(id:, extra: nil)
18
+ params = extra ? {include: extra} : {}
19
+ response = Client.get_request("transactions/#{id}", params: params)
19
20
  Transaction.new(response.body["data"])
20
21
  end
21
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paddle
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
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.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry