paypro 0.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/build.yml +54 -0
- data/.gitignore +8 -44
- data/.rspec +3 -0
- data/.rubocop.yml +36 -17
- data/Gemfile +14 -2
- data/LICENSE +1 -1
- data/README.md +77 -15
- data/Rakefile +7 -1
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/lib/data/{ca-bundle.crt → cacert.pem} +1724 -2013
- data/lib/pay_pro/api_client.rb +131 -0
- data/lib/pay_pro/client.rb +67 -0
- data/lib/pay_pro/config.rb +30 -0
- data/lib/pay_pro/endpoint.rb +19 -0
- data/lib/pay_pro/endpoints/chargebacks.rb +14 -0
- data/lib/pay_pro/endpoints/customers.rb +15 -0
- data/lib/pay_pro/endpoints/events.rb +14 -0
- data/lib/pay_pro/endpoints/installment_plan_periods.rb +13 -0
- data/lib/pay_pro/endpoints/installment_plans.rb +15 -0
- data/lib/pay_pro/endpoints/mandates.rb +15 -0
- data/lib/pay_pro/endpoints/pay_methods.rb +13 -0
- data/lib/pay_pro/endpoints/payments.rb +15 -0
- data/lib/pay_pro/endpoints/refunds.rb +14 -0
- data/lib/pay_pro/endpoints/subscription_periods.rb +13 -0
- data/lib/pay_pro/endpoints/subscriptions.rb +15 -0
- data/lib/pay_pro/endpoints/webhooks.rb +15 -0
- data/lib/pay_pro/entities/chargeback.rb +5 -0
- data/lib/pay_pro/entities/customer.rb +10 -0
- data/lib/pay_pro/entities/entity.rb +41 -0
- data/lib/pay_pro/entities/event.rb +5 -0
- data/lib/pay_pro/entities/installment_plan.rb +29 -0
- data/lib/pay_pro/entities/installment_plan_period.rb +5 -0
- data/lib/pay_pro/entities/list.rb +65 -0
- data/lib/pay_pro/entities/mandate.rb +5 -0
- data/lib/pay_pro/entities/pay_method.rb +6 -0
- data/lib/pay_pro/entities/payment.rb +23 -0
- data/lib/pay_pro/entities/refund.rb +11 -0
- data/lib/pay_pro/entities/resource.rb +13 -0
- data/lib/pay_pro/entities/subscription.rb +38 -0
- data/lib/pay_pro/entities/subscription_period.rb +5 -0
- data/lib/pay_pro/entities/webhook.rb +30 -0
- data/lib/pay_pro/errors.rb +36 -0
- data/lib/pay_pro/operations/creatable.rb +11 -0
- data/lib/pay_pro/operations/deletable.rb +11 -0
- data/lib/pay_pro/operations/getable.rb +11 -0
- data/lib/pay_pro/operations/listable.rb +11 -0
- data/lib/pay_pro/operations/requestable.rb +12 -0
- data/lib/pay_pro/operations/updatable.rb +11 -0
- data/lib/pay_pro/response.rb +21 -0
- data/lib/pay_pro/signature.rb +59 -0
- data/lib/pay_pro/util.rb +48 -0
- data/lib/pay_pro/version.rb +5 -0
- data/lib/pay_pro.rb +77 -0
- data/paypro.gemspec +20 -11
- metadata +69 -45
- data/.circleci/config.yml +0 -54
- data/VERSION +0 -1
- data/examples/create_payment.rb +0 -5
- data/lib/paypro/client.rb +0 -66
- data/lib/paypro/errors.rb +0 -4
- data/lib/paypro/version.rb +0 -3
- data/lib/paypro.rb +0 -14
- data/spec/paypro/client_spec.rb +0 -112
- data/spec/paypro_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1b607a221258fa5d8bfe0bda8f604acb345d0e89066f8f86089386932762b3ca
|
4
|
+
data.tar.gz: ebc0b753e9d234c911a34af6e95a7bf733c85b60ff1c2f316bb73e2e812f98ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c481bd099168f64341e52b444ab2780737910d51932864912d57becb6ae8a618c2042b4046059d4a7ec8ad34d1a5189e15acca6e19c68487c494fde6083c2bf
|
7
|
+
data.tar.gz: 0aed28248485b406f8a3d15acc98acf8ec7932077f35f625c251f4df731fa4aae33fe34e640461fffd2501468b061450151e399ba7507f299bc42392fbead0c6
|
@@ -0,0 +1,54 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- 'master'
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- '**'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
name: Build
|
14
|
+
needs: test
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: 3.0
|
23
|
+
- name: Build
|
24
|
+
run: gem build paypro.gemspec
|
25
|
+
|
26
|
+
lint:
|
27
|
+
name: Lint
|
28
|
+
runs-on: ubuntu-latest
|
29
|
+
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v3
|
32
|
+
- name: Set up Ruby
|
33
|
+
uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: 3.0
|
36
|
+
- name: Lint
|
37
|
+
run: bundle install && bundle exec rubocop
|
38
|
+
|
39
|
+
test:
|
40
|
+
name: Test (${{ matrix.ruby-version }})
|
41
|
+
needs: lint
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
strategy:
|
44
|
+
matrix:
|
45
|
+
ruby-version: ['3.0', 3.1, 3.2]
|
46
|
+
|
47
|
+
steps:
|
48
|
+
- uses: actions/checkout@v3
|
49
|
+
- name: Set up Ruby
|
50
|
+
uses: ruby/setup-ruby@v1
|
51
|
+
with:
|
52
|
+
ruby-version: ${{ matrix.ruby-version }}
|
53
|
+
- name: Test
|
54
|
+
run: bundle install && bundle exec rspec
|
data/.gitignore
CHANGED
@@ -1,50 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
4
|
/coverage/
|
5
|
-
/
|
5
|
+
/doc/
|
6
6
|
/pkg/
|
7
7
|
/spec/reports/
|
8
|
-
/spec/examples.txt
|
9
|
-
/test/tmp/
|
10
|
-
/test/version_tmp/
|
11
8
|
/tmp/
|
9
|
+
*.DS_Store
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
## Specific to RubyMotion:
|
17
|
-
.dat*
|
18
|
-
.repl_history
|
19
|
-
build/
|
20
|
-
*.bridgesupport
|
21
|
-
build-iPhoneOS/
|
22
|
-
build-iPhoneSimulator/
|
23
|
-
|
24
|
-
## Specific to RubyMotion (use of CocoaPods):
|
25
|
-
#
|
26
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
-
#
|
30
|
-
# vendor/Pods/
|
31
|
-
|
32
|
-
## Documentation cache and generated files:
|
33
|
-
/.yardoc/
|
34
|
-
/_yardoc/
|
35
|
-
/doc/
|
36
|
-
/rdoc/
|
37
|
-
|
38
|
-
## Environment normalization:
|
39
|
-
/.bundle/
|
40
|
-
/vendor/bundle
|
41
|
-
/lib/bundler/man/
|
42
|
-
|
43
|
-
# for a library or gem, you might want to ignore these files since the code is
|
44
|
-
# intended to run in multiple environments; otherwise, check them in:
|
45
|
-
# Gemfile.lock
|
46
|
-
# .ruby-version
|
47
|
-
# .ruby-gemset
|
11
|
+
.rspec_status
|
12
|
+
.ruby-version
|
48
13
|
|
49
|
-
|
50
|
-
.rvmrc
|
14
|
+
Gemfile.lock
|
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
@@ -1,20 +1,39 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
4
|
+
|
1
5
|
AllCops:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Metrics/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
NewCops: enable
|
7
|
+
SuggestExtensions: false
|
8
|
+
TargetRubyVersion: 3.0
|
9
|
+
|
10
|
+
# We disable this to allow automatic releases
|
11
|
+
Gemspec/RequireMFA:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Max: 30
|
16
|
+
|
17
|
+
Metrics/ClassLength:
|
18
|
+
CountAsOne: ['array', 'hash', 'heredoc', 'method_call']
|
19
|
+
Max: 100
|
20
|
+
|
21
|
+
Metrics/MethodLength:
|
22
|
+
Max: 30
|
23
|
+
|
24
|
+
RSpec/ExampleLength:
|
25
|
+
CountAsOne: ['array', 'hash', 'heredoc']
|
26
|
+
Max: 10
|
27
|
+
|
28
|
+
RSpec/MultipleMemoizedHelpers:
|
15
29
|
Enabled: false
|
16
|
-
|
30
|
+
|
31
|
+
RSpec/NestedGroups:
|
32
|
+
Max: 5
|
33
|
+
|
34
|
+
Style/Documentation:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/FrozenStringLiteralComment:
|
17
38
|
Exclude:
|
18
|
-
- '
|
19
|
-
- '**/*.rake'
|
20
|
-
- 'spec/**/*.rb'
|
39
|
+
- 'bin/**'
|
data/Gemfile
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
5
|
+
# Specify your gem's dependencies in paypro.gemspec
|
3
6
|
gemspec
|
4
7
|
|
5
8
|
group :development do
|
6
|
-
gem '
|
7
|
-
gem '
|
9
|
+
gem 'debug', '~> 1.8.0'
|
10
|
+
gem 'rake', '~> 12.0'
|
11
|
+
gem 'rspec', '~> 3.0'
|
12
|
+
|
13
|
+
gem 'rubocop', '~> 1.57'
|
14
|
+
gem 'rubocop-performance', '~> 1.19.0'
|
15
|
+
gem 'rubocop-rspec', '~> 2.25.0'
|
16
|
+
|
17
|
+
gem 'timecop', '~> 0.9.8'
|
18
|
+
|
19
|
+
gem 'webmock', '~> 3.19.0'
|
8
20
|
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,36 +1,98 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# PayPro Ruby Library
|
2
|
+
|
3
|
+
[![build](https://github.com/paypronl/paypro-ruby/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/paypronl/paypro-ruby/actions/workflows/build.yml)
|
3
4
|
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
|
4
5
|
|
5
|
-
|
6
|
+
The PayPro Ruby library can be used to make integrating with the PayPro API easier when using Ruby.
|
7
|
+
It provides easy to use classes to interact with all resources available through the API.
|
8
|
+
|
9
|
+
It also provides the following:
|
10
|
+
|
11
|
+
- Built-in pagination support
|
12
|
+
- Easy configuration
|
13
|
+
- Webhook request verification helpers
|
6
14
|
|
7
15
|
## Requirements
|
8
16
|
|
9
|
-
|
17
|
+
- Ruby >= 3.0.0
|
10
18
|
|
11
19
|
## Installation
|
12
20
|
|
13
|
-
|
21
|
+
You can install the gem like this:
|
22
|
+
|
23
|
+
```sh
|
24
|
+
gem install paypro
|
25
|
+
```
|
26
|
+
|
27
|
+
If you'd rather install the gem through `bundler` you can put this in your Gemfile:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
source 'https://rubygems.org'
|
31
|
+
|
32
|
+
gem 'paypro'
|
33
|
+
|
34
|
+
```
|
14
35
|
|
15
36
|
## Getting started
|
16
37
|
|
17
|
-
|
38
|
+
In order to use the API you need to have a valid API key.
|
39
|
+
You can find your API key in the [PayPro dashboard](https://app.paypro.nl/developers/api-keys)
|
40
|
+
|
41
|
+
Example of using the API:
|
18
42
|
|
19
43
|
```ruby
|
20
44
|
require 'paypro'
|
21
45
|
|
22
|
-
client = PayPro::Client.new('
|
23
|
-
|
24
|
-
|
25
|
-
client.
|
46
|
+
client = PayPro::Client.new('pp_...')
|
47
|
+
|
48
|
+
# Creating a payment
|
49
|
+
payment = client.payments.create({ amount: 500, currency: 'EUR', description: 'Test Payment' })
|
50
|
+
|
51
|
+
# Retrieving all subscriptions
|
52
|
+
subscriptions = client.subscriptions.list
|
53
|
+
|
54
|
+
# Retrieving a single customer
|
55
|
+
customer = client.customers.get('CUSSDGDCJVZH5K')
|
56
|
+
|
26
57
|
```
|
27
58
|
|
28
|
-
##
|
59
|
+
## Per-request configuration
|
29
60
|
|
30
|
-
|
61
|
+
When you have multiple API keys to use during a single request, you can specify these in all requests.
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
require 'paypro'
|
65
|
+
|
66
|
+
client = PayPro::Client.new('pp_...')
|
67
|
+
|
68
|
+
# Creating a payment
|
69
|
+
payment = client.payments.create({ amount: 500, currency: 'EUR', description: 'Test Payment' }, api_key: 'pp_...')
|
70
|
+
|
71
|
+
# Retrieving five subscriptions
|
72
|
+
subscriptions = client.subscriptions.list({ limit: 5 }, api_key: 'pp_...')
|
73
|
+
|
74
|
+
# Retrieving a single customer
|
75
|
+
customer = client.customers.get('CUSSDGDCJVZH5K', api_key: 'pp_...', api_url: 'https://api-test.paypro.nl')
|
76
|
+
```
|
77
|
+
|
78
|
+
## Development
|
31
79
|
|
32
|
-
## Contributing
|
33
80
|
If you want to contribute to this project you can fork the repository. Create a new branch, add your feature and create a pull request. We will look at your request and determine if we want to add it.
|
34
81
|
|
35
|
-
|
36
|
-
|
82
|
+
To run all the tests:
|
83
|
+
|
84
|
+
```sh
|
85
|
+
bundle exec rspec
|
86
|
+
```
|
87
|
+
|
88
|
+
To run the linter:
|
89
|
+
|
90
|
+
```sh
|
91
|
+
bundle exec rubocop
|
92
|
+
```
|
93
|
+
|
94
|
+
To run an `irb` with the gem already required you can use:
|
95
|
+
|
96
|
+
```sh
|
97
|
+
bin/console
|
98
|
+
```
|
data/Rakefile
CHANGED
data/bin/console
ADDED