bling_api 2.1.1 → 2.1.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: cf1d3d2076e88d485405733ff1801e618eef40259425025531e2ab382d549b5a
4
- data.tar.gz: 3e258f9660d4ee77ae95150554ff96f48cf3bd37e2664e746fe8ed08d66b4662
3
+ metadata.gz: acdb59f982a9de7e9167e33cb175c8621192b505bcf36563328de865933aed60
4
+ data.tar.gz: 0d596f09a0746f9c7b86adf8709aeb60d6d6e82f3cfb5c2b05e5639ec3f71971
5
5
  SHA512:
6
- metadata.gz: 69ffcc67092ded58caa58f48c7168f602ce6bb5417e467d8770ba4eff4c0fe05ff0a98f0d619481f08c6495a3de213c5a47b89cd2be62ca76a8404de99b5a0cc
7
- data.tar.gz: cd49f78abc387bae47c32628c621ed720cb5e06bd474d32c8a8e5f02d392a4561a2c0c0a1cd5058cc25f957ffdf1aed2aa1dc3748f6fc1f4391b2470c8145f5d
6
+ metadata.gz: 04d29929c5dd75438d86a8c8b43c4fc3084ef3e5a34354d10e7e528bbb0429d89d2a99ce3ae70ce264fe6e61cb91d1fc3d3f02ff41f0c2ec215742c20efcf507
7
+ data.tar.gz: 0214c6dce88ed76212f7530eca0950ac8f5c9b2f7e02ffbcdc176d023127d9107fd657b67a038db0393bb93a7fe7a7f0c067f21f1f3e9d8ccbe50accf22077f9
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bling_api (2.1.0)
4
+ bling_api (2.1.2)
5
5
  ac
6
6
  base64
7
+ uri
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -30,6 +31,7 @@ GEM
30
31
  super_diff (~> 0.10)
31
32
  typhoeus (1.4.0)
32
33
  ethon (>= 0.9.0)
34
+ uri (1.1.1)
33
35
 
34
36
  PLATFORMS
35
37
  arm64-darwin-22
@@ -154,6 +154,40 @@ module BlingApi
154
154
  get("/produtos?codigo=#{sku}", timeout: 20) { _1.data }
155
155
  end
156
156
 
157
+ def get_payments_to_receivable(
158
+ idContato: nil,
159
+ pagina: 1,
160
+ limite: 100,
161
+ situacoes: [],
162
+ tipoFiltroData: nil,
163
+ dataInicial: nil,
164
+ dataFinal: nil,
165
+ idsCategorias: [],
166
+ idPortador: nil,
167
+ idFormaPagamento: nil,
168
+ boletoGerado: nil
169
+ )
170
+ query = build_query(
171
+ {
172
+ idContato: idContato,
173
+ pagina: pagina,
174
+ limite: limite,
175
+ tipoFiltroData: tipoFiltroData,
176
+ dataInicial: dataInicial,
177
+ dataFinal: dataFinal,
178
+ idPortador: idPortador,
179
+ idFormaPagamento: idFormaPagamento,
180
+ boletoGerado: boletoGerado
181
+ },
182
+ {
183
+ situacoes: situacoes,
184
+ idsCategorias: idsCategorias
185
+ }
186
+ )
187
+
188
+ get "/contas/receber?#{query}"
189
+ end
190
+
157
191
  def create_contact(
158
192
  nome:,
159
193
  pessoa_juridica:,
@@ -386,5 +420,25 @@ module BlingApi
386
420
  }
387
421
  post("/nfe", body: body)
388
422
  end
423
+
424
+ private
425
+
426
+ def build_query(params = {}, array_params = {})
427
+ query_parts = []
428
+
429
+ params.each do |key, value|
430
+ next if value.nil?
431
+ query_parts << "#{key}=#{URI.encode_www_form_component(value)}"
432
+ end
433
+
434
+ array_params.each do |key, values|
435
+ next if values.nil? || values.empty?
436
+ values.each do |v|
437
+ query_parts << "#{key}[]=#{URI.encode_www_form_component(v)}"
438
+ end
439
+ end
440
+
441
+ query_parts.join("&")
442
+ end
389
443
  end
390
444
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlingApi
4
- VERSION = "2.1.1"
4
+ VERSION = "2.1.2"
5
5
  end
data/lib/bling_api.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "ac"
4
4
  require "base64"
5
+ require "uri"
5
6
  require_relative "bling_api/version"
6
7
  require_relative "bling_api/client"
7
8
  # require_relative "bling_api/customer" # Deixamos de usar
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bling_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - caio
@@ -37,6 +37,20 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: uri
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
40
54
  email:
41
55
  - caioif4@gmail.com
42
56
  executables: []