paymentsds-mpesa 0.1.0.pre.alpha.14 → 0.1.0.pre.alpha.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17441dae0a1586bae71179d5a2ff3421ba64ffa82e7fe41aaf8d78355ce69c69
4
- data.tar.gz: 3b10f71a67a4ddccd2dea0ce05269e3b9adea1c80564c235a9eedcce4a5882a8
3
+ metadata.gz: 1f0364f9357704edbf07afe62297cdfb2c534bea9f3d05d8edf989f9c63461d6
4
+ data.tar.gz: f2df7bdb63e54e7c7ef37169e6412372390c6a38f5c75a182f7ad2cc2e291ced
5
5
  SHA512:
6
- metadata.gz: b888897f44cae1eea1b925a3c2c01441ea0b662b61f41613afd3337a14df781c5b1385b5113eb67641e98f5e03cb480ae6de73e44ec2d7e740df1e35da157159
7
- data.tar.gz: 595db7fda5172e50d1fc020ab0cb79eb32eb2993e777cf550b1b0796dc0c438f7d07b691585521c37ce11365d8679c4b69aa87eab427c4601d27807be7b7399e
6
+ metadata.gz: 0d0ea750af84b76fec4662e76b9e4c825194a475a99a621f37acb97727fa73f5784aa5f400fe86d8b9727f44a11483b4f71d0c9a0ce59d91b5e113a8c27a9cc1
7
+ data.tar.gz: 290ac9205e5b9c2669682edc791800eab9b9e9a8c81504b9b4dba76828e17cf2703880f5dc9c190808f8b442cb28f5b65771b24aa2a7771daa8f7433b623b914
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ require 'json'
3
+ require 'faraday'
2
4
 
3
5
  module Paymentsds
4
6
  module MPesa
@@ -145,27 +147,30 @@ module Paymentsds
145
147
  body: build_request_body(opcode, intent)
146
148
  }
147
149
 
148
- http_client = Faraday::Connection.new do |client|
149
- client.url = "#{request_data[:base_url]}/#{request_data[:path]}"
150
- client.headers = request_data[:headers]
151
- client.options.timeout = request_data.timeout
152
- end
150
+ http_client = Faraday.new(
151
+ url: request_data[:base_url],
152
+ headers: request_data[:headers],
153
+ )
153
154
 
154
- case operation[:method]
155
+ puts request_data[:base_url]
155
156
 
157
+ case operation[:method]
156
158
  when :get
157
- response = http_client.get do |req|
158
- req.params = request_data.body
159
+ response = http_client.get(request_data[:path]) do |req|
160
+ req.params = request_data[:body]
161
+ req.options.timeout = request_data[:timeout]
159
162
  end
160
163
 
161
164
  when :post
162
- response = http_client.post do |req|
163
- req.body = request_data.body
165
+ response = http_client.post(request_data[:path]) do |req|
166
+ req.body = request_data[:body].to_json
167
+ req.options.timeout = request_data[:timeout]
164
168
  end
165
169
 
166
170
  when :put
167
- response = http_client.put do |req|
168
- req.body = request_data.body
171
+ response = http_client.put(request_data[:path]) do |req|
172
+ req.body = request_data[:body].to_json
173
+ req.options.timeout = request_data[:timeout]
169
174
  end
170
175
  end
171
176
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Paymentsds
4
4
  module MPesa
5
- VERSION = '0.1.0.pre.alpha.14'
5
+ VERSION = '0.1.0.pre.alpha.19'
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.14
4
+ version: 0.1.0.pre.alpha.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edson Michaque