webmaniabr_nfe_ruby 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/models/client.rb +26 -10
- data/lib/models/order.rb +13 -7
- data/lib/models/product.rb +53 -13
- data/lib/models/request.rb +1 -7
- data/lib/models/transport.rb +21 -1
- data/lib/webmaniabr_nfe_ruby.rb +20 -0
- data/lib/webmaniabr_nfe_ruby/cancel_nfe.rb +17 -0
- data/lib/webmaniabr_nfe_ruby/consult_nfe.rb +15 -0
- data/lib/webmaniabr_nfe_ruby/disable_numbering.rb +17 -0
- data/lib/webmaniabr_nfe_ruby/submit_devolution_nfe.rb +19 -0
- data/lib/webmaniabr_nfe_ruby/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9df3e8b6dfd91d62a3246469c5c07259517a8251
|
4
|
+
data.tar.gz: 9feaead4915ef715c60a01a6f599a964f86f6105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a6d94a5eeeececb10b155ced7672a236abed7b6769dc72016ac611c53280f6631f76adc4a78756780fd8120536879e630035555af1678dd30da39b7db8a0f28
|
7
|
+
data.tar.gz: 2375634840e33be10d224bfff74ae74c8e03cdbcfc03847d69ff0f7f3b197476bfe5cf1bab35ccf9793abf36175022286f34bfc50dfe8e1cc5a8a58facbcd959
|
data/lib/models/client.rb
CHANGED
@@ -5,23 +5,39 @@ module WebmaniabrNfeRuby
|
|
5
5
|
:city, :uf, :cep, :phone, :mail
|
6
6
|
|
7
7
|
def initialize(options = {})
|
8
|
-
@cpf
|
9
|
-
@name
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
8
|
+
@cpf = options[:cpf]
|
9
|
+
@name = options[:name]
|
10
|
+
@cnpj = options[:cnpj]
|
11
|
+
@ie = options[:ie]
|
12
|
+
@company_name = options[:company_name]
|
13
|
+
@suframa = options[:suframa]
|
14
|
+
@id_foreign = options[:id_foreign]
|
15
|
+
@foreign_name = options[:foreign_name]
|
16
|
+
@cod_country = options[:cod_country]
|
17
|
+
@country_name = options[:country_name]
|
18
|
+
@address = options[:address]
|
19
|
+
@complement = options[:complement]
|
20
|
+
@number = options[:number]
|
13
21
|
@neighborhood = options[:neighborhood]
|
14
|
-
@city
|
15
|
-
@uf
|
16
|
-
@cep
|
17
|
-
@phone
|
18
|
-
@mail
|
22
|
+
@city = options[:city]
|
23
|
+
@uf = options[:uf]
|
24
|
+
@cep = options[:cep]
|
25
|
+
@phone = options[:phone]
|
26
|
+
@mail = options[:mail]
|
19
27
|
end
|
20
28
|
|
21
29
|
def to_hash
|
22
30
|
{
|
23
31
|
cpf: @cpf,
|
24
32
|
nome_completo: @name,
|
33
|
+
cnpj: @cnpj,
|
34
|
+
ie: @ie,
|
35
|
+
razao_social: @company_name,
|
36
|
+
suframa: @suframa,
|
37
|
+
id_estrangeiro: @id_foreign,
|
38
|
+
nome_estrangeiro: @foreign_name,
|
39
|
+
cod_pais: @cod_country,
|
40
|
+
nome_pais: @country_name,
|
25
41
|
endereco: @address,
|
26
42
|
complemento: @complement,
|
27
43
|
numero: @number,
|
data/lib/models/order.rb
CHANGED
@@ -5,12 +5,15 @@ module WebmaniabrNfeRuby
|
|
5
5
|
:total
|
6
6
|
|
7
7
|
def initialize(options = {})
|
8
|
-
@payment
|
9
|
-
@presence
|
10
|
-
@ship_type
|
11
|
-
@ship_value
|
12
|
-
@discount
|
13
|
-
@total
|
8
|
+
@payment = options[:payment]
|
9
|
+
@presence = options[:presence]
|
10
|
+
@ship_type = options[:ship_type]
|
11
|
+
@ship_value = options[:ship_value]
|
12
|
+
@discount = options[:discount]
|
13
|
+
@total = options[:total]
|
14
|
+
@other_costs = options[:other_costs]
|
15
|
+
@fisco_informations = options[:fisco_informations]
|
16
|
+
@complement_information = options[:complement_information]
|
14
17
|
end
|
15
18
|
|
16
19
|
def to_hash
|
@@ -20,7 +23,10 @@ module WebmaniabrNfeRuby
|
|
20
23
|
modalidade_frete: @ship_type,
|
21
24
|
frete: @ship_value,
|
22
25
|
discount: @discount,
|
23
|
-
total: @total
|
26
|
+
total: @total,
|
27
|
+
despesas_acessorias: @other_costs,
|
28
|
+
informacoes_fisco: @fisco_informations,
|
29
|
+
informacoes_complementares: @complement_information
|
24
30
|
}
|
25
31
|
end
|
26
32
|
end
|
data/lib/models/product.rb
CHANGED
@@ -5,19 +5,40 @@ module WebmaniabrNfeRuby
|
|
5
5
|
:unit, :weight, :origin, :subtotal, :total, :tax_class
|
6
6
|
|
7
7
|
def initialize(options = {})
|
8
|
-
@name
|
9
|
-
@sku
|
10
|
-
@ean
|
11
|
-
@ncm
|
12
|
-
@cest
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
8
|
+
@name = options[:name]
|
9
|
+
@sku = options[:sku]
|
10
|
+
@ean = options[:ean]
|
11
|
+
@ncm = options[:ncm]
|
12
|
+
@cest = options[:cest]
|
13
|
+
@nve = options[:nve]
|
14
|
+
@cnpj_maker = options[:cnpj_maker]
|
15
|
+
@special = options[:special]
|
16
|
+
@drawback = options[:drawback]
|
17
|
+
@reg_exportation = options[:reg_exportation]
|
18
|
+
@nfe_exportation = options[:nfe_exportation]
|
19
|
+
@qtd_exportation = options[:qtd_exportation]
|
20
|
+
@ndoc_import = options[:ndoc_import]
|
21
|
+
@ddoc_import = options[:ddoc_import]
|
22
|
+
@local_clearance = options[:local_clearance]
|
23
|
+
@uf_clearance = options[:uf_clearance]
|
24
|
+
@clearance_date = options[:clearance_date]
|
25
|
+
@ship_type = options[:ship_type]
|
26
|
+
@afrmm = options[:afrmm]
|
27
|
+
@intermediation = options[:intermediation]
|
28
|
+
@cnpj_requester = options[:cnpj_requester]
|
29
|
+
@cod_exportation = options[:cod_exportation]
|
30
|
+
@nfci = options[:nfci]
|
31
|
+
@addition = options[:addition]
|
32
|
+
@seq_addition = options[:seq_addition]
|
33
|
+
@maker = options[:maker]
|
34
|
+
@customs_expenses = options[:customs_expenses]
|
35
|
+
@quantity = options[:quantity]
|
36
|
+
@unit = options[:unit]
|
37
|
+
@weight = options[:weight]
|
38
|
+
@origin = options[:origin]
|
39
|
+
@subtotal = options[:subtotal]
|
40
|
+
@total = options[:total]
|
41
|
+
@tax_class = options[:tax_class]
|
21
42
|
end
|
22
43
|
|
23
44
|
def to_hash
|
@@ -26,7 +47,26 @@ module WebmaniabrNfeRuby
|
|
26
47
|
sku: @sku,
|
27
48
|
ncm: @ncm,
|
28
49
|
cest: @cest,
|
50
|
+
nve: @nve,
|
29
51
|
cnpj_produtor: @cnpj_produtor,
|
52
|
+
especial: @special,
|
53
|
+
drawback: @drawback,
|
54
|
+
reg_exportacao: @reg_exportation,
|
55
|
+
nfe_exportacao: @nfe_exportation,
|
56
|
+
qtd_exportacao: @qtd_exportation,
|
57
|
+
ndoc_importacao: @ndoc_import,
|
58
|
+
ddoc_importacao: @ddoc_import,
|
59
|
+
local_desembaraco: @local_clearance,
|
60
|
+
uf_desembaraco: @uf_clearance,
|
61
|
+
data_desembaraco: @clearance_date,
|
62
|
+
via_transporte: @ship_type,
|
63
|
+
afrmm: @afrmm,
|
64
|
+
intermediacao: @intermediacao,
|
65
|
+
cnpj_terceiro: @cnpj_requester,
|
66
|
+
nfci: @nfci,
|
67
|
+
seq_adicao: @seq_addition,
|
68
|
+
fabricante: @maker,
|
69
|
+
despesas_aduaneiras: @customs_expenses,
|
30
70
|
quantidade: @quantity,
|
31
71
|
unidade: @unit,
|
32
72
|
peso: @weight,
|
data/lib/models/request.rb
CHANGED
@@ -29,12 +29,6 @@ module WebmaniabrNfeRuby
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
if @transport
|
33
|
-
transport = @transport.to_hash
|
34
|
-
else
|
35
|
-
transport = ''
|
36
|
-
end
|
37
|
-
|
38
32
|
{
|
39
33
|
ID: @id,
|
40
34
|
url_notificacao: @url_notification,
|
@@ -47,7 +41,7 @@ module WebmaniabrNfeRuby
|
|
47
41
|
cliente: @client.to_hash,
|
48
42
|
produtos: products,
|
49
43
|
pedido: @order.to_hash,
|
50
|
-
transporte: transport
|
44
|
+
transporte: @transport ? @transport.to_hash : nil
|
51
45
|
}
|
52
46
|
end
|
53
47
|
end
|
data/lib/models/transport.rb
CHANGED
@@ -7,10 +7,20 @@ module WebmaniabrNfeRuby
|
|
7
7
|
@cnpj = options[:cnpj]
|
8
8
|
@company_name = options[:company_name]
|
9
9
|
@ie = options[:ie]
|
10
|
+
@cpf = options[:cpf]
|
11
|
+
@name = options[:name]
|
10
12
|
@address = options[:address]
|
11
13
|
@uf = options[:uf]
|
12
14
|
@city = options[:city]
|
13
15
|
@cep = options[:cep]
|
16
|
+
@board = options[:board]
|
17
|
+
@uf_vehicle = options[:uf_vehicle]
|
18
|
+
@rntc = options[:rntc]
|
19
|
+
@volume = options[:volume]
|
20
|
+
@kind = options[:kind]
|
21
|
+
@mark = options[:mark]
|
22
|
+
@numeration = options[:numeration]
|
23
|
+
@seals = options[:seals]
|
14
24
|
end
|
15
25
|
|
16
26
|
def to_hash
|
@@ -18,10 +28,20 @@ module WebmaniabrNfeRuby
|
|
18
28
|
cnpj: @cnpj,
|
19
29
|
razao_social: @company_name,
|
20
30
|
ie: @ie,
|
31
|
+
cpf: @cpf,
|
32
|
+
nome_completo: @name,
|
21
33
|
endereco: @address,
|
22
34
|
uf: @uf,
|
23
35
|
cidade: @city,
|
24
|
-
cep: @cep
|
36
|
+
cep: @cep,
|
37
|
+
placa: @board,
|
38
|
+
uf_veiculo: @uf_vehicle,
|
39
|
+
rntc: @rntc,
|
40
|
+
volume: @volume,
|
41
|
+
especie: @kind,
|
42
|
+
mark: @mark,
|
43
|
+
numeracao: @numeration,
|
44
|
+
lacres: @seals
|
25
45
|
}
|
26
46
|
end
|
27
47
|
end
|
data/lib/webmaniabr_nfe_ruby.rb
CHANGED
@@ -10,6 +10,10 @@ require 'models/product'
|
|
10
10
|
require 'models/order'
|
11
11
|
require 'models/transport'
|
12
12
|
require 'webmaniabr_nfe_ruby/submit_nfe'
|
13
|
+
require 'webmaniabr_nfe_ruby/submit_devolution_nfe'
|
14
|
+
require 'webmaniabr_nfe_ruby/consult_nfe'
|
15
|
+
require 'webmaniabr_nfe_ruby/cancel_nfe'
|
16
|
+
require 'webmaniabr_nfe_ruby/disable_numbering'
|
13
17
|
|
14
18
|
module WebmaniabrNfeRuby
|
15
19
|
def self.configure
|
@@ -31,4 +35,20 @@ module WebmaniabrNfeRuby
|
|
31
35
|
def self.submit_nfe(options = {})
|
32
36
|
SubmitNfe.new(options).request
|
33
37
|
end
|
38
|
+
|
39
|
+
def self.submit_devolution_nfe(options = {})
|
40
|
+
SubmitDevolutionNfe.new(options).request
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.consult_nfe(options = {})
|
44
|
+
ConsultNfe.new(options).request
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.cancel_nfe(options = {})
|
48
|
+
CancelNfe.new(options).request
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.disable_numbering(options = {})
|
52
|
+
DisableNumbering.new(options).request
|
53
|
+
end
|
34
54
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module WebmaniabrNfeRuby
|
2
|
+
class CancelNfe < ApiInterface
|
3
|
+
def initialize(options = {})
|
4
|
+
@key = options[:key]
|
5
|
+
@reason = options[:reason]
|
6
|
+
|
7
|
+
super('nfe/cancelar')
|
8
|
+
end
|
9
|
+
|
10
|
+
def request
|
11
|
+
return process(method: 'PUT', params: {
|
12
|
+
chave: @key,
|
13
|
+
motivo: @reason
|
14
|
+
})
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module WebmaniabrNfeRuby
|
2
|
+
class DisableNumbering < ApiInterface
|
3
|
+
def initialize(options = {})
|
4
|
+
@range = options[:range]
|
5
|
+
@reason = options[:reason]
|
6
|
+
|
7
|
+
super('nfe/inutilizar/')
|
8
|
+
end
|
9
|
+
|
10
|
+
def request
|
11
|
+
return process(method: 'PUT', params: {
|
12
|
+
sequencia: @range,
|
13
|
+
motivo: @reason
|
14
|
+
})
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module WebmaniabrNfeRuby
|
2
|
+
class SubmitDevolutionNfe < ApiInterface
|
3
|
+
def initialize(options = {})
|
4
|
+
@key = options[:key]
|
5
|
+
@tax_class = options[:tax_class]
|
6
|
+
@operation_nature = options[:operation_nature]
|
7
|
+
|
8
|
+
super('nfe/devolucao/')
|
9
|
+
end
|
10
|
+
|
11
|
+
def request
|
12
|
+
return process(method: 'POST', params: {
|
13
|
+
chave: @key,
|
14
|
+
classe_imposto: @tax_class,
|
15
|
+
natureza_operacao: @operation_nature
|
16
|
+
})
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmaniabr_nfe_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Marcelo Perini Veloso\n\n"
|
@@ -79,8 +79,12 @@ files:
|
|
79
79
|
- lib/webmaniabr_nfe_ruby.rb
|
80
80
|
- lib/webmaniabr_nfe_ruby/api_interface.rb
|
81
81
|
- lib/webmaniabr_nfe_ruby/authenticate.rb
|
82
|
+
- lib/webmaniabr_nfe_ruby/cancel_nfe.rb
|
82
83
|
- lib/webmaniabr_nfe_ruby/configuration.rb
|
84
|
+
- lib/webmaniabr_nfe_ruby/consult_nfe.rb
|
85
|
+
- lib/webmaniabr_nfe_ruby/disable_numbering.rb
|
83
86
|
- lib/webmaniabr_nfe_ruby/sefaz_status.rb
|
87
|
+
- lib/webmaniabr_nfe_ruby/submit_devolution_nfe.rb
|
84
88
|
- lib/webmaniabr_nfe_ruby/submit_nfe.rb
|
85
89
|
- lib/webmaniabr_nfe_ruby/validate_a1_cert.rb
|
86
90
|
- lib/webmaniabr_nfe_ruby/version.rb
|