quickpay-ruby-client 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test_and_lint.yml +63 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/quickpay/api/client.rb +5 -3
- data/lib/quickpay/api/error.rb +1 -1
- data/lib/quickpay/api/version.rb +1 -1
- metadata +4 -4
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b77653ec5b31422dd4fc26d7e928dc75b548d8a1eacbf7e079005fad609aa2c
|
4
|
+
data.tar.gz: a76f37cca4ef1ca13c8367928ed7062ad09693908902432bbf1a06c5e7698022
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d277a6931dd4278ce8ad0c920b5bc927099d562d9bfa20ece87ede5aa9ebf644cd58f5f6b7bdc925409e1237be510059b28a19f197e6161e7811c359eae2c2c4
|
7
|
+
data.tar.gz: f7dc3bf85c3e222d3c3aa0cd481e8cbd4ead238b6e30e35c6f7d3e12d9b19a169962f93ff15cabeb2f00e964af256a8db077fc87ed953328fed75530bd31eb62
|
@@ -0,0 +1,63 @@
|
|
1
|
+
name: Test and Lint on Push and PR
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: "ubuntu-20.04"
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby:
|
11
|
+
- "2.6"
|
12
|
+
- "2.7"
|
13
|
+
- "3.0"
|
14
|
+
- "3.1"
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: QuickPay/quickpay-base-action@v2.2
|
18
|
+
with:
|
19
|
+
rubocop: true
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
bundler-cache: true
|
24
|
+
- run: bundle exec rake
|
25
|
+
publish:
|
26
|
+
runs-on: "ubuntu-20.04"
|
27
|
+
needs:
|
28
|
+
test
|
29
|
+
if: ${{ github.ref == 'refs/heads/master' }}
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: 3.1
|
35
|
+
bundler-cache: true
|
36
|
+
- name: Setup gem credentials
|
37
|
+
run: |
|
38
|
+
mkdir ~/.gem && echo ":rubygems_api_key: ${{secrets.BUNDLE_RUBYGEMS__ORG}}" > ~/.gem/credentials && chmod 0600 ~/.gem/credentials
|
39
|
+
- name: Retrieve versions
|
40
|
+
run: |
|
41
|
+
echo "##[set-output name=versions;]$(gem search '^quickpay-ruby-client$' --all --prerelease | grep -o '\((.*)\)$' | tr -d '() ' | tr ',' "|" | sort)"
|
42
|
+
id: extract_versions
|
43
|
+
- name: Retrieve Current Versions
|
44
|
+
run: |
|
45
|
+
ruby -e "
|
46
|
+
require './lib/quickpay/api/version.rb'
|
47
|
+
versions = '${{ steps.extract_versions.outputs.versions }}'.strip.split('|').map {|x| Gem::Version.new x }
|
48
|
+
unless versions.include? Gem::Version.new(QuickPay::API::VERSION)
|
49
|
+
puts('##[set-output name=version;]' + QuickPay::API::VERSION)
|
50
|
+
end
|
51
|
+
"
|
52
|
+
id: extract_version
|
53
|
+
- name: Push gem
|
54
|
+
if: ${{ steps.extract_version.outputs.version != '' }}
|
55
|
+
run: gem build && gem push *.gem
|
56
|
+
- name: Create Release
|
57
|
+
if: ${{ steps.extract_version.outputs.version != '' }}
|
58
|
+
uses: zendesk/action-create-release@v1
|
59
|
+
env:
|
60
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
61
|
+
with:
|
62
|
+
tag_name: ${{ steps.extract_version.outputs.version }}
|
63
|
+
release_name: Release ${{ steps.extract_version.outputs.version }}
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/quickpay/api/client.rb
CHANGED
@@ -11,6 +11,8 @@ module QuickPay
|
|
11
11
|
"Accept-Version" => "v10"
|
12
12
|
}.freeze
|
13
13
|
|
14
|
+
CONTENT_TYPE_JSON_REGEX = %r{application/.*json}.freeze
|
15
|
+
|
14
16
|
Request = Struct.new(:method, :path, :body, :headers, :query) # rubocop:disable Lint/StructNewOverride
|
15
17
|
|
16
18
|
def initialize(username: nil, password: nil, base_uri: "https://api.quickpay.net", options: {})
|
@@ -32,7 +34,7 @@ module QuickPay
|
|
32
34
|
headers = DEFAULT_HEADERS.merge(options.fetch(:headers, {}))
|
33
35
|
body = begin
|
34
36
|
data = options.fetch(:body, "")
|
35
|
-
if headers["Content-Type"]
|
37
|
+
if CONTENT_TYPE_JSON_REGEX.match(headers["Content-Type"]) && data.instance_of?(Hash)
|
36
38
|
data.to_json
|
37
39
|
else
|
38
40
|
data
|
@@ -50,7 +52,7 @@ module QuickPay
|
|
50
52
|
res = @connection.request(**req.to_h)
|
51
53
|
error = QuickPay::API::Error.by_status_code(res.status, res.body, res.headers, req)
|
52
54
|
|
53
|
-
if !options.fetch(:raw, false) && res.headers["Content-Type"] =~
|
55
|
+
if !options.fetch(:raw, false) && res.headers["Content-Type"] =~ CONTENT_TYPE_JSON_REGEX
|
54
56
|
res.body = JSON.parse(res.body, options[:json_opts] || @connection.data[:json_opts])
|
55
57
|
end
|
56
58
|
|
@@ -72,7 +74,7 @@ module QuickPay
|
|
72
74
|
def scrub_body(body, content_type)
|
73
75
|
return "" if body.to_s.empty?
|
74
76
|
|
75
|
-
if [
|
77
|
+
if [CONTENT_TYPE_JSON_REGEX, %r{application/x-www-form-urlencoded}].any? { |regex| regex.match(content_type) }
|
76
78
|
body
|
77
79
|
else
|
78
80
|
"<scrubbed for Content-Type #{content_type}>"
|
data/lib/quickpay/api/error.rb
CHANGED
data/lib/quickpay/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickpay-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QuickPay Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,8 +144,8 @@ executables: []
|
|
144
144
|
extensions: []
|
145
145
|
extra_rdoc_files: []
|
146
146
|
files:
|
147
|
+
- ".github/workflows/test_and_lint.yml"
|
147
148
|
- ".gitignore"
|
148
|
-
- ".travis.yml"
|
149
149
|
- CHANGELOG.md
|
150
150
|
- Gemfile
|
151
151
|
- LICENSE.txt
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
178
|
+
rubygems_version: 3.3.7
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Ruby client for QuickPay API
|
data/.travis.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.5
|
4
|
-
- 2.6
|
5
|
-
- 2.7
|
6
|
-
- 3.0
|
7
|
-
cache: bundler
|
8
|
-
before_script: wget -O ~/.rubocop.yml https://quickpay.github.io/development/.rubocop.yml
|
9
|
-
script: bundle exec rake
|
10
|
-
notifications:
|
11
|
-
slack:
|
12
|
-
secure: SixeTgiVsOaeWyKwICxLJ0GLN/C9j6qW1ZdaEytIDuZaBAn9oArrRGkJiehFdlzcPUHwzMWC0vl9GQzyBhZ7dbq+B53QY1mH9LTb9A53Y2d1OO1kBjJAkC5Yprvpjm52+x889Dwlz0bfLETvLsC2ej0NZDvSSLKFjpZZIZMOWkg=
|