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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -1
- data/lib/paddle/client.rb +2 -1
- data/lib/paddle/configuration.rb +2 -0
- data/lib/paddle/models/subscription.rb +3 -2
- data/lib/paddle/models/transaction.rb +3 -2
- data/lib/paddle/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa102f9ad5b6adcf43a522ef2fd512d16e8493b186aa8129c5c6014751fa4274
|
4
|
+
data.tar.gz: 8d13d5a6cd7420bad3bca2f38057327ac44392db4022dac8edbc013cb1470091
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fdbf156519a8bce53914f2cf034b224a8249499029c773d7f7f167433252da2f90e733773ac0dcb9ff1b2314271b6dd7f22bfdddfe7acbc41e6772b6b71c508
|
7
|
+
data.tar.gz: 1af00167e992c18f7af0110ebc66540dd0b7b1928ba3db77e69dd87c79a3f2505c1d66153447dce34f161b6c8c9eeb4317312e0531dd0a862eeb1806a2735240
|
data/Gemfile.lock
CHANGED
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.
|
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
|
data/lib/paddle/configuration.rb
CHANGED
@@ -8,8 +8,9 @@ module Paddle
|
|
8
8
|
Collection.from_response(response, type: Subscription)
|
9
9
|
end
|
10
10
|
|
11
|
-
def retrieve(id:)
|
12
|
-
|
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
|
-
|
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
|
|
data/lib/paddle/version.rb
CHANGED