six_saferpay 1.2.0 → 1.2.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: c0a09beb92c31b97a988862d72b2ea08857ee8f14a87e958c4a900fcf8129a13
4
- data.tar.gz: 8e9103b730d1f0fb4118a74bcc856817bd38810c074b9a3dc49579c45e7a1ac1
3
+ metadata.gz: a4dcccfabf4b881707c8da788ba5029fe21eb7767f25437a7f7e27f34c064dbd
4
+ data.tar.gz: 1f1bc93b10ee325e2dbe154f5d6029ce453dea1523ebd73da2aa201f36cd2824
5
5
  SHA512:
6
- metadata.gz: 779ae8e7888bac9635514303fcf85de9a9e15c5fcf350aee62fe489abe31e313058f35f6ceb33659dc52b7ea8abcba148e570679c63e46b1ce3633cfb307afc2
7
- data.tar.gz: 4ab3bd29d7a3d26359d050fe6ada3216e2a5ac952182b6f18524194af5cd50a1f742040dece5db41aec19a8a90c69f519070f4727b6c37bdff8ee5f0d7b12451
6
+ metadata.gz: d6cd5b2df26536d3b1097755a3c1fbfbfcc1391200b23d79d89bdf2af6fe1d4820b57910627665c5a4607047b4e994e8331ba430f462f0c3388a6ca423f7d902
7
+ data.tar.gz: 78593896fb7e48bd4cf92de1f3045fb0071db325bf5d8357c7528d81aa8a7cc637a6a1aed0da3ff9a5e8bfe168f81f9602e926b8b64e58ad57c835ba308cb69b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- six_saferpay (1.1.0)
4
+ six_saferpay (1.2.1)
5
5
  activesupport (~> 5.0, >= 5.0.0.0)
6
6
 
7
7
  GEM
@@ -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.deep_transform_keys do |key|
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.deep_transform_keys do |key|
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
@@ -1,3 +1,3 @@
1
1
  module SixSaferpay
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: six_saferpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Langenegger