enotas_nfe 0.0.14 → 0.0.15

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
  SHA1:
3
- metadata.gz: c31d8e903c1267e10e396a82a68e6e824835536c
4
- data.tar.gz: 0c36c6803fe8aad1215dbdf564c6b0917d0903e1
3
+ metadata.gz: 88b73f75a045a75f3b7ac985a8e8668cd4485d5c
4
+ data.tar.gz: 4e60f2b790e5139f8c3cc1689e8414aaa51599fb
5
5
  SHA512:
6
- metadata.gz: 51c149bdf1ad61f99cc674ab3e8517762f85a57e8ac7eac89e00fa5dc9c27f9048f8df475dc25bcd690b57ac1965f2f2e5d3d2dead25022cc10af53ca68bd669
7
- data.tar.gz: e7b9a5bb74dc124691351d2d2e89afb6090b131412a4ac7dd2b0aee749d8f8da3f78065f542bb47e67a50f4e5906bca9a7154633443182d9bb5fced0a5f753d6
6
+ metadata.gz: 0e9af4694012e2785aeb2c4a5ba1c81155610a8110fcdb91b6dc411decdf67776d9b7cda2c82e50799e675eb091247a852eedd6f2ba9b947270f1deb3dd4607d
7
+ data.tar.gz: 7afd65b1ede9b7dd8bfadd289e1c1abf92163df33b3032ceee855628119913ae90ce82aac0c54f5b97ff7df13af496890c45e19b1f72c7cc33fc244f7bf96285
data/README.md CHANGED
@@ -36,7 +36,7 @@ Ou instale manualmente:
36
36
  * Instancie o cliente passando sua API key:
37
37
 
38
38
  ```ruby
39
- client = Enotas::Client.new('sua-api-key-do-e-notas', 'nfse')
39
+ client = EnotasNfe::Client.new('sua-api-key-do-e-notas', 'nfse')
40
40
  ```
41
41
 
42
42
  Agora já podemos emitir uma nota!
@@ -83,7 +83,7 @@ nfe.servico = {
83
83
  nfe.valorTotal = 1.00
84
84
 
85
85
  #enviando a nota
86
- nfe.nfse_create('id-da-empresa-no-enotas', nfe)
86
+ client.nfse_create('id-da-empresa-no-enotas', nfe)
87
87
  client.nfse_delete('id-da-empresa-no-enotas', id-da-nota)
88
88
  ```
89
89
 
@@ -92,7 +92,7 @@ client.nfse_delete('id-da-empresa-no-enotas', id-da-nota)
92
92
  * Instancie o cliente passando sua API key:
93
93
 
94
94
  ```ruby
95
- client = Enotas::Client.new('sua-api-key-do-e-notas', 'nfe')
95
+ client = EnotasNfe::Client.new('sua-api-key-do-e-notas', 'nfe')
96
96
  ```
97
97
 
98
98
  Agora já podemos emitir uma nota!
@@ -169,7 +169,7 @@ client.nfe_delete('id-da-empresa-no-enotas', id-da-nota)
169
169
  * Instancie o cliente passando sua API key:
170
170
 
171
171
  ```ruby
172
- client = Enotas::Client.new('sua-api-key-do-e-notas', 'nfe')
172
+ client = EnotasNfe::Client.new('sua-api-key-do-e-notas', 'nfe')
173
173
  ```
174
174
 
175
175
  Agora já podemos emitir uma nota!
@@ -247,7 +247,7 @@ client.nfe_create('id-da-empresa-no-enotas', nfe)
247
247
  * Para emitir uma NFCE você precisa definir o ID E O CSC em produção, que também servirá para homologação
248
248
 
249
249
  ```ruby
250
- client = Enotas::Client.new('sua-api-key-do-e-notas', 'nfe')
250
+ client = EnotasNfe::Client.new('sua-api-key-do-e-notas', 'nfe')
251
251
  empresa = EnotasNfe::Model::Empresa.new(client.get_empresa('id-da-empresa-no-enotas'))
252
252
  empresa.emissaoNFeConsumidor.ambienteProducao = EnotasNfe::Model::AmbienteProducao.new
253
253
  empresa.emissaoNFeConsumidor.ambienteProducao.serieNFe = "2"
@@ -261,7 +261,7 @@ client.create_update_empresa(empresa)
261
261
  * Instancie o cliente passando sua API key:
262
262
 
263
263
  ```ruby
264
- client = Enotas::Client.new('sua-api-key-do-e-notas', 'nfe')
264
+ client = EnotasNfe::Client.new('sua-api-key-do-e-notas', 'nfe')
265
265
  ```
266
266
 
267
267
  Agora já podemos emitir uma nota!
@@ -284,7 +284,7 @@ nfe.pedido.pagamento = {
284
284
 
285
285
  nfe.pedido.pagamento.formas = [
286
286
  {
287
- "tipo": "Dinheiro",
287
+ "tipo": "Dinheiro",
288
288
  "valor": 10.00
289
289
  }
290
290
  ]
@@ -317,7 +317,7 @@ client.nfce_delete('id-da-empresa-no-enotas', id-da-nota)
317
317
  * Instancie o cliente passando sua API key:
318
318
 
319
319
  ```ruby
320
- client = Enotas::Client.new('sua-api-key-do-e-notas', 'nfe')
320
+ client = EnotasNfe::Client.new('sua-api-key-do-e-notas', 'nfe')
321
321
  ```
322
322
 
323
323
  Agora já podemos emitir uma nota!
@@ -328,7 +328,7 @@ Agora já podemos emitir uma nota!
328
328
  nfe = EnotasNfe::Model::Nfe.new
329
329
  nfe.id = "1"
330
330
  # "Producao" ou "Homologacao"
331
- nfe.ambienteEmissao = "Homologacao"
331
+ nfe.ambienteEmissao = "Homologacao"
332
332
  nfe.naturezaOperacao = "Venda"
333
333
  nfe.finalidade = "Normal"
334
334
  nfe.consumidorFinal = true
@@ -371,7 +371,7 @@ nfe.itens << produto
371
371
 
372
372
  produto = EnotasNfe::Model::Produto.new
373
373
  #OBS: Deve ser utilizado o CFOP 6933 quando for serviço realizado fora do estado.
374
- produto.cfop = "5933"
374
+ produto.cfop = "5933"
375
375
  produto.codigo = "S001"
376
376
  produto.descricao = "Serviço de Troca de Disco de Freio (dianteiro ou traseiro)"
377
377
  produto.ncm = "00"
@@ -1,7 +1,7 @@
1
1
  require 'faraday_middleware'
2
2
 
3
3
  module EnotasNfe
4
- module Connection
4
+ module Connection
5
5
  private
6
6
 
7
7
  def connection
@@ -4,7 +4,7 @@ module EnotasNfe
4
4
 
5
5
  ## rotas para criaçacão/update e onfiguraçao da empresa
6
6
  def get_empresas(pageNumber, pageSize)
7
- get("empresas?pageNumber=#{pageNumber}&pageSize=#{pageNumber}")
7
+ get("empresas?pageNumber=#{pageNumber}&pageSize=#{pageSize}")
8
8
  end
9
9
 
10
10
  def get_empresa(firm_id)
@@ -3,8 +3,11 @@ module EnotasNfe
3
3
  class Cofins
4
4
 
5
5
  include Virtus.model
6
+ require "enotas_nfe/model/valor_imposto"
6
7
 
7
8
  attribute :situacaoTributaria, String
9
+ attribute :porValor, ValorImposto
10
+ attribute :porAliquota, ValorImposto
8
11
 
9
12
  end
10
13
  end
@@ -26,6 +26,7 @@ module EnotasNfe
26
26
  attribute :tipoOperacao, String
27
27
  attribute :nfeReferenciada, Array
28
28
  attribute :transporte, Transporte
29
+ attribute :observacoes, String
29
30
 
30
31
  end
31
32
  end
@@ -3,8 +3,11 @@ module EnotasNfe
3
3
  class Pis
4
4
 
5
5
  include Virtus.model
6
+ require "enotas_nfe/model/valor_imposto"
6
7
 
7
8
  attribute :situacaoTributaria, String
9
+ attribute :porValor, ValorImposto
10
+ attribute :porAliquota, ValorImposto
8
11
 
9
12
  end
10
13
  end
@@ -0,0 +1,12 @@
1
+ module EnotasNfe
2
+ module Model
3
+ class ValorImposto
4
+
5
+ include Virtus.model
6
+
7
+ attribute :aliquota, Float
8
+ attribute :valorPorUnidade, Float
9
+
10
+ end
11
+ end
12
+ end
@@ -1,7 +1,7 @@
1
1
  module EnotasNfe
2
2
  module Request
3
3
  include Connection
4
-
4
+
5
5
  def get(path, body = {})
6
6
  request(:get, path, body)
7
7
  end
@@ -27,7 +27,7 @@ module EnotasNfe
27
27
  request.url(path, body_serialized)
28
28
  when :post
29
29
  request.path = path
30
- puts request.body = body_serialized.to_json
30
+ EnotasNfe.logger.info request.body = body_serialized.to_json
31
31
  request.headers
32
32
  end
33
33
  end
@@ -1,3 +1,3 @@
1
1
  module EnotasNfe
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
data/lib/enotas_nfe.rb CHANGED
@@ -30,6 +30,7 @@ require "enotas_nfe/model/endereco_entrega"
30
30
  require "enotas_nfe/model/transportadora"
31
31
  require "enotas_nfe/model/frete"
32
32
  require "enotas_nfe/model/transporte"
33
+ require "enotas_nfe/model/valor_imposto"
33
34
  require "enotas_nfe/model/nfe"
34
35
  require "enotas_nfe/model/carta_correcao"
35
36
  require "enotas_nfe/model/cofins"
@@ -41,4 +42,11 @@ require "enotas_nfe/facades"
41
42
  require "enotas_nfe/client"
42
43
 
43
44
  module EnotasNfe
45
+ def self.logger
46
+ @@logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
47
+ end
48
+
49
+ def self.logger=(logger)
50
+ @@logger = logger
51
+ end
44
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enotas_nfe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Fernando Pimenta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-08 00:00:00.000000000 Z
11
+ date: 2018-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -157,6 +157,7 @@ files:
157
157
  - lib/enotas_nfe/model/servico.rb
158
158
  - lib/enotas_nfe/model/transportadora.rb
159
159
  - lib/enotas_nfe/model/transporte.rb
160
+ - lib/enotas_nfe/model/valor_imposto.rb
160
161
  - lib/enotas_nfe/model/veiculo.rb
161
162
  - lib/enotas_nfe/model/volume.rb
162
163
  - lib/enotas_nfe/request.rb