inter_api 1.0.0 → 1.0.2

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: 7d5f6fc8f0c865245fb46a56496a0e07fb84ed9356eba8d8e2c1452328f9b31c
4
- data.tar.gz: 52fe4344029ddad08bf03b37d1447a205ffcf15df42bf6c0ee273c2da08bcd8f
3
+ metadata.gz: 36661dd5aa68653e29608d07616fd26e0726640409f2188efaf99b8e3a44dcf4
4
+ data.tar.gz: 94eb00f18a9a1191014047249ca1050ce720dde93f0836965ab078abb6800ad5
5
5
  SHA512:
6
- metadata.gz: 2be3f61081009a61c397ad83dda3b4f8eb1aa5c29d44a72adcc6349183cb3b3134db20df9239b3e7f213bfbaab602d6846ed5b5e91db53ed0f69a8ab689c3cad
7
- data.tar.gz: 58c3a068df908ab197bd58f4a153235a7dee9d53a56ee78324e92e4f3963a171ab5dd612f7cee31f2b683c3c6e064588955a2ebfea7d0d205ffabebe3ce86fa6
6
+ metadata.gz: 6a46510c801ffcba0d75ef5ca8bbea8d9b7d492b76957516a528dd8032b93d6440ebb8a6ee59ad629654991d7c14c0a0aecfb109148b6dbe76d67bbeedc10fd8
7
+ data.tar.gz: c2edb6b9c990e8161d0d4e52137da8585cd615ed1e69ba92d89e25a66f9c7ee1aea94a9cea0c1cbaea0366533bd45c7bb2b972e65003f70e8638bfb2f075ec0e
@@ -30,7 +30,7 @@ module InterApi
30
30
  grant_type: "client_credentials",
31
31
  scope: @scopes
32
32
  }
33
- response = post("/oauth/v2/token", headers: headers, sslcert: @crt, sslkey: @key, body: body)
33
+ response = post("/oauth/v2/token", headers: headers, sslcert: @crt, sslkey: @key, body: body) { |response| validate_response(response, "access_token") }
34
34
  @token = response.json["access_token"]
35
35
  @token_expires_at = Time.now + response.json["expires_in"]
36
36
  end
@@ -84,12 +84,12 @@ module InterApi
84
84
  end
85
85
 
86
86
  def update_payment(payment_id, body)
87
- response = update_payment_request(payment_id, body).run
87
+ response = patch("/pix/v2/cob/#{payment_id}", headers: build_headers, sslcert: @crt, sslkey: @key, body: JSON.dump(body)) { |response| validate_response(response, "txid") }
88
88
  InterApi::Payment.new(response.json, self)
89
89
  end
90
90
 
91
91
  def get_refund(end_to_end_id, id)
92
- response = get("/pix/v2/pix/#{end_to_end_id}/devolucao/#{id}", headers: build_headers, sslcert: @crt, sslkey: @key)
92
+ response = get("/pix/v2/pix/#{end_to_end_id}/devolucao/#{id}", headers: build_headers, sslcert: @crt, sslkey: @key) { |response| validate_response(response, "id") }
93
93
  response.json
94
94
  end
95
95
 
@@ -100,7 +100,7 @@ module InterApi
100
100
  natureza: refund_nature,
101
101
  descricao: description
102
102
  }
103
- response = put("/pix/v2/pix/#{end_to_end_id}/devolucao/#{id}", headers: build_headers, sslcert: @crt, sslkey: @key, body: JSON.dump(body))
103
+ response = put("/pix/v2/pix/#{end_to_end_id}/devolucao/#{id}", headers: build_headers, sslcert: @crt, sslkey: @key, body: JSON.dump(body)) { |response| validate_response(response, "id") }
104
104
  response.json
105
105
  end
106
106
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InterApi
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inter_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ulysses