paymentsds-mpesa 0.1.0.pre.alpha.16 → 0.1.0.pre.alpha.17

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: 6208693951c132095c313a9ac26a021a7b48393b4706ad75f84e14a4b6ae52c3
4
- data.tar.gz: 2db110a2bcda196df5473233462e5988e8d013f1b174100d8216951bb5914b56
3
+ metadata.gz: 49ed75e6b0ee3a9e9f48640398173d61b959119e29f7f662b84ac94bd83014eb
4
+ data.tar.gz: e1444375cf22dbbaea6473e41d5de5bab5a8d42408f251da431cf90fedc16f48
5
5
  SHA512:
6
- metadata.gz: 6bd42a5c03bfe03c06be5ba8ff353584699c2abf9bc39bc520397122dc36a9519d0c11510440e02c82c71d9b4042ed2af1151c06fa34126f5c2659719af78078
7
- data.tar.gz: ba06b6d8fdacb595dbea06635c2d3439138917287c26ac12e89fe7e4445eea756d551a2aab48cbe68c490f130f278f496a15cc9277919ecdb6767774bbc8faeb
6
+ metadata.gz: 9fd64d4ce15517bb0c153fbb82f51870af27b60260b4d0eb97d57fdcb5c4aaecc9b423dd10cccddac5666d929123af6595744fe8fd45ecf754b382bfd4223608
7
+ data.tar.gz: 035a77d5c119230571c84c89f0eacc589646ca457f789f6a6797124bcc852bb28fb6e165566ece91f703d6e9c69782e0608a83497b30b84f8f782bf1c04c1c31
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require 'json'
2
3
  require 'faraday'
3
4
 
4
5
  module Paymentsds
@@ -146,27 +147,28 @@ module Paymentsds
146
147
  body: build_request_body(opcode, intent)
147
148
  }
148
149
 
149
- http_client = Faraday.new do |client|
150
- client.url = "#{request_data[:base_url]}/#{request_data[:path]}"
151
- client.headers = request_data[:headers]
152
- client.options.timeout = request_data.timeout
153
- end
154
-
155
- case operation[:method]
150
+ http_client = Faraday.new(
151
+ url: request_data[:base_url],
152
+ headers: request_data[:headers],
153
+ )
156
154
 
155
+ case operation[:method]
157
156
  when :get
158
- response = http_client.get do |req|
157
+ response = http_client.get(request_data[:path]) do |req|
159
158
  req.params = request_data.body
159
+ req.options.timeout = request_data[:timeout]
160
160
  end
161
161
 
162
162
  when :post
163
- response = http_client.post do |req|
164
- req.body = request_data.body
163
+ response = http_client.post(request_data[:path]) do |req|
164
+ req.body = request_data.body.to_json
165
+ req.options.timeout = request_data[:timeout]
165
166
  end
166
167
 
167
168
  when :put
168
- response = http_client.put do |req|
169
- req.body = request_data.body
169
+ response = http_client.put(request_data[:path]) do |req|
170
+ req.body = request_data.body.to_json
171
+ req.options.timeout = request_data[:timeout]
170
172
  end
171
173
  end
172
174
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Paymentsds
4
4
  module MPesa
5
- VERSION = '0.1.0.pre.alpha.16'
5
+ VERSION = '0.1.0.pre.alpha.17'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paymentsds-mpesa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.alpha.16
4
+ version: 0.1.0.pre.alpha.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edson Michaque