bling_api 2.1.0 → 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: 787595ba01abda400e7b0af56a1c8eb1ea9bc8e8f901e68860afbbe5c9f023e8
4
- data.tar.gz: 697a257ed9e6baf3262dbd492bf9f681f5e60bef0b0460234ed3adbe8075eaa4
3
+ metadata.gz: acdb59f982a9de7e9167e33cb175c8621192b505bcf36563328de865933aed60
4
+ data.tar.gz: 0d596f09a0746f9c7b86adf8709aeb60d6d6e82f3cfb5c2b05e5639ec3f71971
5
5
  SHA512:
6
- metadata.gz: 6b11387d4033e9d86c837599b1a5353e602ad74f3c9bbc509737b711c1b5d05765a7437b9af00bdcfa355e9cf8ddf4e92c9be455492deb923b4beed042aa3cb3
7
- data.tar.gz: 07fc87711ff77e1460571fd26f6eaaabff136bfd380767ebebc39c67a9173f5e12dc0fc99e1b8c24428942a1bcc819eaef71d0e005ed993019fb038988cea6bf
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,8 +1,8 @@
1
1
  module BlingApi
2
2
  class Item
3
-
4
- attr_reader :codigo, :id_produto, :quantidade, :valor, :unidade, :desconto, :aliquota_ipi, :descricao, :descricao_detalhada, :comissao_base, :comissao_aliquota, :comissao_valor
5
- def initialize(id_produto:, codigo:, quantidade:, valor:, unidade: nil, desconto: nil, aliquota_ipi: nil, descricao: nil, descricao_detalhada: nil, comissao_base: nil, comissao_aliquota: nil, comissao_valor: nil)
3
+
4
+ attr_reader :codigo, :id_produto, :quantidade, :valor, :unidade, :desconto, :aliquota_ipi, :descricao, :descricao_detalhada, :cest, :origem, :comissao_base, :comissao_aliquota, :comissao_valor
5
+ def initialize(id_produto:, codigo:, quantidade:, valor:, unidade: nil, desconto: nil, aliquota_ipi: nil, descricao: nil, descricao_detalhada: nil, cest: nil, origem: nil, comissao_base: nil, comissao_aliquota: nil, comissao_valor: nil)
6
6
  @codigo = codigo
7
7
  @id_produto = id_produto
8
8
  @quantidade = quantidade
@@ -12,6 +12,8 @@ module BlingApi
12
12
  @aliquota_ipi = aliquota_ipi
13
13
  @descricao = descricao
14
14
  @descricao_detalhada = descricao_detalhada
15
+ @cest = cest
16
+ @origem = origem
15
17
  @comissao_base = comissao_base
16
18
  @comissao_aliquota = comissao_aliquota
17
19
  @comissao_valor = comissao_valor
@@ -27,6 +29,8 @@ module BlingApi
27
29
  aliquotaIPI: aliquota_ipi,
28
30
  descricao: descricao,
29
31
  descricao_detalhada: descricao_detalhada,
32
+ cest: cest,
33
+ origem: origem,
30
34
  produto: {
31
35
  id: id_produto
32
36
  },
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlingApi
4
- VERSION = "2.1.0"
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.0
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: []
@@ -80,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
94
  - !ruby/object:Gem::Version
81
95
  version: '0'
82
96
  requirements: []
83
- rubygems_version: 3.6.9
97
+ rubygems_version: 3.6.7
84
98
  specification_version: 4
85
99
  summary: ''
86
100
  test_files: []