bs2_api 1.5.1 → 1.6.2

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: 92386deadc6c231d882caac48d3092acab5c69ab50a176757768ab074635a5e4
4
- data.tar.gz: 90896ecd3a4dd6d60dcd3c69bcd6b56697ba5e33ab6a0e909c4dd7cf63ddae44
3
+ metadata.gz: 995b6148737a522290ec526905740f88b1f883502167576e25eac8b0e2367720
4
+ data.tar.gz: a6ae71ef4a47cf3f62026313baec3617065ccf7e4deb099519f2af7db888daef
5
5
  SHA512:
6
- metadata.gz: b2be2b78bbcedb9af38193898d62f7fa0cd0bf5e6217fefd39ed2e84db47bf7d2a604b3e2e88af338706936067f5baf290de268e32e7114d803809656df85325
7
- data.tar.gz: c5e8632080a64039a8d99e6a9ca112b5dad3cf766dd08387c5341427da3a055144417feeb44f7bbc7f409092f46d966076aedf1aa29a7520c01371e428cde853
6
+ metadata.gz: 226da89196ae3a68f8cf109b33d14b4478251e5dc4ad1e97b11894b6a19f2ebeb8a16d8bc110f44c0f9f44d108464634b269c92e97a343ab0e191e99d44d229a
7
+ data.tar.gz: 70ee5e748030f91e5a45e35d8806cd531e598973be731ba2110e2d298e261bf74e1f275c7d56bdc5f3afd0909e375b66a5facd3f2120dc466e74b4039e2fe385
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bs2_api (1.5.0)
4
+ bs2_api (1.6.0)
5
5
  activesupport
6
6
  builder
7
7
  bundler
@@ -46,10 +46,12 @@ module Bs2Api
46
46
 
47
47
  def initialize(
48
48
  client_id: Bs2Api.configuration.client_id,
49
- client_secret: Bs2Api.configuration.client_secret
49
+ client_secret: Bs2Api.configuration.client_secret,
50
+ proxy: nil
50
51
  )
51
52
  @client_id = client_id
52
53
  @client_secret = client_secret
54
+ @proxy = proxy
53
55
  @requests = []
54
56
  end
55
57
 
@@ -18,7 +18,15 @@ module Bs2Api
18
18
  private
19
19
 
20
20
  def post_request
21
- HTTParty.post(url, headers: headers, body: payload.to_json)
21
+ HTTParty.post(
22
+ url,
23
+ http_proxyaddr: @proxy&.host,
24
+ http_proxyport: @proxy&.port,
25
+ http_proxyuser: @proxy&.user,
26
+ http_proxypass: @proxy&.password,
27
+ headers: headers,
28
+ body: payload.to_json
29
+ )
22
30
  end
23
31
 
24
32
  def headers
@@ -7,16 +7,18 @@ module Bs2Api
7
7
  payment,
8
8
  value: nil,
9
9
  client_id: Bs2Api.configuration.client_id,
10
- client_secret: Bs2Api.configuration.client_secret
10
+ client_secret: Bs2Api.configuration.client_secret,
11
+ proxy: nil
11
12
  )
12
- @client_id = client_id
13
- @client_secret = client_secret
14
-
13
+
15
14
  raise Bs2Api::Errors::ConfirmationError, 'invalid payment' unless payment.present? && payment.is_a?(Bs2Api::Entities::Payment)
16
15
  raise Bs2Api::Errors::ConfirmationError, 'invalid value' unless value.to_f.positive?
17
- @payment = payment
18
16
 
17
+ @payment = payment
19
18
  @value = value.to_f
19
+ @client_id = client_id
20
+ @client_secret = client_secret
21
+ @proxy = proxy
20
22
  end
21
23
 
22
24
  def call
@@ -6,11 +6,13 @@ module Bs2Api
6
6
  def initialize(
7
7
  payment_id,
8
8
  client_id: Bs2Api.configuration.client_id,
9
- client_secret: Bs2Api.configuration.client_secret
9
+ client_secret: Bs2Api.configuration.client_secret,
10
+ proxy: nil
10
11
  )
12
+ @payment_id = payment_id
11
13
  @client_id = client_id
12
14
  @client_secret = client_secret
13
- @payment_id = payment_id
15
+ @proxy = proxy
14
16
  end
15
17
 
16
18
  def call
@@ -27,7 +29,14 @@ module Bs2Api
27
29
  end
28
30
 
29
31
  def detail_request
30
- HTTParty.get(url, headers: headers)
32
+ HTTParty.get(
33
+ url,
34
+ headers: headers,
35
+ http_proxyaddr: @proxy&.host,
36
+ http_proxyport: @proxy&.port,
37
+ http_proxyuser: @proxy&.user,
38
+ http_proxypass: @proxy&.password
39
+ )
31
40
  end
32
41
 
33
42
  def bearer_token
@@ -6,11 +6,13 @@ module Bs2Api
6
6
  def initialize(
7
7
  key,
8
8
  client_id: Bs2Api.configuration.client_id,
9
- client_secret: Bs2Api.configuration.client_secret
9
+ client_secret: Bs2Api.configuration.client_secret,
10
+ proxy: nil
10
11
  )
12
+ @key = key
11
13
  @client_id = client_id
12
14
  @client_secret = client_secret
13
- @key = key
15
+ @proxy = proxy
14
16
  end
15
17
 
16
18
  private
@@ -6,13 +6,15 @@ module Bs2Api
6
6
  def initialize(
7
7
  bank,
8
8
  client_id: Bs2Api.configuration.client_id,
9
- client_secret: Bs2Api.configuration.client_secret
9
+ client_secret: Bs2Api.configuration.client_secret,
10
+ proxy: nil
10
11
  )
11
12
 
12
- @client_id = client_id
13
- @client_secret = client_secret
14
13
  raise Bs2Api::Errors::InvalidBank, 'Invalid Bank' unless bank.is_a?(Bs2Api::Entities::Bank)
15
14
  @bank = bank
15
+ @client_id = client_id
16
+ @client_secret = client_secret
17
+ @proxy = proxy
16
18
  end
17
19
 
18
20
  private
@@ -6,7 +6,7 @@ module Bs2Api
6
6
  'EM_PROCESSAMENTO' => :processing,
7
7
  'DEVOLVIDO' => :refunded,
8
8
  'NAO_REALIZADO' => :not_achieved,
9
- }.transform_keys(&:downcase).freeze
9
+ }.freeze
10
10
 
11
11
  def initialize(
12
12
  client_id:,
@@ -46,7 +46,7 @@ module Bs2Api
46
46
 
47
47
  raise response.body unless response.success?
48
48
 
49
- response.body
49
+ JSON.parse(response.body)
50
50
  end
51
51
 
52
52
  def status
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bs2Api
4
- VERSION = '1.5.1'
4
+ VERSION = '1.6.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bs2_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kim Pastro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-01 00:00:00.000000000 Z
11
+ date: 2022-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder