enotas_api 1.0.1 → 3.0.0

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: 22d87c29df9db036de3e5a322f8526aab4f71070921567d39fb0e99f4b8ee3a5
4
- data.tar.gz: fccd18305a5a179e2e60ffb443ae4fd65eaada2ea744739d651c7bbd2e5956c5
3
+ metadata.gz: 7c15e10642d206faa8d6ddd3b832b21898559d92486ba3ef95ccae8a0bc550e9
4
+ data.tar.gz: 9ab8de68364a77d1b4e72881a8c17409113028a2d87690eef3d36705eb43ea51
5
5
  SHA512:
6
- metadata.gz: 06626a5268ffb2aaca2b2b86d2bce7d50eeebc2c44a5148ac2388b2e75a14cea795770d830ca2f075621783bb099d2d88089519bb94926359f2d531eb42f244b
7
- data.tar.gz: faf80c71d948c470a040fd8d0e488fae5175094767ea3391d51c25cc391800120eac50bc5179776e8688c6df04dd7dada6c243084da049ec2ae9810fb0fe5c3f
6
+ metadata.gz: c060025b59f214c4494411ea6f9ccd4e4a9850859808fab82722acb633bd823315eac01ac14440ba3e74354e055effcd25f77ffe339e38551acb2ce51c309e96
7
+ data.tar.gz: bd2914379f8f545c0a47e9dcb6054d4884e7f525f56350183870ca0c24d8eb2f30417b59c8501b38c8fa4d2efacd860884a69149ef12a058fb58b570f0b70533
data/.rubocop.yml CHANGED
@@ -1,8 +1,6 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
- Exclude:
5
- - sample.rb
6
4
  NewCops: enable
7
5
  UseCache: true
8
6
  Layout/LineLength:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 2.7.6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 3.0.0
2
+ - Add support to ruby >= 2.7 (compatible with ruby 3)
3
+ - [BREAKING_CHANGE] Drop support for ruby 2.6
4
+ # 2.0.0
5
+ - [BREAKING_CHANGE] Método attributes das classes entity agora renomeado para entity_attributes, porém se mantem attributes nas instancias das mesmas classes
6
+ - Adicionando suporte completo (todos os campos) a NFS-e
7
+ # 1.0.2
8
+ - Ajustando bug na renderização de json, que trazia o atributo inválido @attributes no json
1
9
  # 1.0.1
2
10
  - Suportando valores BigDecimal para tipo :decimal
3
11
  # 1.0.0
data/Gemfile.lock CHANGED
@@ -1,56 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enotas_api (1.0.1)
4
+ enotas_api (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- addressable (2.7.0)
9
+ addressable (2.8.0)
10
10
  public_suffix (>= 2.0.2, < 5.0)
11
- ast (2.4.1)
12
- crack (0.4.4)
13
- diff-lcs (1.4.4)
11
+ ast (2.4.2)
12
+ crack (0.4.5)
13
+ rexml
14
+ diff-lcs (1.5.0)
14
15
  hashdiff (1.0.1)
15
- parallel (1.20.0)
16
- parser (2.7.2.0)
16
+ parallel (1.22.1)
17
+ parser (3.1.2.0)
17
18
  ast (~> 2.4.1)
18
- public_suffix (4.0.6)
19
- rainbow (3.0.0)
19
+ public_suffix (4.0.7)
20
+ rainbow (3.1.1)
20
21
  rake (13.0.1)
21
- regexp_parser (1.8.2)
22
- rexml (3.2.4)
23
- rspec (3.10.0)
24
- rspec-core (~> 3.10.0)
25
- rspec-expectations (~> 3.10.0)
26
- rspec-mocks (~> 3.10.0)
27
- rspec-core (3.10.0)
28
- rspec-support (~> 3.10.0)
29
- rspec-expectations (3.10.0)
22
+ regexp_parser (2.5.0)
23
+ rexml (3.2.5)
24
+ rspec (3.11.0)
25
+ rspec-core (~> 3.11.0)
26
+ rspec-expectations (~> 3.11.0)
27
+ rspec-mocks (~> 3.11.0)
28
+ rspec-core (3.11.0)
29
+ rspec-support (~> 3.11.0)
30
+ rspec-expectations (3.11.0)
30
31
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.10.0)
32
- rspec-mocks (3.10.0)
32
+ rspec-support (~> 3.11.0)
33
+ rspec-mocks (3.11.1)
33
34
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.10.0)
35
- rspec-support (3.10.0)
36
- rubocop (1.3.1)
35
+ rspec-support (~> 3.11.0)
36
+ rspec-support (3.11.0)
37
+ rubocop (1.30.1)
37
38
  parallel (~> 1.10)
38
- parser (>= 2.7.1.5)
39
+ parser (>= 3.1.0.0)
39
40
  rainbow (>= 2.2.2, < 4.0)
40
- regexp_parser (>= 1.8)
41
- rexml
42
- rubocop-ast (>= 1.1.1)
41
+ regexp_parser (>= 1.8, < 3.0)
42
+ rexml (>= 3.2.5, < 4.0)
43
+ rubocop-ast (>= 1.18.0, < 2.0)
43
44
  ruby-progressbar (~> 1.7)
44
- unicode-display_width (>= 1.4.0, < 2.0)
45
- rubocop-ast (1.1.1)
46
- parser (>= 2.7.1.5)
47
- rubocop-rspec (2.0.0)
48
- rubocop (~> 1.0)
49
- rubocop-ast (>= 1.1.0)
50
- ruby-progressbar (1.10.1)
51
- unicode-display_width (1.7.0)
52
- webmock (3.10.0)
53
- addressable (>= 2.3.6)
45
+ unicode-display_width (>= 1.4.0, < 3.0)
46
+ rubocop-ast (1.18.0)
47
+ parser (>= 3.1.1.0)
48
+ rubocop-rspec (2.11.1)
49
+ rubocop (~> 1.19)
50
+ ruby-progressbar (1.11.0)
51
+ unicode-display_width (2.1.0)
52
+ webmock (3.14.0)
53
+ addressable (>= 2.8.0)
54
54
  crack (>= 0.3.2)
55
55
  hashdiff (>= 0.4.0, < 2.0.0)
56
56
 
@@ -60,10 +60,10 @@ PLATFORMS
60
60
  DEPENDENCIES
61
61
  enotas_api!
62
62
  rake (~> 13.0)
63
- rspec (~> 3.10)
64
- rubocop (~> 1.3)
65
- rubocop-rspec (~> 2.0)
66
- webmock (~> 3.10)
63
+ rspec (~> 3.11)
64
+ rubocop (~> 1.30)
65
+ rubocop-rspec (~> 2.11)
66
+ webmock (~> 3.14)
67
67
 
68
68
  BUNDLED WITH
69
- 1.17.3
69
+ 2.1.4
data/README.md CHANGED
@@ -3,14 +3,14 @@
3
3
 
4
4
  EnotasApi é uma gem não oficial porém com design simples, livre de dependências
5
5
 
6
- Criada e mantida com carinho por [@salaozen](https://github.com/salaozen).
6
+ Criada e mantida com carinho por [@bempapp](https://github.com/bempapp).
7
7
 
8
8
  ## English Readers
9
9
  *enotas_api* is a ruby api client for [e-notas](https://enotas.com.br/) [API](https://docs.enotasgw.com.br/reference).
10
10
 
11
11
  EnotasApi its a non oficial, but well with simple design an dependency free
12
12
 
13
- Created and supported with love by [@salaozen](https://github.com/salaozen).
13
+ Created and supported with love by [@bempapp](https://github.com/bempapp).
14
14
 
15
15
  PS: Because e-notas api is entire in portuguese, the code and documentation from here will also be. Sorry about that. :D
16
16
 
@@ -141,15 +141,16 @@ O suporte as novas APIs (V2) com suporte a NFC-e e NF-e estarão disponíveis em
141
141
  - [ ] Manifestação de Destinatário (NF-e)
142
142
 
143
143
  # Como liberar uma nova versão
144
- 1. Atualizar o [CHANGELOG](https://github.com/salaozen/enotas_api/blob/main/CHANGELOG.md)
145
- 1. Atualizar a versão em [version.rb](https://github.com/salaozen/enotas_api/blob/main/lib/enotas_api/version.rb)
144
+ 1. Atualizar o [CHANGELOG](https://github.com/bempapp/enotas_api/blob/main/CHANGELOG.md)
145
+ 1. Atualizar a versão em [version.rb](https://github.com/bempapp/enotas_api/blob/main/lib/enotas_api/version.rb)
146
146
  1. Realizar o commit
147
147
  1. Enviar ao repositório `git push origin main`
148
148
  1. Criar uma tag `git tag <VERSAO> && git push origin <VERSAO>`
149
149
  1. Gerar uma nova versão da gem `gem build enotas_api`
150
150
  1. Publicar a gem `gem push enotas_api-<VERSAO>.gem`
151
+
151
152
  ## Contributing
152
- Bug reports and pull requests are welcome on GitHub at https://github.com/salaozen/enotas_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/salaozen/enotas_api/blob/main/CODE_OF_CONDUCT.md).
153
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bempapp/enotas_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/bempapp/enotas_api/blob/main/CODE_OF_CONDUCT.md).
153
154
 
154
155
  ## License
155
156
 
@@ -157,4 +158,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
157
158
 
158
159
  ## Code of Conduct
159
160
 
160
- Everyone interacting in the EnotasApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/salaozen/enotas_api/blob/main/CODE_OF_CONDUCT.md).
161
+ Everyone interacting in the EnotasApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bempapp/enotas_api/blob/main/CODE_OF_CONDUCT.md).
data/enotas_api.gemspec CHANGED
@@ -6,13 +6,13 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'enotas_api'
7
7
  spec.version = EnotasApi::VERSION
8
8
  spec.authors = ['Eduardo Bohrer']
9
- spec.email = ['eduardo@salaozen.com.br']
9
+ spec.email = ['eduardo@bemp.com.br']
10
10
 
11
11
  spec.summary = 'E-notas API client'
12
12
  spec.description = 'Non oficial, well supported, e-notas ruby api client'
13
- spec.homepage = 'https://github.com/salaozen/enotas_api'
13
+ spec.homepage = 'https://github.com/bempapp/enotas_api'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.6.6')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7')
16
16
 
17
17
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
18
 
@@ -28,8 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_development_dependency 'rake', '~> 13.0'
31
- spec.add_development_dependency 'rspec', '~> 3.10'
32
- spec.add_development_dependency 'rubocop', '~> 1.3'
33
- spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
34
- spec.add_development_dependency 'webmock', '~> 3.10'
31
+ spec.add_development_dependency 'rspec', '~> 3.11'
32
+ spec.add_development_dependency 'rubocop', '~> 1.30'
33
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.11'
34
+ spec.add_development_dependency 'webmock', '~> 3.14'
35
+ spec.metadata['rubygems_mfa_required'] = 'true'
35
36
  end
@@ -1,17 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
+ require 'date'
5
+ require 'time'
4
6
  require_relative '../support/attributable'
5
7
 
6
8
  module EnotasApi
7
9
  class Entity
8
10
  include EnotasApi::Attributable
9
11
 
12
+ def as_json(_options = nil)
13
+ attributes.keys
14
+ .map { |att| [att, json_value(att)] }
15
+ .reject { |e| e[1].nil? && !attribute_changed?(e[0]) }
16
+ .to_h
17
+ end
18
+
10
19
  def to_json(options = nil)
11
- self.class.attributes.keys
12
- .map { |att| [att, send(att)] }
13
- .reject { |e| e[1].nil? && !attribute_changed?(e[0]) }
14
- .to_h.to_json(options)
20
+ as_json.to_json(options)
21
+ end
22
+
23
+ private
24
+
25
+ def json_value(attr)
26
+ value = send(attr)
27
+ return nil if value.nil?
28
+
29
+ type = attribute_type(attr)
30
+
31
+ return value.as_json if type.is_a?(Class)
32
+ return value.to_time.utc.iso8601 if type == :datetime
33
+
34
+ value
15
35
  end
16
36
  end
17
37
  end
@@ -44,7 +44,7 @@ module EnotasApi
44
44
  def configure_request_headers(request, custom_headers)
45
45
  {
46
46
  'Authorization' => "Basic #{EnotasApi::Configuration.current.api_key}",
47
- "Accept": 'application/json',
47
+ Accept: 'application/json',
48
48
  'Content-Type' => 'application/json',
49
49
  'User-Agent' => 'Enotas-Ruby-SDK'
50
50
  }.merge(custom_headers).each { |key, value| request[key] = value }
@@ -21,7 +21,11 @@ module EnotasApi
21
21
  end
22
22
 
23
23
  def attributes
24
- self.class.attributes
24
+ self.class.entity_attributes
25
+ end
26
+
27
+ def attribute_type(attribute)
28
+ self.class.attribute_type(attribute)
25
29
  end
26
30
 
27
31
  def set(attributes)
@@ -51,9 +55,17 @@ module EnotasApi
51
55
  end
52
56
  end
53
57
 
54
- def attributes
58
+ def attributes(map)
59
+ map.each_pair(&method(:attribute))
60
+ end
61
+
62
+ def entity_attributes
55
63
  (@attributes || {}).freeze
56
64
  end
65
+
66
+ def attribute_type(attribute)
67
+ entity_attributes[attribute.to_sym]
68
+ end
57
69
  end
58
70
  end
59
71
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bigdecimal'
4
+ require 'date'
4
5
 
5
6
  module EnotasApi
6
7
  class TypeHandler
@@ -9,6 +10,7 @@ module EnotasApi
9
10
  decimal: ->(value, _type) { value.is_a?(Float) || value.is_a?(Integer) || value.is_a?(BigDecimal) },
10
11
  integer: ->(value, _type) { value.is_a?(Integer) },
11
12
  string: ->(value, _type) { value.is_a?(String) },
13
+ datetime: ->(value, _type) { value.is_a?(DateTime) || value.is_a?(Date) },
12
14
  entity: ->(value, type) { value.is_a?(type) || value.is_a?(Hash) }
13
15
  }.freeze
14
16
 
@@ -7,25 +7,25 @@ require_relative 'empresa_configuracoes'
7
7
  module EnotasApi
8
8
  module V1
9
9
  class Empresa < EnotasApi::Entity
10
- attribute :id, :string
11
- attribute :cnpj, :string
12
- attribute :inscricaoMunicipal, :string
13
- attribute :inscricaoEstadual, :string
14
- attribute :razaoSocial, :string
15
- attribute :nomeFantasia, :string
16
- attribute :optanteSimplesNacional, :boolean
17
- attribute :email, :string
18
- attribute :telefoneComercial, :string
19
- attribute :incentivadorCultural, :boolean
20
- attribute :regimeEspecialTributacao, :string
21
- attribute :codigoServicoMunicipal, :string
22
- attribute :cnae, :string
23
- attribute :aliquotaIss, :decimal
24
- attribute :descricaoServico, :string
25
- attribute :itemListaServicoLC116, :string
26
- attribute :endereco, EnotasApi::V1::EmpresaEndereco
27
- attribute :configuracoesNFSeHomologacao, EnotasApi::V1::EmpresaConfiguracoes
28
- attribute :configuracoesNFSeProducao, EnotasApi::V1::EmpresaConfiguracoes
10
+ attributes id: :string,
11
+ cnpj: :string,
12
+ inscricaoMunicipal: :string,
13
+ inscricaoEstadual: :string,
14
+ razaoSocial: :string,
15
+ nomeFantasia: :string,
16
+ optanteSimplesNacional: :boolean,
17
+ email: :string,
18
+ telefoneComercial: :string,
19
+ incentivadorCultural: :boolean,
20
+ regimeEspecialTributacao: :string,
21
+ codigoServicoMunicipal: :string,
22
+ cnae: :string,
23
+ aliquotaIss: :decimal,
24
+ descricaoServico: :string,
25
+ itemListaServicoLC116: :string,
26
+ endereco: EmpresaEndereco,
27
+ configuracoesNFSeHomologacao: EmpresaConfiguracoes,
28
+ configuracoesNFSeProducao: EmpresaConfiguracoes
29
29
  end
30
30
  end
31
31
  end
@@ -5,12 +5,12 @@ require_relative '../../common/entity'
5
5
  module EnotasApi
6
6
  module V1
7
7
  class EmpresaConfiguracoes < EnotasApi::Entity
8
- attribute :sequencialNFe, :integer
9
- attribute :serieNFe, :string
10
- attribute :sequencialLoteNFe, :integer
11
- attribute :usuarioAcessoProvedor, :string
12
- attribute :senhaAcessoProvedor, :string
13
- attribute :tokenAcessoProvedor, :string
8
+ attributes sequencialNFe: :integer,
9
+ serieNFe: :string,
10
+ sequencialLoteNFe: :integer,
11
+ usuarioAcessoProvedor: :string,
12
+ senhaAcessoProvedor: :string,
13
+ tokenAcessoProvedor: :string
14
14
  end
15
15
  end
16
16
  end
@@ -5,16 +5,16 @@ require_relative '../../common/entity'
5
5
  module EnotasApi
6
6
  module V1
7
7
  class EmpresaEndereco < EnotasApi::Entity
8
- attribute :codigoIbgeUf, :integer
9
- attribute :codigoIbgeCidade, :integer
10
- attribute :pais, :string
11
- attribute :uf, :string
12
- attribute :cidade, :string
13
- attribute :logradouro, :string
14
- attribute :numero, :string
15
- attribute :complemento, :string
16
- attribute :bairro, :string
17
- attribute :cep, :string
8
+ attributes codigoIbgeUf: :integer,
9
+ codigoIbgeCidade: :integer,
10
+ pais: :string,
11
+ uf: :string,
12
+ cidade: :string,
13
+ logradouro: :string,
14
+ numero: :string,
15
+ complemento: :string,
16
+ bairro: :string,
17
+ cep: :string
18
18
  end
19
19
  end
20
20
  end
@@ -3,17 +3,26 @@
3
3
  require_relative '../../common/entity'
4
4
  require_relative 'nfs_cliente'
5
5
  require_relative 'nfs_servico'
6
+ require_relative 'nfs_dados_adicionais_email'
6
7
 
7
8
  module EnotasApi
8
9
  module V1
9
10
  class Nfs < EnotasApi::Entity
10
- attribute :idExterno, :string
11
- attribute :ambienteEmissao, :string
12
- attribute :enviarPorEmail, :boolean
13
- attribute :cliente, EnotasApi::V1::NfsCliente
14
- attribute :servico, EnotasApi::V1::NfsServico
15
- attribute :valorTotal, :decimal
16
- attribute :observacoes, :string
11
+ attributes idExterno: :string,
12
+ ambienteEmissao: :string,
13
+ numeroRps: :integer,
14
+ serieRps: :string,
15
+ tipo: :string,
16
+ dataCompetencia: :datetime,
17
+ enviarPorEmail: :boolean,
18
+ dadosAdicionaisEmail: NfsDadosAdicionaisEmail,
19
+ cliente: NfsCliente,
20
+ servico: NfsServico,
21
+ naturezaOperacao: :string,
22
+ deducoes: :decimal,
23
+ descontos: :decimal,
24
+ valorTotal: :decimal,
25
+ observacoes: :string
17
26
  end
18
27
  end
19
28
  end
@@ -6,11 +6,14 @@ require_relative 'nfs_cliente_endereco'
6
6
  module EnotasApi
7
7
  module V1
8
8
  class NfsCliente < EnotasApi::Entity
9
- attribute :tipoPessoa, :string
10
- attribute :nome, :string
11
- attribute :email, :string
12
- attribute :cpfCnpj, :string
13
- attribute :endereco, EnotasApi::V1::NfsClienteEndereco
9
+ attributes tipoPessoa: :string,
10
+ nome: :string,
11
+ email: :string,
12
+ cpfCnpj: :string,
13
+ inscricaoMunicipal: :string,
14
+ inscricaoEstadual: :string,
15
+ telefone: :string,
16
+ endereco: NfsClienteEndereco
14
17
  end
15
18
  end
16
19
  end
@@ -5,13 +5,13 @@ require_relative '../../common/entity'
5
5
  module EnotasApi
6
6
  module V1
7
7
  class NfsClienteEndereco < EnotasApi::Entity
8
- attribute :logradouro, :string
9
- attribute :numero, :string
10
- attribute :complemento, :string
11
- attribute :bairro, :string
12
- attribute :cep, :string
13
- attribute :uf, :string
14
- attribute :cidade, :string
8
+ attributes logradouro: :string,
9
+ numero: :string,
10
+ complemento: :string,
11
+ bairro: :string,
12
+ cep: :string,
13
+ uf: :string,
14
+ cidade: :string
15
15
  end
16
16
  end
17
17
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../common/entity'
4
+ require_relative 'nfs_cliente'
5
+ require_relative 'nfs_servico'
6
+
7
+ module EnotasApi
8
+ module V1
9
+ class NfsDadosAdicionaisEmail < EnotasApi::Entity
10
+ attributes outrosDestinatarios: :string
11
+ end
12
+ end
13
+ end
@@ -5,17 +5,21 @@ require_relative '../../common/entity'
5
5
  module EnotasApi
6
6
  module V1
7
7
  class NfsServico < EnotasApi::Entity
8
- attribute :descricao, :string
9
- attribute :aliquotaIss, :decimal
10
- attribute :issRetidoFonte, :boolean
11
- attribute :cnae, :string
12
- attribute :codigoServicoMunicipio, :string
13
- attribute :valorPis, :decimal
14
- attribute :valorCofins, :decimal
15
- attribute :valorCsll, :decimal
16
- attribute :valorInss, :decimal
17
- attribute :valorIr, :decimal
18
- attribute :codigoInternoServicoMunicipal, :string
8
+ attributes ufPrestacaoServico: :string,
9
+ municipioPrestacaoServico: :string,
10
+ descricao: :string,
11
+ aliquotaIss: :decimal,
12
+ issRetidoFonte: :boolean,
13
+ cnae: :string,
14
+ codigoServicoMunicipio: :string,
15
+ descricaoServicoMunicipio: :string,
16
+ itemListaServicoLC116: :string,
17
+ valorPis: :decimal,
18
+ valorCofins: :decimal,
19
+ valorCsll: :decimal,
20
+ valorInss: :decimal,
21
+ valorIr: :decimal,
22
+ codigoInternoServicoMunicipal: :string
19
23
  end
20
24
  end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EnotasApi
4
- VERSION = '1.0.1'
4
+ VERSION = '3.0.0'
5
5
  end
data/sample2.rb ADDED
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+ # rubocop:disable all
3
+
4
+ require_relative 'lib/enotas_api'
5
+
6
+ EnotasApi::Configuration.configure(api_key: 'Nzk2ZGViNWUtYWY0YS00M2Y3LThhMjEtZGU4MTYzODkwNjAw')
7
+
8
+ sz = EnotasApi::V1::Empresa.new({
9
+ id: 'b90c486b-b53e-48a6-8f94-141f83980600',
10
+ cnpj: '31552469000167',
11
+ inscricaoMunicipal: '61114626',
12
+ razaoSocial: 'Salão Zen Desenvolvimento de Sistemas LTDA',
13
+ nomeFantasia: 'Salão Zen',
14
+ optanteSimplesNacional: true,
15
+ email: 'administrativo@salaozen.com.br',
16
+ telefoneComercial: '51 993286954',
17
+ aliquotaIss: 2.0,
18
+ regimeEspecialTributacao: '6',
19
+ # codigoServicoMunicipal: '010100100',
20
+ # descricaoServico: 'Análise de sistemas',
21
+ # itemListaServicoLC116: '1.01',
22
+ endereco: {
23
+ codigoIbgeUf: 43,
24
+ codigoIbgeCidade: 4_314_902,
25
+ pais: 'Brasil',
26
+ uf: 'RS',
27
+ cidade: 'Porto Alegre',
28
+ logradouro: 'Avenida Jose Aloisio Filho',
29
+ numero: '411',
30
+ complemento: '266',
31
+ bairro: 'Humaitá',
32
+ cep: '90250180'
33
+ },
34
+ configuracoesNFSeHomologacao: {
35
+ sequencialNFe: 1,
36
+ serieNFe: '1',
37
+ sequencialLoteNFe: 1,
38
+ usuarioAcessoProvedor: nil,
39
+ senhaAcessoProvedor: nil,
40
+ tokenAcessoProvedor: nil
41
+ },
42
+ configuracoesNFSeProducao: {
43
+ sequencialNFe: 682,
44
+ serieNFe: '1',
45
+ sequencialLoteNFe: 682,
46
+ usuarioAcessoProvedor: nil,
47
+ senhaAcessoProvedor: nil,
48
+ tokenAcessoProvedor: nil
49
+ }
50
+ })
51
+
52
+ nfs = EnotasApi::V1::Nfs.new(
53
+ idExterno: "teste-#{Random.rand(999_999_999)}",
54
+ ambienteEmissao: 'Homologacao',
55
+ enviarPorEmail: true,
56
+ cliente: {
57
+ tipoPessoa: 'F',
58
+ nome: 'Luis Eduardo Bohrer da Silva',
59
+ email: 'eduardo@salaozen.com.br',
60
+ cpfCnpj: '00910366071',
61
+ endereco: {
62
+ uf: 'RS',
63
+ cidade: 'Porto Alegre',
64
+ logradouro: 'Avenida Jose Aloisio Filho',
65
+ numero: '411',
66
+ complemento: '266',
67
+ bairro: 'Humaitá',
68
+ cep: '90250180'
69
+ }
70
+ },
71
+ servico: {
72
+ descricao: 'Teste'
73
+ # codigoInternoServicoMunicipal: "14283"
74
+ },
75
+ valorTotal: 1.0,
76
+ observacoes: 'Teste'
77
+ )
78
+
79
+ # json_nota = EnotasApi::V1::EmitirNfs.new(sz.id, nfs).call
80
+ # puts 'JSON NOTA', json_nota.to_json
81
+
82
+ # puts EnotasApi::V1::ConsultarNfs.new(sz.id, json_nota.nfeId).call.to_json
83
+
84
+ nfId = 'abb97f74-f98b-4dbb-a48b-1c1991d60600'
85
+ nfId = 'f2acaf7f-918a-4f67-8248-88b9c6d60600'
86
+ salonId = '0569139F-03F6-4189-A224-D546E49D0600'
87
+ puts EnotasApi::V1::ConsultarNfs.new(salonId, nfId).call.to_json
88
+
89
+ # "valorCofins":0.0,"valorCsll":0.0,"valorInss":0.0,"valorIr":0.0,"valorPis":0.0,","valorIss":48.0
data/sample3.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # rubocop:disable all
3
+
4
+ require_relative 'lib/enotas_api'
5
+
6
+ EnotasApi::Configuration.configure(api_key: 'Nzk2ZGViNWUtYWY0YS00M2Y3LThhMjEtZGU4MTYzODkwNjAw')
7
+
8
+ puts EnotasApi::V1::ConsultarNfs.new('B90C486B-B53E-48A6-8F94-141F83980600', 'development:nfs:2:1:bu').call.to_json
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enotas_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Bohrer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-23 00:00:00.000000000 Z
11
+ date: 2022-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,59 +30,59 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.10'
33
+ version: '3.11'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.10'
40
+ version: '3.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '1.30'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '1.30'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.0'
61
+ version: '2.11'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.0'
68
+ version: '2.11'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.10'
75
+ version: '3.14'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.10'
82
+ version: '3.14'
83
83
  description: Non oficial, well supported, e-notas ruby api client
84
84
  email:
85
- - eduardo@salaozen.com.br
85
+ - eduardo@bemp.com.br
86
86
  executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
@@ -137,6 +137,7 @@ files:
137
137
  - lib/enotas_api/v1/entities/nfs.rb
138
138
  - lib/enotas_api/v1/entities/nfs_cliente.rb
139
139
  - lib/enotas_api/v1/entities/nfs_cliente_endereco.rb
140
+ - lib/enotas_api/v1/entities/nfs_dados_adicionais_email.rb
140
141
  - lib/enotas_api/v1/entities/nfs_servico.rb
141
142
  - lib/enotas_api/v1/habilitar_empresa.rb
142
143
  - lib/enotas_api/v1/incluir_atualizar_empresa.rb
@@ -145,14 +146,17 @@ files:
145
146
  - lib/enotas_api/v1/vincular_certificado.rb
146
147
  - lib/enotas_api/v1/vincular_logotipo.rb
147
148
  - lib/enotas_api/version.rb
148
- homepage: https://github.com/salaozen/enotas_api
149
+ - sample2.rb
150
+ - sample3.rb
151
+ homepage: https://github.com/bempapp/enotas_api
149
152
  licenses:
150
153
  - MIT
151
154
  metadata:
152
155
  allowed_push_host: https://rubygems.org
153
- homepage_uri: https://github.com/salaozen/enotas_api
154
- source_code_uri: https://github.com/salaozen/enotas_api
155
- changelog_uri: https://github.com/salaozen/enotas_api/blob/master/CHANGELOG.md
156
+ homepage_uri: https://github.com/bempapp/enotas_api
157
+ source_code_uri: https://github.com/bempapp/enotas_api
158
+ changelog_uri: https://github.com/bempapp/enotas_api/blob/master/CHANGELOG.md
159
+ rubygems_mfa_required: 'true'
156
160
  post_install_message:
157
161
  rdoc_options: []
158
162
  require_paths:
@@ -161,14 +165,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
165
  requirements:
162
166
  - - ">="
163
167
  - !ruby/object:Gem::Version
164
- version: 2.6.6
168
+ version: '2.7'
165
169
  required_rubygems_version: !ruby/object:Gem::Requirement
166
170
  requirements:
167
171
  - - ">="
168
172
  - !ruby/object:Gem::Version
169
173
  version: '0'
170
174
  requirements: []
171
- rubygems_version: 3.0.8
175
+ rubygems_version: 3.1.6
172
176
  signing_key:
173
177
  specification_version: 4
174
178
  summary: E-notas API client