credit_gateway 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/console +9 -0
- data/lib/credit_gateway/client.rb +5 -11
- data/lib/credit_gateway/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3da2892b9699d3b00fbafa418f87d49ee1383f4189d72eedb78d1e2185b3973
|
4
|
+
data.tar.gz: b7f6b7945bc359d5ede1868f1f2933217cb3e6426df7b5457a60b6e4d8799a22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ce0a7055b8758592f346a3135ae5a40ca66b2bce9d9196b3b399995a8e1302d8f69d417249fabe92b839b98fe20e8798723249785b6b565d98fe44516f918cd
|
7
|
+
data.tar.gz: b12d121baea5281e0948282f6ab139cbe8b4e130c9fea95d24af36dfe269710f64a054f8f896485bf8104878dfda85e8589e2a4c78897b29613604c59ba0f678
|
data/Gemfile.lock
CHANGED
data/bin/console
CHANGED
@@ -7,6 +7,15 @@ require 'json'
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
|
+
CreditGateway.configure do |c|
|
11
|
+
c.client_id = ENV['CREDIT_GATEWAY_CLIENT_ID']
|
12
|
+
c.client_secret = ENV['CREDIT_GATEWAY_CLIENT_SECRET']
|
13
|
+
c.country = 'GB'
|
14
|
+
c.environment = :sandbox
|
15
|
+
c.debug = true
|
16
|
+
c.verbose = true
|
17
|
+
end
|
18
|
+
|
10
19
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
20
|
require 'pry'
|
12
21
|
Pry.start
|
@@ -8,12 +8,6 @@ require 'credit_gateway/errors'
|
|
8
8
|
|
9
9
|
module CreditGateway
|
10
10
|
class Client
|
11
|
-
def initialize
|
12
|
-
return if Faraday::Request.fetch_middleware(:credit_gateway_auth)
|
13
|
-
|
14
|
-
Faraday::Request.register_middleware credit_gateway_auth: -> { CreditGateway::FaradayAuth }
|
15
|
-
end
|
16
|
-
|
17
11
|
def get(path, headers: {}, params: {})
|
18
12
|
connection.get(path, params, headers).tap do |response|
|
19
13
|
handle_response(response)
|
@@ -21,17 +15,17 @@ module CreditGateway
|
|
21
15
|
end
|
22
16
|
|
23
17
|
def post(path, headers: {}, params: {})
|
24
|
-
connection.post(path, JSON.
|
18
|
+
connection.post(path, JSON.generate(params), headers).tap do |response|
|
25
19
|
handle_response(response)
|
26
20
|
end
|
27
21
|
end
|
28
22
|
|
29
23
|
def connection
|
30
24
|
@connection ||= Faraday.new(url: api_url) do |conn|
|
31
|
-
conn.
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
conn.use CreditGateway::FaradayAuth,
|
26
|
+
CreditGateway.configuration.client_id,
|
27
|
+
CreditGateway.configuration.client_secret,
|
28
|
+
CreditGateway.configuration.country
|
35
29
|
conn.response :json, parser_options: { symbolize_names: true }
|
36
30
|
if CreditGateway.configuration.debug
|
37
31
|
conn.response :logger, nil, { headers: true, bodies: CreditGateway.configuration.verbose }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credit_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Finpoint
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.0.8
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: CRIF CreditGateway client
|