quickpay-ruby-client 2.0.2 → 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: 91565e7af3c4fd77cf7e3d177635d0f203c344048dc10bffea8f663f272ba366
4
- data.tar.gz: ceafaae3f9b50c62060dcaa2beaefe763d68b139b342346541e6f9b350364fb3
3
+ metadata.gz: 4b77653ec5b31422dd4fc26d7e928dc75b548d8a1eacbf7e079005fad609aa2c
4
+ data.tar.gz: a76f37cca4ef1ca13c8367928ed7062ad09693908902432bbf1a06c5e7698022
5
5
  SHA512:
6
- metadata.gz: 4aa48a70180b0c458a664f9e40dd3ada6d4ddec514af8d07efe71b8cad9392560b41880559af39ecbb878eaabd71f18cc278b708af16b44855f3f896fc175d37
7
- data.tar.gz: 1be9621ba17c2760b1c8369a63f4cc9f1f3effbee2d239de0b96779534ed7d4112c772d235897ebe48ec49c2c2f8d0afdf2d08fb4277a8e052937119b5846a63
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,6 +1,67 @@
1
1
  # Changelog
2
2
 
3
- ## master
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
+
7
+ ## 3.0.0
8
+
9
+ ### Breaking changes
10
+
11
+ The interface has been changed to (https://github.com/QuickPay/quickpay-ruby-client/pull/36):
12
+
13
+ - always return an array for all request types (incl. when adding the `raw: true` option)
14
+ - order the array as `[body, status, headers]` (was `[status, body, headers]`
15
+ - always parse JSON body unless the `raw: true` option is set
16
+
17
+ The reasoning is that we almost always want the `body`, but in some case we want `status`and/or `headers` as well. Before we had to set the `raw: true` option, but then a JSON body would not be parsed.
18
+
19
+ ```ruby
20
+ body, = client.get("/ping")
21
+ body, status, = client.get("/ping")
22
+ body, status, headers = client.get("/ping")
23
+ body, status, headers = client.get("/ping", raw: true)
24
+ ```
25
+
26
+ ### New features
27
+
28
+ #### Blocks
29
+
30
+ You can now pass a block to a request (https://github.com/QuickPay/quickpay-ruby-client/pull/32):
31
+
32
+ ```ruby
33
+ msg = client.get("/ping") do |body, status, headers, error|
34
+ case error
35
+ when nil
36
+ body["msg"]
37
+ when QuickPay::API::NotFound
38
+ nil
39
+ else
40
+ raise error
41
+ end
42
+ end
43
+ ```
44
+
45
+ #### Verbose errors
46
+
47
+ The `QuickPay::API::Error` now includes the request that yielded the error - for example:
48
+
49
+ ```
50
+ #<QuickPay::API::Error::NotFound:
51
+ status=404,
52
+ body="404 Not Found",
53
+ headers={"Server"=>"nginx", "Date"=>"Sun, 21 Mar 2021 09:10:12 GMT", "Connection"=>"keep-alive", "X-Cascade"=>"pass", "Vary"=>"Origin"}
54
+ request=#<struct QuickPay::API::Client::Request
55
+ method=:post,
56
+ path="/payments",
57
+ body="{\"currency\":\"DKK\",\"order_id\":\"1212\"}",
58
+ headers={"User-Agent"=>"quickpay-ruby-client, v2.0.3", "Accept-Version"=>"v10", "Content-Type"=>"application/json"},
59
+ query=nil>>
60
+ ```
61
+
62
+ ## v2.0.3
63
+
64
+ * Add the possibility of settins options for JSON parser
4
65
 
5
66
  ## v2.0.2
6
67
 
data/README.md CHANGED
@@ -19,8 +19,8 @@ or install from Rubygems:
19
19
  ```
20
20
  $ gem install quickpay-ruby-client
21
21
  ```
22
-
23
- It is currently tested with Ruby ( >= 2.1.x)
22
+
23
+ It is currently tested with Ruby ( >= 2.6.x)
24
24
 
25
25
  * MRI
26
26
  * Rubinius (2.0)
@@ -31,7 +31,7 @@ Before doing anything you should register yourself with QuickPay and get access
31
31
 
32
32
  ### Create a new API client
33
33
 
34
- First you should create a client instance that is anonymous or authorized with your API key or login credentials provided by QuickPay.
34
+ First you should create a client instance that is anonymous or authorized with your API key or login credentials provided by QuickPay.
35
35
 
36
36
  To initialise an anonymous client:
37
37
 
@@ -57,22 +57,72 @@ client = QuickPay::API::Client.new(username: ENV["QUICKPAY_LOGIN"], password: EN
57
57
  You can also set some connection specific options (default values shown):
58
58
 
59
59
  ```ruby
60
- client = Quickpay::API::Client.new(
61
- read_timeout: 60,
62
- write_timeout: 60,
63
- connect_timeout: 60,
64
- )
60
+ client = QuickPay::API::Client.new(
61
+ options: {
62
+ read_timeout: 60,
63
+ write_timeout: 60,
64
+ connect_timeout: 60,
65
+ json_opts: { symbolize_names: false }
66
+ }
67
+ )
65
68
  ```
66
69
 
67
-
68
70
  ### Sending request
69
71
 
70
72
  You can afterwards call any method described in QuickPay API with corresponding http method and endpoint. These methods are supported currently: `get`, `post`, `put`, `patch`, `delete` and `head`.
71
73
 
74
+ Any request will return an array in the form `[body, status, headers]`:
75
+
76
+ ```ruby
77
+ # Shortest form when interested in the response body only
78
+ body, = client.get("/ping")
79
+ puts body.inspect
80
+
81
+ # Get all response information
82
+ body, status, headers = client.get("/ping")
83
+ puts body.inspect, status.inspect, headers.inspect
84
+
85
+ ```
86
+
87
+ You can also do requests in block form:
88
+
89
+ ```ruby
90
+ client.get("/ping") do |body, status, headers|
91
+ puts body.inspect
92
+ end
93
+ ```
94
+
95
+ It is even possible to pass the `QuickPay::API::Error` to the block as the 4th parameter to be able to handle the errors that _would_ have otherwise been raised. This parameter is nil when the response is a success.
96
+
97
+ ```ruby
98
+ # the error is not raised but passed to the block as the fourth parameter
99
+ client.get("/ping") do |body, status, headers, error|
100
+ case error
101
+ when nil
102
+ body[:id]
103
+ when QuickPay::API::NotFound
104
+ nil
105
+ else
106
+ raise error
107
+ end
108
+ end
109
+
110
+ # will raise `QuickPay::API::Error::NotFound` since the fourth block param is not defined
111
+ client.get("/non-existing-path") do |body, status, headers| do
112
+ end
113
+ ```
114
+
115
+ If you want raw http response body, you can add `:raw => true` parameter:
116
+
72
117
  ```ruby
73
- client.get("/activity").each do |activity|
74
- puts activity["id"]
118
+ body, status, headers = client.get("/ping", raw: true)
119
+
120
+ if status == 200
121
+ puts JSON.parse(body).inspect
122
+ else
123
+ # do something else
75
124
  end
125
+
76
126
  ```
77
127
 
78
128
  Beyond the endpoint, the client accepts the following options (default values shown):
@@ -81,33 +131,22 @@ Beyond the endpoint, the client accepts the following options (default values sh
81
131
  * `headers: {}`
82
132
  * `query: {}`
83
133
  * `raw: false`
134
+ * `json_opts: nil`
135
+
136
+ Full example:
84
137
 
85
138
  ```ruby
86
- response = client.post(
139
+ response, = client.post(
87
140
  "/payments/1/capture",
88
141
  body: { amount: 100 }.to_json,
89
142
  headers: { "Content-Type" => "application/json" },
90
143
  query: { "synchronized" => "" },
91
- raw: false
144
+ raw: false,
145
+ json_opts: { symbolize_names: true }
92
146
  )
93
147
 
94
148
  ```
95
149
 
96
- If you want raw http response, headers Please add `:raw => true` parameter:
97
-
98
- ```ruby
99
- status, body, headers = client.get("/activity", raw: true)
100
-
101
- if status == 200
102
- JSON.parse(body).each do |activity|
103
- puts activity["id"]
104
- end
105
- else
106
- # do something else
107
- end
108
-
109
- ```
110
-
111
150
  ### Handling API exceptions
112
151
 
113
152
  By default `(get|post|patch|put|delete)` will return JSON parsed body on success (i.e. `2xx` response code) otherwise it will raise appropriate error. Your code should handle the errors appropriately. Following error codes are supported currently:
@@ -116,7 +155,7 @@ By default `(get|post|patch|put|delete)` will return JSON parsed body on success
116
155
  Response status | Error |
117
156
  ----------------| ----------|
118
157
  `400` | `QuickPay::API::BadRequest`
119
- `401` | `QuickPay::API::Unauthorized`
158
+ `401` | `QuickPay::API::Unauthorized`
120
159
  `402` | `QuickPay::API::PaymentRequired`
121
160
  `403` | `QuickPay::API::Forbidden`
122
161
  `404` | `QuickPay::API::NotFound`
@@ -132,12 +171,27 @@ All exceptions inherits `QuickPay::API::Error`, so you can listen for any api er
132
171
 
133
172
  ```ruby
134
173
  begin
135
- client.post("/payments", body: { currency: "DKK", order_id: "1212" })
174
+ client.post("/payments", body: { currency: "DKK", order_id: "1212" }, headers: { "Content-Type" => "application/json" })
136
175
  rescue QuickPay::API::Error => e
137
- puts e.body
176
+ puts e.inspect
138
177
  end
139
178
  ```
140
179
 
180
+ Example error object:
181
+
182
+ ```
183
+ #<QuickPay::API::Error::NotFound:
184
+ status=404,
185
+ body="404 Not Found",
186
+ headers={"Server"=>"nginx", "Date"=>"Sun, 21 Mar 2021 09:10:12 GMT", "Connection"=>"keep-alive", "X-Cascade"=>"pass", "Vary"=>"Origin"}
187
+ request=#<struct QuickPay::API::Client::Request
188
+ method=:post,
189
+ path="/payments",
190
+ body="{\"currency\":\"DKK\",\"order_id\":\"1212\"}",
191
+ headers={"User-Agent"=>"quickpay-ruby-client, v2.0.3", "Accept-Version"=>"v10", "Content-Type"=>"application/json"},
192
+ query=nil>>
193
+ ```
194
+
141
195
  You can read more about QuickPay API responses at [https://learn.quickpay.net/tech-talk/api](https://learn.quickpay.net/tech-talk/api).
142
196
 
143
197
  ## Contributions
@@ -153,5 +207,5 @@ To contribute:
153
207
  ### Running the specs
154
208
 
155
209
  ```
156
- $ bundle exec ruby test/client.rb
210
+ $ bundle exec rake test
157
211
  ```
data/Rakefile CHANGED
@@ -2,22 +2,32 @@ require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
  require "rubocop/rake_task"
4
4
 
5
- RuboCop::RakeTask.new
5
+ task default: :test
6
6
 
7
- task :opts do
8
- ENV["TESTOPTS"] = "--verbose"
7
+ desc "Open an irb/pry session"
8
+ task :console do
9
+ exec "bin/console"
9
10
  end
10
11
 
11
- desc "Run tests with verbose output"
12
- task "test:verbose" => %i[opts test]
12
+ namespace :test do
13
+ RuboCop::RakeTask.new
13
14
 
14
- desc "Run tests"
15
- task :test do |t|
16
- Rake::TestTask.new(t.name) do |tt|
17
- tt.libs << "."
18
- tt.test_files = Dir.glob("test/*.rb")
19
- tt.warning = false
15
+ task :opts do
16
+ ENV["TESTOPTS"] = "--verbose"
20
17
  end
18
+
19
+ desc "Run tests"
20
+ task :specs do |t|
21
+ Rake::TestTask.new(t.name) do |tt|
22
+ tt.libs << "."
23
+ tt.test_files = Dir.glob("test/*.rb")
24
+ tt.warning = false
25
+ end
26
+ end
27
+
28
+ desc "Run tests with verbose output"
29
+ task verbose: %i[opts test]
21
30
  end
22
31
 
23
- task default: %i[test rubocop]
32
+ desc "Run test suite"
33
+ task test: ["test:specs", "test:rubocop"]
data/bin/console ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ ENV["APP_KIND"] = "console"
3
+ APP_ROOT = File.realdirpath(File.expand_path("..", __dir__))
4
+ $LOAD_PATH.unshift(APP_ROOT)
5
+
6
+ require "irb"
7
+ require "lib/quickpay/api/client"
8
+
9
+ CLIENT = QuickPay::API::Client.new
10
+
11
+ ARGV.clear
12
+ IRB.start
@@ -11,11 +11,16 @@ module QuickPay
11
11
  "Accept-Version" => "v10"
12
12
  }.freeze
13
13
 
14
+ CONTENT_TYPE_JSON_REGEX = %r{application/.*json}.freeze
15
+
16
+ Request = Struct.new(:method, :path, :body, :headers, :query) # rubocop:disable Lint/StructNewOverride
17
+
14
18
  def initialize(username: nil, password: nil, base_uri: "https://api.quickpay.net", options: {})
15
19
  opts = {
16
20
  read_timeout: options.fetch(:read_timeout, 60),
17
21
  write_timeout: options.fetch(:write_timeout, 60),
18
- connect_timeout: options.fetch(:connect_timeout, 60)
22
+ connect_timeout: options.fetch(:connect_timeout, 60),
23
+ json_opts: options.fetch(:json_opts, nil)
19
24
  }
20
25
 
21
26
  opts[:username] = Excon::Utils.escape_uri(username) if username
@@ -25,34 +30,56 @@ module QuickPay
25
30
  end
26
31
 
27
32
  %i[get post patch put delete head].each do |method|
28
- define_method(method) do |path, options = {}|
33
+ define_method(method) do |path, **options, &block|
29
34
  headers = DEFAULT_HEADERS.merge(options.fetch(:headers, {}))
30
35
  body = begin
31
36
  data = options.fetch(:body, "")
32
- if headers["Content-Type"] == "application/json" && data.instance_of?(Hash)
37
+ if CONTENT_TYPE_JSON_REGEX.match(headers["Content-Type"]) && data.instance_of?(Hash)
33
38
  data.to_json
34
39
  else
35
40
  data
36
41
  end
37
42
  end
38
43
 
39
- res = @connection.request(
40
- method: method,
41
- path: path,
42
- body: body,
43
- headers: headers,
44
- query: options.fetch(:query, {})
45
- )
44
+ req = Request.new(
45
+ method,
46
+ path,
47
+ scrub_body(body.dup, headers["Content-Type"]),
48
+ headers,
49
+ options.fetch(:query, {})
50
+ ).freeze
51
+
52
+ res = @connection.request(**req.to_h)
53
+ error = QuickPay::API::Error.by_status_code(res.status, res.body, res.headers, req)
54
+
55
+ if !options.fetch(:raw, false) && res.headers["Content-Type"] =~ CONTENT_TYPE_JSON_REGEX
56
+ res.body = JSON.parse(res.body, options[:json_opts] || @connection.data[:json_opts])
57
+ end
58
+
59
+ if block
60
+ # Raise error if not specified as fourth block parameter
61
+ raise error if error && block.parameters.size < 4
46
62
 
47
- if options.fetch(:raw, false)
48
- [res.status, res.body, res.headers]
63
+ block.call(res.body, res.status, res.headers, error)
49
64
  else
50
- raise QuickPay::API::Error.by_status_code(res.status, res.body, res.headers) if res.status >= 400
65
+ raise error if error
51
66
 
52
- res.headers["Content-Type"] == "application/json" ? JSON.parse(res.body) : res.body
67
+ [res.body, res.status, res.headers]
53
68
  end
54
69
  end
55
70
  end
71
+
72
+ private
73
+
74
+ def scrub_body(body, content_type)
75
+ return "" if body.to_s.empty?
76
+
77
+ if [CONTENT_TYPE_JSON_REGEX, %r{application/x-www-form-urlencoded}].any? { |regex| regex.match(content_type) }
78
+ body
79
+ else
80
+ "<scrubbed for Content-Type #{content_type}>"
81
+ end
82
+ end
56
83
  end
57
84
  end
58
85
  end
@@ -2,53 +2,66 @@ module QuickPay
2
2
  module API
3
3
  class Error < StandardError
4
4
  class BadRequest < Error; end
5
+
5
6
  class Unauthorized < Error; end
7
+
6
8
  class PaymentRequired < Error; end
9
+
7
10
  class Forbidden < Error; end
11
+
8
12
  class NotFound < Error; end
13
+
9
14
  class MethodNotAllowed < Error; end
15
+
10
16
  class NotAcceptable < Error; end
17
+
11
18
  class Conflict < Error; end
19
+
12
20
  class TooManyRequest < Error; end
21
+
13
22
  class InternalServerError < Error; end
23
+
14
24
  class BadGateway < Error; end
25
+
15
26
  class ServiceUnavailable < Error; end
27
+
16
28
  class GatewayTimeout < Error; end
17
29
 
18
30
  CLASS_MAP = {
19
- 400 => "BadRequest",
20
- 401 => "Unauthorized",
21
- 402 => "PaymentRequired",
22
- 403 => "Forbidden",
23
- 404 => "NotFound",
24
- 405 => "MethodNotAllowed",
25
- 406 => "NotAcceptable",
26
- 409 => "Conflict",
27
- 429 => "TooManyRequest",
28
- 500 => "InternalServerError",
29
- 502 => "BadGateway",
30
- 503 => "ServiceUnavailable",
31
- 504 => "GatewayTimeout"
31
+ 400 => BadRequest,
32
+ 401 => Unauthorized,
33
+ 402 => PaymentRequired,
34
+ 403 => Forbidden,
35
+ 404 => NotFound,
36
+ 405 => MethodNotAllowed,
37
+ 406 => NotAcceptable,
38
+ 409 => Conflict,
39
+ 429 => TooManyRequest,
40
+ 500 => InternalServerError,
41
+ 502 => BadGateway,
42
+ 503 => ServiceUnavailable,
43
+ 504 => GatewayTimeout
32
44
  }.freeze
33
45
 
34
- attr_reader :status, :body, :headers
46
+ attr_reader :status, :body, :headers, :request
35
47
 
36
- def initialize(status, body, headers)
48
+ def initialize(status, body, headers, request)
37
49
  @status = status
38
50
  @body = body
39
51
  @headers = headers
52
+ @request = request
40
53
  end
41
54
 
42
55
  def to_s
43
- "#<#{self.class}: status=#{status}, body=#{body.inspect}, headers=#{headers.inspect}>"
56
+ "#<#{self.class}: status=#{status}, body=#{body.inspect}, " \
57
+ "headers=#{headers.inspect} request=#{request.inspect}>"
44
58
  end
45
59
  alias_method :inspect, :to_s
46
60
 
47
- def self.by_status_code(status, body, headers)
48
- raise QuickPay::API::Error.new(status, body, headers) unless CLASS_MAP[status]
61
+ def self.by_status_code(status, body, headers, request)
62
+ return if (200..399).cover? status
49
63
 
50
- klass = QuickPay::API::Error.const_get(CLASS_MAP[status])
51
- raise klass.new(status, body, headers)
64
+ CLASS_MAP.fetch(status, QuickPay::API::Error).new(status, body, headers, request)
52
65
  end
53
66
  end
54
67
  end
@@ -1,5 +1,5 @@
1
1
  module QuickPay
2
2
  module API
3
- VERSION = "2.0.2".freeze
3
+ VERSION = "3.0.1".freeze
4
4
  end
5
5
  end
@@ -3,6 +3,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "quickpay/api/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
+ spec.required_ruby_version = ">= 2.5.0" # rubocop:disable Gemspec/RequiredRubyVersion
7
+
6
8
  spec.name = "quickpay-ruby-client"
7
9
  spec.version = QuickPay::API::VERSION
8
10
  spec.authors = ["QuickPay Developers"]
@@ -18,11 +20,13 @@ Gem::Specification.new do |spec|
18
20
  spec.require_paths = ["lib"]
19
21
 
20
22
  spec.add_development_dependency "bundler"
21
- spec.add_development_dependency "minitest", "~> 5.11.3"
22
- spec.add_development_dependency "rake", "~> 12.3.2"
23
+ spec.add_development_dependency "minitest"
24
+ spec.add_development_dependency "pry"
25
+ spec.add_development_dependency "rake"
23
26
  spec.add_development_dependency "rubocop"
24
- spec.add_development_dependency "simplecov", "~> 0.16.1"
25
- spec.add_development_dependency "simplecov-console", "~> 0.4.2"
27
+ spec.add_development_dependency "simplecov"
28
+ spec.add_development_dependency "simplecov-console"
26
29
 
27
- spec.add_dependency "excon", "~> 0.71.0"
30
+ spec.add_dependency "excon", "~> 0.79.0"
31
+ spec.add_dependency "json", "~> 2.5.0"
28
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: 2.0.2
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: 2019-12-17 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
@@ -28,30 +28,44 @@ dependencies:
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 5.11.3
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 5.11.3
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: 12.3.2
61
+ version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "~>"
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: 12.3.2
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -70,44 +84,58 @@ dependencies:
70
84
  name: simplecov
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: 0.16.1
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: 0.16.1
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: simplecov-console
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: 0.4.2
103
+ version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: 0.4.2
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: excon
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: 0.71.0
117
+ version: 0.79.0
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: 0.71.0
124
+ version: 0.79.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: json
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 2.5.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 2.5.0
111
139
  description: Embed QuickPay's secure payments directly into your Ruby applications.
112
140
  Learn more at https://tech.quickpay.net
113
141
  email:
@@ -116,14 +144,14 @@ executables: []
116
144
  extensions: []
117
145
  extra_rdoc_files: []
118
146
  files:
147
+ - ".github/workflows/test_and_lint.yml"
119
148
  - ".gitignore"
120
- - ".rubocop.yml"
121
- - ".travis.yml"
122
149
  - CHANGELOG.md
123
150
  - Gemfile
124
151
  - LICENSE.txt
125
152
  - README.md
126
153
  - Rakefile
154
+ - bin/console
127
155
  - lib/quickpay/api/client.rb
128
156
  - lib/quickpay/api/error.rb
129
157
  - lib/quickpay/api/version.rb
@@ -140,14 +168,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
168
  requirements:
141
169
  - - ">="
142
170
  - !ruby/object:Gem::Version
143
- version: '0'
171
+ version: 2.5.0
144
172
  required_rubygems_version: !ruby/object:Gem::Requirement
145
173
  requirements:
146
174
  - - ">="
147
175
  - !ruby/object:Gem::Version
148
176
  version: '0'
149
177
  requirements: []
150
- rubygems_version: 3.0.3
178
+ rubygems_version: 3.3.7
151
179
  signing_key:
152
180
  specification_version: 4
153
181
  summary: Ruby client for QuickPay API
data/.rubocop.yml DELETED
@@ -1,92 +0,0 @@
1
- ###########################
2
- # Configuration for rubocop
3
- # in .rubocop.yml
4
- # Most of these are disabling existing cops, primarily
5
- # due to a smattering of different styles and loose
6
- # guidlines for contributions.
7
- #
8
- # Any of these may be changed.
9
- AllCops:
10
- TargetRubyVersion: 2.5
11
-
12
- Style/StringLiterals:
13
- EnforcedStyle: double_quotes
14
-
15
- Style/StringLiteralsInInterpolation:
16
- EnforcedStyle: double_quotes
17
-
18
- Style/Alias:
19
- EnforcedStyle: prefer_alias_method
20
-
21
- Style/DoubleNegation:
22
- Enabled: false
23
-
24
- Style/NumericLiterals:
25
- Enabled: false
26
-
27
- Style/SingleLineBlockParams:
28
- Enabled: false
29
-
30
- Style/MethodMissingSuper:
31
- Enabled: false
32
-
33
- Style/MissingRespondToMissing:
34
- Enabled: false
35
-
36
- Style/EmptyMethod:
37
- EnforcedStyle: expanded
38
-
39
- Naming/VariableNumber:
40
- Enabled: false
41
-
42
- Naming/AccessorMethodName:
43
- Enabled: false
44
-
45
- Style/HashSyntax:
46
- EnforcedStyle: no_mixed_keys
47
-
48
- Style/FrozenStringLiteralComment:
49
- Enabled: false
50
-
51
- Style/NumericPredicate:
52
- Enabled: false
53
-
54
- LineLength:
55
- Max: 119 # github diff (ex. +-)
56
-
57
- Documentation:
58
- Enabled: false
59
-
60
- Metrics/ClassLength:
61
- CountComments: false
62
- Exclude:
63
- - "**/spec/**/*"
64
-
65
- Metrics/ModuleLength:
66
- CountComments: false
67
- Exclude:
68
- - "**/spec/**/*"
69
-
70
- Metrics/MethodLength:
71
- Enabled: false
72
-
73
- Metrics/BlockLength:
74
- Enabled: false
75
-
76
- Metrics/AbcSize:
77
- Enabled: false
78
-
79
- Metrics/CyclomaticComplexity:
80
- Enabled: false
81
-
82
- Metrics/PerceivedComplexity:
83
- Enabled: false
84
-
85
- Metrics/ParameterLists:
86
- Enabled: false
87
-
88
- FrozenStringLiteralComment:
89
- Enabled: false
90
-
91
- Style/RedundantCondition: # Double pipes(||) on multiline is not so clear.
92
- Enabled: false
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
- cache: bundler
8
- script: bundle exec rake
9
- notifications:
10
- slack:
11
- secure: SixeTgiVsOaeWyKwICxLJ0GLN/C9j6qW1ZdaEytIDuZaBAn9oArrRGkJiehFdlzcPUHwzMWC0vl9GQzyBhZ7dbq+B53QY1mH9LTb9A53Y2d1OO1kBjJAkC5Yprvpjm52+x889Dwlz0bfLETvLsC2ej0NZDvSSLKFjpZZIZMOWkg=