asaas-ruby 0.2.26 → 0.2.27

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: a6ee610797c2478fde09da69873a241b94242e6593a4545080e8f18c8ecc14bd
4
- data.tar.gz: 0df5257bbe512855715fb9ebf7f93131b660e994af03dd6708dcc3a763a320d8
3
+ metadata.gz: 009e79c222a295a1148c7ad2e10a9990c4eee72e6500700749d8a4076683bc5a
4
+ data.tar.gz: 3c5f9396e8927f1c63c718c815a26cbc444bab68d783b1212154220153cc63ef
5
5
  SHA512:
6
- metadata.gz: f3711e4c22b7f5519d8bd77a33d9117eb27f938daba4617b98cda4151cf341ce1f7ff2216bf51697e5636e06ccc2e654c3590467e84eec067c8e07aa12c1552a
7
- data.tar.gz: 9c92a2e2fd8c50b7c052cda60a82a5d99d7992c1509398f28a539d8b54e64973838d770acde4208267637cce89a05bb5600f9ac652b72e89165ba1f02c947bce
6
+ metadata.gz: ab0ec8e6a6003e139f5a39a618d307c20147ab7bd0db1a35ef26ace4a2b2eb3b95d85f731165ee45e7c2f50deb730a43df0bd7d3f328b66e7ad4db48f0bffbb6
7
+ data.tar.gz: 5143268bede2080f81bc18ebc09625d01cd0ab3578d3eb0e2e18d6f0ffc06b72f9648423d2ba05c247ce54ceebd7c113d7121f04c2bc48f74fa35c8436117792
@@ -85,18 +85,12 @@ module Asaas
85
85
  end
86
86
 
87
87
  def request(method, params = {}, body = nil)
88
- body = body.to_h
89
- body = body.delete_if { |k, v| v.nil? || v.to_s.empty? }
90
- body = body.to_json
91
88
  @response = Typhoeus::Request.new(
92
89
  parse_url(params.fetch(:id, false)),
93
90
  method: method,
94
- body: body,
91
+ body: body_parser(body),
95
92
  params: params,
96
- headers: {
97
- 'access_token': @token || Asaas::Configuration.token,
98
- 'Content-Type': 'application/json'
99
- },
93
+ headers: request_headers,
100
94
  verbose: Asaas::Configuration.debug
101
95
  ).run
102
96
  end
@@ -153,6 +147,19 @@ module Asaas
153
147
  def get_headers
154
148
  { 'access_token': @token || Asaas::Configuration.token }
155
149
  end
150
+
151
+ def body_parser(body)
152
+ return nil unless body
153
+
154
+ body.to_h.delete_if { |k, v| v.nil? || v.to_s.empty? }.to_json
155
+ end
156
+
157
+ def request_headers
158
+ {
159
+ 'access_token': @token || Asaas::Configuration.token,
160
+ 'Content-Type': 'application/json'
161
+ }
162
+ end
156
163
  end
157
164
  end
158
165
  end
data/lib/asaas/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Asaas
2
- VERSION = '0.2.26'
2
+ VERSION = '0.2.27'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asaas-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.26
4
+ version: 0.2.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Junior
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-18 00:00:00.000000000 Z
11
+ date: 2023-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler