quickpay-ruby-client 3.0.0 → 3.0.2

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: c8f90300ec364b0706c081ca97c62b667c09b72a619966bbb01bf7cdeb304226
4
+ data.tar.gz: ef577ec024e538394edeb1bf963eb621c8202fdd148b4b96aa327983b888cf3a
5
5
  SHA512:
6
- metadata.gz: cadad5ea2172320dd9133e6e8534d08cc1475d1b3d8d66839686eebaeba74000e0b162f8332b118cc21794299970a3c938b199f85ceff6a5b44c37405164ffaa
7
- data.tar.gz: c46b7f639b9f9359c53206a02583c5c593535601541cd8a75861666b943db5a629edfb7df58d6b25615450758b8ffa461bcb668a002b7022e511f7f2acd85ede
6
+ metadata.gz: d1c2135febd4554583e9a75f07f3dcb6e16c2b206b643c42d91c9bedb3d7d0807c4790fb2b0dcca6c08fb7f9b62112cd8c4eff48cc662b3a0d82d4d141ea9169
7
+ data.tar.gz: 21512e8cb653a7681bec3a31ff76001836298aa079338565fb65c1dc3e6e915d82be7028a969a03d4e8ca9fedb3ee103c18264be1a44adfc2437ef59824aed5f
@@ -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.2".freeze
4
4
  end
5
5
  end
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "simplecov"
28
28
  spec.add_development_dependency "simplecov-console"
29
29
 
30
- spec.add_dependency "excon", "~> 0.79.0"
31
- spec.add_dependency "json", "~> 2.5.0"
30
+ spec.add_dependency "excon", ">= 0.79"
31
+ spec.add_dependency "json", "~> 2", ">= 2.5"
32
32
  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.2
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-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,30 +112,36 @@ dependencies:
112
112
  name: excon
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.79.0
117
+ version: '0.79'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.79.0
124
+ version: '0.79'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: json
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.5.0
131
+ version: '2'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '2.5'
132
135
  type: :runtime
133
136
  prerelease: false
134
137
  version_requirements: !ruby/object:Gem::Requirement
135
138
  requirements:
136
139
  - - "~>"
137
140
  - !ruby/object:Gem::Version
138
- version: 2.5.0
141
+ version: '2'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '2.5'
139
145
  description: Embed QuickPay's secure payments directly into your Ruby applications.
140
146
  Learn more at https://tech.quickpay.net
141
147
  email:
@@ -144,8 +150,8 @@ executables: []
144
150
  extensions: []
145
151
  extra_rdoc_files: []
146
152
  files:
153
+ - ".github/workflows/test_and_lint.yml"
147
154
  - ".gitignore"
148
- - ".travis.yml"
149
155
  - CHANGELOG.md
150
156
  - Gemfile
151
157
  - LICENSE.txt
@@ -175,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
181
  - !ruby/object:Gem::Version
176
182
  version: '0'
177
183
  requirements: []
178
- rubygems_version: 3.1.2
184
+ rubygems_version: 3.3.7
179
185
  signing_key:
180
186
  specification_version: 4
181
187
  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=