paddlerb 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.example +2 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +52 -0
- data/README.md +35 -0
- data/Rakefile +12 -0
- data/bin/console +20 -0
- data/bin/setup +8 -0
- data/lib/paddle/client.rb +74 -0
- data/lib/paddle/collection.rb +27 -0
- data/lib/paddle/error.rb +4 -0
- data/lib/paddle/object.rb +19 -0
- data/lib/paddle/objects/charge.rb +4 -0
- data/lib/paddle/objects/coupon.rb +4 -0
- data/lib/paddle/objects/license.rb +4 -0
- data/lib/paddle/objects/modifier.rb +4 -0
- data/lib/paddle/objects/pay_link.rb +4 -0
- data/lib/paddle/objects/payment.rb +4 -0
- data/lib/paddle/objects/payment_refund.rb +4 -0
- data/lib/paddle/objects/plan.rb +4 -0
- data/lib/paddle/objects/product.rb +4 -0
- data/lib/paddle/objects/transaction.rb +4 -0
- data/lib/paddle/objects/user.rb +4 -0
- data/lib/paddle/objects/webhook.rb +4 -0
- data/lib/paddle/resource.rb +61 -0
- data/lib/paddle/resources/charges.rb +11 -0
- data/lib/paddle/resources/coupons.rb +31 -0
- data/lib/paddle/resources/licenses.rb +13 -0
- data/lib/paddle/resources/modifiers.rb +24 -0
- data/lib/paddle/resources/pay_links.rb +11 -0
- data/lib/paddle/resources/payments.rb +22 -0
- data/lib/paddle/resources/plans.rb +19 -0
- data/lib/paddle/resources/products.rb +10 -0
- data/lib/paddle/resources/transactions.rb +10 -0
- data/lib/paddle/resources/users.rb +28 -0
- data/lib/paddle/resources/webhooks.rb +10 -0
- data/lib/paddle/version.rb +5 -0
- data/lib/paddle.rb +41 -0
- data/lib/paddlerb.rb +1 -0
- data/paddlerb.gemspec +33 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d29bab2cc198f4a6f157226dc74aecd5004253267126616c2f474b2e900377ca
|
4
|
+
data.tar.gz: 610847cc06d3bc542c33d8417b9c32721adee4b89a13afd1e78c376ada42212b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 188e53b50fe7ecb07f9d2cca75a44f1b3532ff5c4577f13ce29b12582ef083cc40442398a8d918b7fd3be73d7034feec26138a60c94a8d58a15f1536abb2d016
|
7
|
+
data.tar.gz: a20504bc60b6e43986e7502685eb8568b7d9858e8bbb4dcfdb862246b92b3d5e6f6241b9c1e0575d15ee182a7957c5657f812a08c11054c4a19b68d5455face7
|
data/.env.example
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
paddlerb (0.1.1)
|
5
|
+
faraday (~> 1.7)
|
6
|
+
faraday_middleware (~> 1.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
dotenv (2.7.6)
|
12
|
+
faraday (1.9.3)
|
13
|
+
faraday-em_http (~> 1.0)
|
14
|
+
faraday-em_synchrony (~> 1.0)
|
15
|
+
faraday-excon (~> 1.1)
|
16
|
+
faraday-httpclient (~> 1.0)
|
17
|
+
faraday-multipart (~> 1.0)
|
18
|
+
faraday-net_http (~> 1.0)
|
19
|
+
faraday-net_http_persistent (~> 1.0)
|
20
|
+
faraday-patron (~> 1.0)
|
21
|
+
faraday-rack (~> 1.0)
|
22
|
+
faraday-retry (~> 1.0)
|
23
|
+
ruby2_keywords (>= 0.0.4)
|
24
|
+
faraday-em_http (1.0.0)
|
25
|
+
faraday-em_synchrony (1.0.0)
|
26
|
+
faraday-excon (1.1.0)
|
27
|
+
faraday-httpclient (1.0.1)
|
28
|
+
faraday-multipart (1.0.3)
|
29
|
+
multipart-post (>= 1.2, < 3)
|
30
|
+
faraday-net_http (1.0.1)
|
31
|
+
faraday-net_http_persistent (1.2.0)
|
32
|
+
faraday-patron (1.0.0)
|
33
|
+
faraday-rack (1.0.0)
|
34
|
+
faraday-retry (1.0.3)
|
35
|
+
faraday_middleware (1.2.0)
|
36
|
+
faraday (~> 1.0)
|
37
|
+
minitest (5.14.4)
|
38
|
+
multipart-post (2.1.1)
|
39
|
+
rake (13.0.6)
|
40
|
+
ruby2_keywords (0.0.5)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
x86_64-linux
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
dotenv
|
47
|
+
minitest (~> 5.0)
|
48
|
+
paddlerb!
|
49
|
+
rake (~> 13.0)
|
50
|
+
|
51
|
+
BUNDLED WITH
|
52
|
+
2.3.5
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Paddle
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/paddle`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem "paddlerb"
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install paddle
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/paddle.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "paddle"
|
6
|
+
|
7
|
+
# Load environment variables from .env file
|
8
|
+
require 'dotenv/load'
|
9
|
+
|
10
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
11
|
+
# with your gem easier. You can also use a different console, if you like.
|
12
|
+
|
13
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
14
|
+
# require "pry"
|
15
|
+
# Pry.start
|
16
|
+
|
17
|
+
@client = Paddle::Client.new(vendor_id: ENV["PADDLE_VENDOR_ID"], vendor_auth_code: ENV["PADDLE_VENDOR_AUTH_CODE"], sandbox: true)
|
18
|
+
|
19
|
+
require "irb"
|
20
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
module Paddle
|
2
|
+
class Client
|
3
|
+
BASE_URL = "https://vendors.paddle.com/api"
|
4
|
+
SANDBOX_BASE_URL = "https://sandbox-vendors.paddle.com/api"
|
5
|
+
|
6
|
+
attr_reader :vendor_id, :vendor_auth_code, :sandbox, :adapter
|
7
|
+
|
8
|
+
def initialize(vendor_id:, vendor_auth_code:, sandbox: false, adapter: Faraday.default_adapter, stubs: nil)
|
9
|
+
@vendor_id = vendor_id
|
10
|
+
@vendor_auth_code = vendor_auth_code
|
11
|
+
@sandbox = sandbox
|
12
|
+
@adapter = adapter
|
13
|
+
|
14
|
+
# Test stubs for requests
|
15
|
+
@stubs = stubs
|
16
|
+
end
|
17
|
+
|
18
|
+
def plans
|
19
|
+
PlansResource.new(self)
|
20
|
+
end
|
21
|
+
|
22
|
+
def coupons
|
23
|
+
CouponsResource.new(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
def products
|
27
|
+
ProductsResource.new(self)
|
28
|
+
end
|
29
|
+
|
30
|
+
def licenses
|
31
|
+
LicensesResource.new(self)
|
32
|
+
end
|
33
|
+
|
34
|
+
def pay_links
|
35
|
+
PayLinksResource.new(self)
|
36
|
+
end
|
37
|
+
|
38
|
+
def transactions
|
39
|
+
TransactionsResource.new(self)
|
40
|
+
end
|
41
|
+
|
42
|
+
def payments
|
43
|
+
PaymentsResource.new(self)
|
44
|
+
end
|
45
|
+
|
46
|
+
def users
|
47
|
+
UsersResource.new(self)
|
48
|
+
end
|
49
|
+
|
50
|
+
def webhooks
|
51
|
+
WebhooksResource.new(self)
|
52
|
+
end
|
53
|
+
|
54
|
+
def modifiers
|
55
|
+
ModifiersResource.new(self)
|
56
|
+
end
|
57
|
+
|
58
|
+
def charges
|
59
|
+
ChargesResource.new(self)
|
60
|
+
end
|
61
|
+
|
62
|
+
def connection
|
63
|
+
url = (sandbox == true ? SANDBOX_BASE_URL : BASE_URL)
|
64
|
+
@connection ||= Faraday.new(url) do |conn|
|
65
|
+
conn.request :json
|
66
|
+
|
67
|
+
conn.response :dates
|
68
|
+
conn.response :json, content_type: "application/json"
|
69
|
+
|
70
|
+
conn.adapter adapter, @stubs
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Paddle
|
2
|
+
class Collection
|
3
|
+
attr_reader :data, :total
|
4
|
+
|
5
|
+
def self.from_response(response, type:, key: nil)
|
6
|
+
body = response.body
|
7
|
+
|
8
|
+
if key.is_a?(String)
|
9
|
+
data = body["response"][key].map { |attrs| type.new(attrs) }
|
10
|
+
total = body["response"]["total"]
|
11
|
+
else
|
12
|
+
data = body["response"].map { |attrs| type.new(attrs) }
|
13
|
+
total = body["response"].count
|
14
|
+
end
|
15
|
+
|
16
|
+
new(
|
17
|
+
data: data,
|
18
|
+
total: total
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(data:, total:)
|
23
|
+
@data = data
|
24
|
+
@total = total
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/paddle/error.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
|
3
|
+
module Paddle
|
4
|
+
class Object < OpenStruct
|
5
|
+
def initialize(attributes)
|
6
|
+
super to_ostruct(attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_ostruct(obj)
|
10
|
+
if obj.is_a?(Hash)
|
11
|
+
OpenStruct.new(obj.map { |key, val| [key, to_ostruct(val)] }.to_h)
|
12
|
+
elsif obj.is_a?(Array)
|
13
|
+
obj.map { |o| to_ostruct(o) }
|
14
|
+
else # Assumed to be a primitive value
|
15
|
+
obj
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Paddle
|
2
|
+
class Resource
|
3
|
+
attr_reader :client
|
4
|
+
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# def get_request(url, params: {}, headers: {})
|
12
|
+
# handle_response client.connection.get(url, params, headers)
|
13
|
+
# end
|
14
|
+
|
15
|
+
def post_request(url, body: {}, headers: {})
|
16
|
+
attrs = {vendor_id: client.vendor_id, vendor_auth_code: client.vendor_auth_code}
|
17
|
+
handle_response client.connection.post(url, attrs.merge(body), headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
# def patch_request(url, body:, headers: {})
|
21
|
+
# handle_response client.connection.patch(url, body, headers)
|
22
|
+
# end
|
23
|
+
|
24
|
+
# def put_request(url, body:, headers: {})
|
25
|
+
# handle_response client.connection.put(url, body, headers)
|
26
|
+
# end
|
27
|
+
|
28
|
+
# def delete_request(url, params: {}, headers: {})
|
29
|
+
# handle_response client.connection.delete(url, params, headers)
|
30
|
+
# end
|
31
|
+
|
32
|
+
def handle_response(response)
|
33
|
+
case response.status
|
34
|
+
when 400
|
35
|
+
raise Error, "Error 400: Your request was malformed. '#{response.body["message"]}'"
|
36
|
+
when 401
|
37
|
+
raise Error, "Error 401: You did not supply valid authentication credentials. '#{response.body["error"]}'"
|
38
|
+
when 403
|
39
|
+
raise Error, "Error 403: You are not allowed to perform that action. '#{response.body["error"]}'"
|
40
|
+
when 404
|
41
|
+
raise Error, "Error 404: No results were found for your request. '#{response.body["error"]}'"
|
42
|
+
when 409
|
43
|
+
raise Error, "Error 409: Your request was a conflict. '#{response.body["message"]}'"
|
44
|
+
when 429
|
45
|
+
raise Error, "Error 429: Your request exceeded the API rate limit. '#{response.body["error"]}'"
|
46
|
+
when 500
|
47
|
+
raise Error, "Error 500: We were unable to perform the request due to server-side problems. '#{response.body["error"]}'"
|
48
|
+
when 503
|
49
|
+
raise Error, "Error 503: You have been rate limited for sending more than 20 requests per second. '#{response.body["error"]}'"
|
50
|
+
when 501
|
51
|
+
raise Error, "Error 501: This resource has not been implemented. '#{response.body["error"]}'"
|
52
|
+
end
|
53
|
+
|
54
|
+
if response.body && response.body["error"]
|
55
|
+
raise Error, "Error #{response.body["error"]["code"]} - #{response.body["error"]["message"]}"
|
56
|
+
end
|
57
|
+
|
58
|
+
response
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Paddle
|
2
|
+
class ChargesResource < Resource
|
3
|
+
|
4
|
+
def create(subscription_id:, amount:, charge_name:)
|
5
|
+
attrs = {amount: amount, charge_name: charge_name}
|
6
|
+
response = post_request("2.0/subscription/#{subscription_id}/charge", body: attrs)
|
7
|
+
Charge.new(response.body["response"])
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Paddle
|
2
|
+
class CouponsResource < Resource
|
3
|
+
|
4
|
+
def list(product_id:)
|
5
|
+
response = post_request("2.0/product/list_coupons", body: {product_id: product_id})
|
6
|
+
Collection.from_response(response, type: Coupon)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create(coupon_type:, discount_type:, discount_amount:, **params)
|
10
|
+
attrs = {coupon_type: coupon_type, discount_type: discount_type, discount_amount: discount_amount}
|
11
|
+
|
12
|
+
response = post_request("2.1/product/create_coupon", body: attrs.merge(params))
|
13
|
+
|
14
|
+
coupons = response.body["response"]["coupon_codes"]
|
15
|
+
|
16
|
+
coupons.map {|c| Paddle::Coupon.new(code: c)}
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete(coupon_code:, product_id:)
|
20
|
+
attrs = {coupon_code: coupon_code, product_id: product_id}
|
21
|
+
response = post_request("2.0/product/delete_coupon", body: attrs)
|
22
|
+
return true if response.success?
|
23
|
+
end
|
24
|
+
|
25
|
+
def update(**params)
|
26
|
+
response = post_request("2.1/product/update_coupon", body: params)
|
27
|
+
return true if response.success?
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Paddle
|
2
|
+
class LicensesResource < Resource
|
3
|
+
|
4
|
+
def generate(product_id:, allowed_uses:, **params)
|
5
|
+
attrs = {product_id: product_id, allowed_uses: allowed_uses}
|
6
|
+
|
7
|
+
response = post_request("2.0/product/generate_license", body: attrs.merge(params))
|
8
|
+
|
9
|
+
License.new(response.body["response"]) if response.success?
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Paddle
|
2
|
+
class ModifiersResource < Resource
|
3
|
+
|
4
|
+
def list(**params)
|
5
|
+
response = post_request("2.0/subscription/modifiers", body: params)
|
6
|
+
Collection.from_response(response, type: Modifier)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create(subscription_id:, modifier_amount:, **params)
|
10
|
+
attrs = {subscription_id: subscription_id, modifier_amount: modifier_amount}
|
11
|
+
create_response = post_request("2.0/subscription/modifiers/create", body: attrs.merge(params))
|
12
|
+
|
13
|
+
response = post_request("2.0/subscription/modifiers", body: {subscription_id: subscription_id} )
|
14
|
+
Collection.from_response(response, type: Modifier)
|
15
|
+
end
|
16
|
+
|
17
|
+
def delete(modifier_id:)
|
18
|
+
attrs = {modifier_id: modifier_id}
|
19
|
+
response = post_request("2.0/subscription/modifiers/delete", body: attrs)
|
20
|
+
return true if response.success?
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Paddle
|
2
|
+
class PaymentsResource < Resource
|
3
|
+
|
4
|
+
def list(**params)
|
5
|
+
response = post_request("2.0/subscription/payments", body: params)
|
6
|
+
Collection.from_response(response, type: Payment)
|
7
|
+
end
|
8
|
+
|
9
|
+
def reschedule(payment_id:, date:)
|
10
|
+
attrs = {payment_id: payment_id, date: date}
|
11
|
+
response = post_request("2.0/subscription/payments_reschedule", body: attrs)
|
12
|
+
return true if response.success?
|
13
|
+
end
|
14
|
+
|
15
|
+
def refund(order_id:, **params)
|
16
|
+
attrs = {order_id: order_id}
|
17
|
+
response = post_request("2.0/payment/refund", body: attrs.merge(params))
|
18
|
+
PaymentRefund.new(response.body["response"])
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Paddle
|
2
|
+
class PlansResource < Resource
|
3
|
+
|
4
|
+
def list
|
5
|
+
response = post_request("2.0/subscription/plans")
|
6
|
+
Collection.from_response(response, type: Plan)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create(name:, type:, **params)
|
10
|
+
attrs = {plan_name: name, plan_type: type}
|
11
|
+
create_response = post_request("2.0/subscription/plans_create", body: attrs.merge(params))
|
12
|
+
|
13
|
+
# After creating the Plan, because it doesn't return the whole record, grab it from the API and return that
|
14
|
+
response = post_request("2.0/subscription/plans", body: {plan: create_response.body["response"]["product_id"]} )
|
15
|
+
Plan.new(response.body.dig("response")[0]) if response.success?
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Paddle
|
2
|
+
class UsersResource < Resource
|
3
|
+
|
4
|
+
def list(**params)
|
5
|
+
response = post_request("2.0/subscription/users", body: params)
|
6
|
+
Collection.from_response(response, type: User)
|
7
|
+
end
|
8
|
+
|
9
|
+
def update(subscription_id:, **params)
|
10
|
+
attrs = {subscription_id: subscription_id}
|
11
|
+
response = post_request("2.0/subscription/users/update", body: attrs.merge(params))
|
12
|
+
User.new(response.body["response"]) if response.success?
|
13
|
+
end
|
14
|
+
|
15
|
+
def update_postcode(subscription_id:, postcode:)
|
16
|
+
attrs = {subscription_id: subscription_id, postcode: postcode}
|
17
|
+
response = post_request("2.0/subscription/users/postcode", body: attrs)
|
18
|
+
return true if response.success?
|
19
|
+
end
|
20
|
+
|
21
|
+
def cancel(subscription_id:)
|
22
|
+
attrs = {subscription_id: subscription_id}
|
23
|
+
response = post_request("2.0/subscription/users_cancel", body: attrs)
|
24
|
+
return true if response.success?
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/lib/paddle.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "faraday_middleware"
|
5
|
+
|
6
|
+
require_relative "paddle/version"
|
7
|
+
|
8
|
+
module Paddle
|
9
|
+
|
10
|
+
autoload :Client, "paddle/client"
|
11
|
+
autoload :Collection, "paddle/collection"
|
12
|
+
autoload :Error, "paddle/error"
|
13
|
+
autoload :Resource, "paddle/resource"
|
14
|
+
autoload :Object, "paddle/object"
|
15
|
+
|
16
|
+
autoload :PlansResource, "paddle/resources/plans"
|
17
|
+
autoload :CouponsResource, "paddle/resources/coupons"
|
18
|
+
autoload :ProductsResource, "paddle/resources/products"
|
19
|
+
autoload :LicensesResource, "paddle/resources/licenses"
|
20
|
+
autoload :PayLinksResource, "paddle/resources/pay_links"
|
21
|
+
autoload :TransactionsResource, "paddle/resources/transactions"
|
22
|
+
autoload :PaymentsResource, "paddle/resources/payments"
|
23
|
+
autoload :UsersResource, "paddle/resources/users"
|
24
|
+
autoload :WebhooksResource, "paddle/resources/webhooks"
|
25
|
+
autoload :ModifiersResource, "paddle/resources/modifiers"
|
26
|
+
autoload :ChargesResource, "paddle/resources/charges"
|
27
|
+
|
28
|
+
autoload :Plan, "paddle/objects/plan"
|
29
|
+
autoload :Coupon, "paddle/objects/coupon"
|
30
|
+
autoload :Product, "paddle/objects/product"
|
31
|
+
autoload :License, "paddle/objects/license"
|
32
|
+
autoload :PayLink, "paddle/objects/pay_link"
|
33
|
+
autoload :Transaction, "paddle/objects/transaction"
|
34
|
+
autoload :Payment, "paddle/objects/payment"
|
35
|
+
autoload :PaymentRefund, "paddle/objects/payment_refund"
|
36
|
+
autoload :User, "paddle/objects/user"
|
37
|
+
autoload :Webhook, "paddle/objects/webhook"
|
38
|
+
autoload :Modifier, "paddle/objects/modifier"
|
39
|
+
autoload :Charge, "paddle/objects/charge"
|
40
|
+
|
41
|
+
end
|
data/lib/paddlerb.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "paddle"
|
data/paddlerb.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/paddle/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "paddlerb"
|
7
|
+
spec.version = Paddle::VERSION
|
8
|
+
spec.authors = ["Dean Perry"]
|
9
|
+
spec.email = ["dean@deanpcmad.com"]
|
10
|
+
|
11
|
+
spec.summary = "Ruby library for interacting with the Paddle API"
|
12
|
+
# spec.description = "TODO: Write a longer description or delete this line."
|
13
|
+
spec.homepage = "https://github.com/deanpcmad/paddlerb"
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/deanpcmad/paddlerb"
|
18
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_dependency "faraday", "~> 1.7"
|
32
|
+
spec.add_dependency "faraday_middleware", "~> 1.1"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paddlerb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dean Perry
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- dean@deanpcmad.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".env.example"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- bin/console
|
54
|
+
- bin/setup
|
55
|
+
- lib/paddle.rb
|
56
|
+
- lib/paddle/client.rb
|
57
|
+
- lib/paddle/collection.rb
|
58
|
+
- lib/paddle/error.rb
|
59
|
+
- lib/paddle/object.rb
|
60
|
+
- lib/paddle/objects/charge.rb
|
61
|
+
- lib/paddle/objects/coupon.rb
|
62
|
+
- lib/paddle/objects/license.rb
|
63
|
+
- lib/paddle/objects/modifier.rb
|
64
|
+
- lib/paddle/objects/pay_link.rb
|
65
|
+
- lib/paddle/objects/payment.rb
|
66
|
+
- lib/paddle/objects/payment_refund.rb
|
67
|
+
- lib/paddle/objects/plan.rb
|
68
|
+
- lib/paddle/objects/product.rb
|
69
|
+
- lib/paddle/objects/transaction.rb
|
70
|
+
- lib/paddle/objects/user.rb
|
71
|
+
- lib/paddle/objects/webhook.rb
|
72
|
+
- lib/paddle/resource.rb
|
73
|
+
- lib/paddle/resources/charges.rb
|
74
|
+
- lib/paddle/resources/coupons.rb
|
75
|
+
- lib/paddle/resources/licenses.rb
|
76
|
+
- lib/paddle/resources/modifiers.rb
|
77
|
+
- lib/paddle/resources/pay_links.rb
|
78
|
+
- lib/paddle/resources/payments.rb
|
79
|
+
- lib/paddle/resources/plans.rb
|
80
|
+
- lib/paddle/resources/products.rb
|
81
|
+
- lib/paddle/resources/transactions.rb
|
82
|
+
- lib/paddle/resources/users.rb
|
83
|
+
- lib/paddle/resources/webhooks.rb
|
84
|
+
- lib/paddle/version.rb
|
85
|
+
- lib/paddlerb.rb
|
86
|
+
- paddlerb.gemspec
|
87
|
+
homepage: https://github.com/deanpcmad/paddlerb
|
88
|
+
licenses: []
|
89
|
+
metadata:
|
90
|
+
homepage_uri: https://github.com/deanpcmad/paddlerb
|
91
|
+
source_code_uri: https://github.com/deanpcmad/paddlerb
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 2.6.0
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubygems_version: 3.2.22
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Ruby library for interacting with the Paddle API
|
111
|
+
test_files: []
|