quickpay-ruby-client 2.0.2 → 2.0.3

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: 041757ab3e9e7688c4c0e0b4bb523c1b16baf875746c2fa8801d9c004f1a174e
4
+ data.tar.gz: d2baacb035ee593e3c3245a011ddf163835b3c219b0b9126c513b82a4809439b
5
5
  SHA512:
6
- metadata.gz: 4aa48a70180b0c458a664f9e40dd3ada6d4ddec514af8d07efe71b8cad9392560b41880559af39ecbb878eaabd71f18cc278b708af16b44855f3f896fc175d37
7
- data.tar.gz: 1be9621ba17c2760b1c8369a63f4cc9f1f3effbee2d239de0b96779534ed7d4112c772d235897ebe48ec49c2c2f8d0afdf2d08fb4277a8e052937119b5846a63
6
+ metadata.gz: 63a8c25391f66f1be08c39af42fb0542692f9c29725f4d93318f7929aec4cd199e12868236e065c6425d262242838a20c82286d3635c4092333c2941eea3e260
7
+ data.tar.gz: b3d8ac7466ea38f24bdc7a52f50538beced740eba4a5cc447486d1694a5b073c7d1d8834586ecf76e1c8720718427f95650d9e77669a5b69197db61cb9f89414
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## v2.0.3
6
+
7
+ * Add the possibility of settins options for JSON parser
8
+
5
9
  ## v2.0.2
6
10
 
7
11
  * Update excon dependency for CVE-2019-16779 (prognostikos)
data/README.md CHANGED
@@ -58,13 +58,15 @@ You can also set some connection specific options (default values shown):
58
58
 
59
59
  ```ruby
60
60
  client = Quickpay::API::Client.new(
61
- read_timeout: 60,
62
- write_timeout: 60,
63
- connect_timeout: 60,
61
+ options: {
62
+ read_timeout: 60,
63
+ write_timeout: 60,
64
+ connect_timeout: 60,
65
+ json_opts: { symbolize_names: true }
66
+ }
64
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`.
@@ -81,6 +83,7 @@ Beyond the endpoint, the client accepts the following options (default values sh
81
83
  * `headers: {}`
82
84
  * `query: {}`
83
85
  * `raw: false`
86
+ * `json_opts: nil`
84
87
 
85
88
  ```ruby
86
89
  response = client.post(
@@ -88,7 +91,8 @@ response = client.post(
88
91
  body: { amount: 100 }.to_json,
89
92
  headers: { "Content-Type" => "application/json" },
90
93
  query: { "synchronized" => "" },
91
- raw: false
94
+ raw: false,
95
+ json_opts: { symbolize_names: true }
92
96
  )
93
97
 
94
98
  ```
@@ -15,7 +15,8 @@ module QuickPay
15
15
  opts = {
16
16
  read_timeout: options.fetch(:read_timeout, 60),
17
17
  write_timeout: options.fetch(:write_timeout, 60),
18
- connect_timeout: options.fetch(:connect_timeout, 60)
18
+ connect_timeout: options.fetch(:connect_timeout, 60),
19
+ json_opts: options.fetch(:json_opts, nil)
19
20
  }
20
21
 
21
22
  opts[:username] = Excon::Utils.escape_uri(username) if username
@@ -49,7 +50,11 @@ module QuickPay
49
50
  else
50
51
  raise QuickPay::API::Error.by_status_code(res.status, res.body, res.headers) if res.status >= 400
51
52
 
52
- res.headers["Content-Type"] == "application/json" ? JSON.parse(res.body) : res.body
53
+ if res.headers["Content-Type"] == "application/json"
54
+ JSON.parse(res.body, options.dig(:json_opts) || @connection.data.dig(:json_opts))
55
+ else
56
+ res.body
57
+ end
53
58
  end
54
59
  end
55
60
  end
@@ -1,5 +1,5 @@
1
1
  module QuickPay
2
2
  module API
3
- VERSION = "2.0.2".freeze
3
+ VERSION = "2.0.3".freeze
4
4
  end
5
5
  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: 2.0.3
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: 2020-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,7 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubygems_version: 3.0.3
150
+ rubyforge_project:
151
+ rubygems_version: 2.7.6
151
152
  signing_key:
152
153
  specification_version: 4
153
154
  summary: Ruby client for QuickPay API