six_saferpay 1.2.0 → 1.2.1
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/lib/six_saferpay/client.rb +21 -12
- data/lib/six_saferpay/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4dcccfabf4b881707c8da788ba5029fe21eb7767f25437a7f7e27f34c064dbd
|
4
|
+
data.tar.gz: 1f1bc93b10ee325e2dbe154f5d6029ce453dea1523ebd73da2aa201f36cd2824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6cd5b2df26536d3b1097755a3c1fbfbfcc1391200b23d79d89bdf2af6fe1d4820b57910627665c5a4607047b4e994e8331ba430f462f0c3388a6ca423f7d902
|
7
|
+
data.tar.gz: 78593896fb7e48bd4cf92de1f3045fb0071db325bf5d8357c7528d81aa8a7cc637a6a1aed0da3ff9a5e8bfe168f81f9602e926b8b64e58ad57c835ba308cb69b
|
data/Gemfile.lock
CHANGED
data/lib/six_saferpay/client.rb
CHANGED
@@ -16,13 +16,7 @@ module SixSaferpay
|
|
16
16
|
@response = https.request(request)
|
17
17
|
hash = @response.body
|
18
18
|
hash = JSON.parse(hash, symbolize_names: true)
|
19
|
-
hash = hash
|
20
|
-
key = key.to_s.underscore
|
21
|
-
key.gsub!(/^alias/,'fd_alias')
|
22
|
-
key.gsub!(/^abort/,'fd_abort')
|
23
|
-
key.gsub!(/^fail/,'fd_fail')
|
24
|
-
key.to_sym
|
25
|
-
end
|
19
|
+
hash = transform_response_hash(hash)
|
26
20
|
if @response.code == "200"
|
27
21
|
@object.response_class.new(hash)
|
28
22
|
else
|
@@ -35,11 +29,7 @@ module SixSaferpay
|
|
35
29
|
def request
|
36
30
|
request = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
|
37
31
|
hash = @object.to_h
|
38
|
-
hash = hash
|
39
|
-
key = key.to_s.camelize
|
40
|
-
key.gsub!('fd_','')
|
41
|
-
key.to_sym
|
42
|
-
end
|
32
|
+
hash = transform_request_hash(hash)
|
43
33
|
hash = hash.to_json
|
44
34
|
request.body = hash
|
45
35
|
request.basic_auth(username, password)
|
@@ -62,5 +52,24 @@ module SixSaferpay
|
|
62
52
|
SixSaferpay.config.password
|
63
53
|
end
|
64
54
|
|
55
|
+
def transform_request_hash(hash)
|
56
|
+
hash = hash.deep_transform_keys do |key|
|
57
|
+
key = key.to_s
|
58
|
+
key.gsub!('fd_','')
|
59
|
+
key = key.camelize
|
60
|
+
key.to_sym
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def transform_response_hash(hash)
|
65
|
+
hash = hash.deep_transform_keys do |key|
|
66
|
+
key = key.to_s.underscore
|
67
|
+
key.gsub!(/^alias/,'fd_alias')
|
68
|
+
key.gsub!(/^abort/,'fd_abort')
|
69
|
+
key.gsub!(/^fail/,'fd_fail')
|
70
|
+
key.to_sym
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
65
74
|
end
|
66
75
|
end
|
data/lib/six_saferpay/version.rb
CHANGED