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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47a7b8b3bec59cf6276448d2e8eb29149288518b12d0df8e377fc10783bb6090
4
- data.tar.gz: d80a3b9b3deda68bea662dd67a5937ea724a7aa58d44ec7fde61c74c588b9e43
3
+ metadata.gz: 4b77653ec5b31422dd4fc26d7e928dc75b548d8a1eacbf7e079005fad609aa2c
4
+ data.tar.gz: a76f37cca4ef1ca13c8367928ed7062ad09693908902432bbf1a06c5e7698022
5
5
  SHA512:
6
- metadata.gz: cadad5ea2172320dd9133e6e8534d08cc1475d1b3d8d66839686eebaeba74000e0b162f8332b118cc21794299970a3c938b199f85ceff6a5b44c37405164ffaa
7
- data.tar.gz: c46b7f639b9f9359c53206a02583c5c593535601541cd8a75861666b943db5a629edfb7df58d6b25615450758b8ffa461bcb668a002b7022e511f7f2acd85ede
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
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.1
4
+
5
+ * Fixed bug where variations of Content-Type application/json got scrubbed, fx application/json;charset=UTF-8 (https://github.com/QuickPay/quickpay-ruby-client/pull/41)
6
+
3
7
  ## 3.0.0
4
8
 
5
9
  ### Breaking changes
data/README.md CHANGED
@@ -20,7 +20,7 @@ or install from Rubygems:
20
20
  $ gem install quickpay-ruby-client
21
21
  ```
22
22
 
23
- It is currently tested with Ruby ( >= 2.5.x)
23
+ It is currently tested with Ruby ( >= 2.6.x)
24
24
 
25
25
  * MRI
26
26
  * Rubinius (2.0)
@@ -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"] == "application/json" && data.instance_of?(Hash)
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"] =~ %r{application/json}
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 ["application/json", "application/x-www-form-urlencoded"].include?(content_type)
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}>"
@@ -54,7 +54,7 @@ module QuickPay
54
54
 
55
55
  def to_s
56
56
  "#<#{self.class}: status=#{status}, body=#{body.inspect}, " \
57
- "headers=#{headers.inspect} request=#{request.inspect}>"
57
+ "headers=#{headers.inspect} request=#{request.inspect}>"
58
58
  end
59
59
  alias_method :inspect, :to_s
60
60
 
@@ -1,5 +1,5 @@
1
1
  module QuickPay
2
2
  module API
3
- VERSION = "3.0.0".freeze
3
+ VERSION = "3.0.1".freeze
4
4
  end
5
5
  end
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.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: 2021-03-21 00:00:00.000000000 Z
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.1.2
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=