buckaruby 2.1.1 → 2.2.0
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/README.md +17 -1
- data/lib/buckaruby/configuration.rb +12 -9
- data/lib/buckaruby/request.rb +3 -0
- data/lib/buckaruby/version.rb +1 -1
- data/lib/buckaruby.rb +30 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27c6e6a45e808a1c647fe705134f58b9991ec6fb7aec29571a93db151f528b57
|
|
4
|
+
data.tar.gz: e1c84fe69faee13ce46cc499f3df561e000a496c38602aa376249c66ab55e306
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e26473547b8c14f9d10b71e4f5effe7f69aa004427134dfa4b3d63954eceedea1a1873f83c1e03a3c8550d6bbc3247de373b188a27fe2563f17d5e1c67b8caec
|
|
7
|
+
data.tar.gz: d406d0e9a54ed6285faa45f64f17e84c7f89e6e18016c7551ceb5603c58c1acc0bacdc7c14219baf6813cac683a2169ee8a7dd0e2f7b4b5112cf4a9c2ef51bdd
|
data/README.md
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/buckaruby)
|
|
4
4
|
[](https://github.com/KentaaNL/buckaruby/actions)
|
|
5
|
-
[](https://github.com/KentaaNL/buckaruby/actions/workflows/github-code-scanning/codeql)
|
|
6
6
|
|
|
7
7
|
The Buckaruby gem provides a Ruby library for communicating with the Buckaroo Payment Engine 3.0.
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
10
10
|
|
|
11
11
|
- [Installation](#installation)
|
|
12
|
+
- [Configuration](#configuration)
|
|
12
13
|
- [Usage](#usage)
|
|
13
14
|
- [Payment methods](#payment-methods)
|
|
14
15
|
- [Start transaction](#start-transaction)
|
|
@@ -39,6 +40,21 @@ Or install it yourself as:
|
|
|
39
40
|
|
|
40
41
|
$ gem install buckaruby
|
|
41
42
|
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
Buckaruby provides a global configuration object that allows you to customize logger output and HTTP timeouts. You can set these options via the `Buckaruby.configure` block:
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
Buckaruby.configure do |config|
|
|
49
|
+
# Set a global logger for Buckaruby output
|
|
50
|
+
config.logger = Logger.new($stdout)
|
|
51
|
+
|
|
52
|
+
# Set Net::HTTP timeout values (in seconds)
|
|
53
|
+
config.open_timeout = 30
|
|
54
|
+
config.read_timeout = 30
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
42
58
|
## Usage
|
|
43
59
|
|
|
44
60
|
Create the gateway and configure it using your Buckaroo website key and secret key:
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'logger'
|
|
4
|
-
|
|
5
3
|
module Buckaruby
|
|
6
4
|
# Configuration settings for the Buckaruby Gateway.
|
|
7
5
|
class Configuration
|
|
@@ -55,14 +53,19 @@ module Buckaruby
|
|
|
55
53
|
end
|
|
56
54
|
end
|
|
57
55
|
|
|
58
|
-
# Use the logger from
|
|
56
|
+
# Use the logger from either the options or the global config.
|
|
59
57
|
def logger
|
|
60
|
-
@logger
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
@options.fetch(:logger) { Buckaruby.config.logger }
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Returns the Net::HTTP open timeout value, fallback to global config.
|
|
62
|
+
def open_timeout
|
|
63
|
+
@options.fetch(:open_timeout) { Buckaruby.config.open_timeout }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Returns the Net::HTTP read timeout value, fallback to global config.
|
|
67
|
+
def read_timeout
|
|
68
|
+
@options.fetch(:read_timeout) { Buckaruby.config.read_timeout }
|
|
66
69
|
end
|
|
67
70
|
end
|
|
68
71
|
end
|
data/lib/buckaruby/request.rb
CHANGED
|
@@ -38,6 +38,9 @@ module Buckaruby
|
|
|
38
38
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
http.open_timeout = @config.open_timeout
|
|
42
|
+
http.read_timeout = @config.read_timeout
|
|
43
|
+
|
|
41
44
|
raw_response = http.post(uri.request_uri, URI.encode_www_form(params))
|
|
42
45
|
|
|
43
46
|
unless raw_response.is_a?(Net::HTTPSuccess)
|
data/lib/buckaruby/version.rb
CHANGED
data/lib/buckaruby.rb
CHANGED
|
@@ -18,3 +18,33 @@ require_relative 'buckaruby/response'
|
|
|
18
18
|
require_relative 'buckaruby/signature'
|
|
19
19
|
|
|
20
20
|
require_relative 'buckaruby/version'
|
|
21
|
+
|
|
22
|
+
require 'logger'
|
|
23
|
+
|
|
24
|
+
# :nodoc:
|
|
25
|
+
module Buckaruby
|
|
26
|
+
# Holds the global Buckaruby configuration.
|
|
27
|
+
class Config
|
|
28
|
+
attr_accessor :logger, :open_timeout, :read_timeout
|
|
29
|
+
|
|
30
|
+
def initialize
|
|
31
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new($stdout)
|
|
32
|
+
@open_timeout = 30
|
|
33
|
+
@read_timeout = 30
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
@config = Config.new
|
|
38
|
+
|
|
39
|
+
class << self
|
|
40
|
+
attr_reader :config
|
|
41
|
+
|
|
42
|
+
def configure
|
|
43
|
+
yield(@config)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def reset!
|
|
47
|
+
@config = Config.new
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: buckaruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kentaa
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -136,14 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
136
136
|
requirements:
|
|
137
137
|
- - ">="
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
|
-
version: 3.
|
|
139
|
+
version: 3.2.0
|
|
140
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
|
142
142
|
- - ">="
|
|
143
143
|
- !ruby/object:Gem::Version
|
|
144
144
|
version: '0'
|
|
145
145
|
requirements: []
|
|
146
|
-
rubygems_version: 3.
|
|
146
|
+
rubygems_version: 3.4.19
|
|
147
147
|
signing_key:
|
|
148
148
|
specification_version: 4
|
|
149
149
|
summary: Ruby library for communicating with the Buckaroo Payment Engine 3.0.
|