nfe-paulistana 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +49 -0
- data/Rakefile +1 -0
- data/lib/nfe-paulistana.rb +316 -0
- data/lib/nfe-paulistana/version.rb +3 -0
- data/nfe-paulistana.gemspec +27 -0
- data/test.rb +21 -0
- metadata +117 -0
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
.bundle
|
2
|
+
db/*.sqlite3
|
3
|
+
log/*.log
|
4
|
+
tmp/
|
5
|
+
.sass-cache/
|
6
|
+
coverage/
|
7
|
+
*~
|
8
|
+
*.DS_Store
|
9
|
+
*.out
|
10
|
+
*.swp
|
11
|
+
.sass-cache/
|
12
|
+
.sass-cache/*
|
13
|
+
.sass-cache/**
|
14
|
+
tmp/
|
15
|
+
tmp/*/*
|
16
|
+
tmp/**
|
17
|
+
*/*.swp
|
18
|
+
db/schema.rb
|
19
|
+
public/system/*
|
20
|
+
public/system/**
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nfe-paulistana (0.0.1)
|
5
|
+
nokogiri
|
6
|
+
savon
|
7
|
+
signer
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
akami (1.0.0)
|
13
|
+
gyoku (>= 0.4.0)
|
14
|
+
builder (3.0.0)
|
15
|
+
diff-lcs (1.1.3)
|
16
|
+
gyoku (0.4.4)
|
17
|
+
builder (>= 2.1.2)
|
18
|
+
httpi (0.9.7)
|
19
|
+
rack
|
20
|
+
nokogiri (1.5.2)
|
21
|
+
nori (1.1.0)
|
22
|
+
rack (1.4.1)
|
23
|
+
rspec (2.10.0)
|
24
|
+
rspec-core (~> 2.10.0)
|
25
|
+
rspec-expectations (~> 2.10.0)
|
26
|
+
rspec-mocks (~> 2.10.0)
|
27
|
+
rspec-core (2.10.1)
|
28
|
+
rspec-expectations (2.10.0)
|
29
|
+
diff-lcs (~> 1.1.3)
|
30
|
+
rspec-mocks (2.10.1)
|
31
|
+
savon (0.9.9)
|
32
|
+
akami (~> 1.0)
|
33
|
+
builder (>= 2.1.2)
|
34
|
+
gyoku (>= 0.4.0)
|
35
|
+
httpi (~> 0.9)
|
36
|
+
nokogiri (>= 1.4.0)
|
37
|
+
nori (~> 1.1)
|
38
|
+
wasabi (~> 2.1)
|
39
|
+
signer (1.0.0)
|
40
|
+
nokogiri (>= 1.5.1)
|
41
|
+
wasabi (2.1.1)
|
42
|
+
nokogiri (>= 1.4.0)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
nfe-paulistana!
|
49
|
+
rspec
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,316 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require "nfe-paulistana/version"
|
4
|
+
require "signer"
|
5
|
+
require "savon"
|
6
|
+
|
7
|
+
class NfePaulistana
|
8
|
+
def initialize(options)
|
9
|
+
default_options = {
|
10
|
+
:cpf_remetente => '',
|
11
|
+
:cnpj_remetente => '',
|
12
|
+
:inscricao_prestador => '',
|
13
|
+
:serie_rps => '',
|
14
|
+
:numero_rps => '',
|
15
|
+
:tipo_rps => '',
|
16
|
+
:data_emissao => '',
|
17
|
+
:status_rps => '',
|
18
|
+
:tributacao_rps => '',
|
19
|
+
:valor_servicos => '0',
|
20
|
+
:valor_deducoes => '0',
|
21
|
+
:valor_pis => '0',
|
22
|
+
:valor_cofins => '0',
|
23
|
+
:valor_inss => '0',
|
24
|
+
:valor_ir => '0',
|
25
|
+
:valor_csll => '0',
|
26
|
+
:codigo_servico => '0',
|
27
|
+
:aliquota_servicos => '0',
|
28
|
+
:iss_retido => false,
|
29
|
+
:cpf_tomador => '',
|
30
|
+
:cnpj_tomador => '',
|
31
|
+
:im_tomador => '',
|
32
|
+
:ie_tomador => '',
|
33
|
+
:razao_tomador => '',
|
34
|
+
:tp_logradouro => '',
|
35
|
+
:logradouro => '',
|
36
|
+
:nr_endereco => '',
|
37
|
+
:compl_endereco => '',
|
38
|
+
:bairro => '',
|
39
|
+
:cidade => '',
|
40
|
+
:uf => '',
|
41
|
+
:cep => '',
|
42
|
+
:email_tomador => '',
|
43
|
+
:discriminacao => '',
|
44
|
+
:cert_path => '',
|
45
|
+
:cert_pass => '',
|
46
|
+
:wsdl => 'https://nfe.prefeitura.sp.gov.br/ws/lotenfe.asmx?wsdl'
|
47
|
+
}
|
48
|
+
|
49
|
+
@options = default_options.merge(options)
|
50
|
+
|
51
|
+
@certificado = OpenSSL::PKCS12.new(File.read(@options[:cert_path]), @options[:cert_pass])
|
52
|
+
end
|
53
|
+
|
54
|
+
def enviar
|
55
|
+
client = Savon::Client.new do |wsdl, http|
|
56
|
+
wsdl.document = @options[:wsdl]
|
57
|
+
# http.auth.ssl.cert_key_file = "/Users/patricknegri/Desenvolvimento/Certificado-Iugu-Chave.pem"
|
58
|
+
# http.auth.ssl.cert_file = "/Users/patricknegri/Desenvolvimento/Certificado-Iugu.pem"
|
59
|
+
http.auth.ssl.cert_key = @certificado.key
|
60
|
+
http.auth.ssl.cert = @certificado.certificate
|
61
|
+
http.auth.ssl.verify_mode = :peer
|
62
|
+
|
63
|
+
# http.ssl_client_auth( :cert => @certificado, :key => @certificado.key, :verify_mode => OpenSSL::SSL::VERIFY_NONE )
|
64
|
+
# http.auth.ssl.cert = @certificado
|
65
|
+
# http.auth.ssl.key = @certificado.key
|
66
|
+
# http.auth.ssl.verify_mode = :none
|
67
|
+
end
|
68
|
+
|
69
|
+
Savon.configure do |config|
|
70
|
+
config.soap_version = 2
|
71
|
+
end
|
72
|
+
Savon.env_namespace = :soap
|
73
|
+
|
74
|
+
#http.ssl_client_auth( :cert => @certificado, :key => @certificado.key, :verify_mode => OpenSSL::SSL::VERIFY_NONE )
|
75
|
+
|
76
|
+
begin
|
77
|
+
response = client.request(:envio_rps) do |soap|
|
78
|
+
soap.input = [
|
79
|
+
"EnvioRPSRequest",
|
80
|
+
{"xmlns" => "http://www.prefeitura.sp.gov.br/nfe"}
|
81
|
+
]
|
82
|
+
doc_txt = "<VersaoSchema>1</VersaoSchema><MensagemXML>" + assinar(to_xml).gsub("&","&").gsub(">",">").gsub("<","<").gsub("\"",""").gsub("'","'") + "</MensagemXML>"
|
83
|
+
doc_txt = doc_txt.gsub(/\n/,'')
|
84
|
+
doc_xml = Nokogiri::XML( doc_txt )
|
85
|
+
|
86
|
+
|
87
|
+
soap.body = doc_txt
|
88
|
+
|
89
|
+
# soap.body = assinar( to_xml )
|
90
|
+
soap.version = 2
|
91
|
+
end
|
92
|
+
@retorno_xml = response.to_hash[:envio_rps_response][:retorno_xml]
|
93
|
+
@retorno = Nori.parse( retorno_xml )[:retorno_envio_rps]
|
94
|
+
@success = @retorno[:cabecalho][:sucesso]
|
95
|
+
rescue Savon::Error => error
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def retorno_xml
|
100
|
+
@retorno_xml
|
101
|
+
end
|
102
|
+
|
103
|
+
def retorno
|
104
|
+
@retorno
|
105
|
+
end
|
106
|
+
|
107
|
+
def success?
|
108
|
+
!!@success
|
109
|
+
end
|
110
|
+
|
111
|
+
def error
|
112
|
+
if !success?
|
113
|
+
errors = retorno[:alerta] || retorno[:erro]
|
114
|
+
errors.try('[]', :descricao)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def assinar(xml)
|
121
|
+
|
122
|
+
xml = Nokogiri::XML(xml.to_s, &:noblanks)
|
123
|
+
|
124
|
+
# 1. Digest Hash for all XML
|
125
|
+
xml_canon = xml.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0)
|
126
|
+
xml_digest = Base64.encode64(OpenSSL::Digest::SHA1.digest(xml_canon)).strip
|
127
|
+
|
128
|
+
# 2. Add Signature Node
|
129
|
+
signature = xml.xpath("//ds:Signature", "ds" => "http://www.w3.org/2000/09/xmldsig#").first
|
130
|
+
unless signature
|
131
|
+
signature = Nokogiri::XML::Node.new('Signature', xml)
|
132
|
+
signature.default_namespace = 'http://www.w3.org/2000/09/xmldsig#'
|
133
|
+
xml.root().add_child(signature)
|
134
|
+
end
|
135
|
+
|
136
|
+
# 3. Add Elements to Signature Node
|
137
|
+
|
138
|
+
# 3.1 Create Signature Info
|
139
|
+
signature_info = Nokogiri::XML::Node.new('SignedInfo', xml)
|
140
|
+
|
141
|
+
# 3.2 Add CanonicalizationMethod
|
142
|
+
child_node = Nokogiri::XML::Node.new('CanonicalizationMethod', xml)
|
143
|
+
child_node['Algorithm'] = 'http://www.w3.org/2001/10/xml-exc-c14n#'
|
144
|
+
signature_info.add_child child_node
|
145
|
+
|
146
|
+
# 3.3 Add SignatureMethod
|
147
|
+
child_node = Nokogiri::XML::Node.new('SignatureMethod', xml)
|
148
|
+
child_node['Algorithm'] = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
|
149
|
+
signature_info.add_child child_node
|
150
|
+
|
151
|
+
# 3.4 Create Reference
|
152
|
+
reference = Nokogiri::XML::Node.new('Reference', xml)
|
153
|
+
reference['URI'] = ''
|
154
|
+
|
155
|
+
# 3.5 Add Transforms
|
156
|
+
transforms = Nokogiri::XML::Node.new('Transforms', xml)
|
157
|
+
|
158
|
+
child_node = Nokogiri::XML::Node.new('Transform', xml)
|
159
|
+
child_node['Algorithm'] = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
|
160
|
+
transforms.add_child child_node
|
161
|
+
|
162
|
+
child_node = Nokogiri::XML::Node.new('Transform', xml)
|
163
|
+
child_node['Algorithm'] = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'
|
164
|
+
transforms.add_child child_node
|
165
|
+
|
166
|
+
reference.add_child transforms
|
167
|
+
|
168
|
+
# 3.6 Add Digest
|
169
|
+
child_node = Nokogiri::XML::Node.new('DigestMethod', xml)
|
170
|
+
child_node['Algorithm'] = 'http://www.w3.org/2000/09/xmldsig#sha1'
|
171
|
+
reference.add_child child_node
|
172
|
+
|
173
|
+
# 3.6 Add DigestValue
|
174
|
+
child_node = Nokogiri::XML::Node.new('DigestValue', xml)
|
175
|
+
child_node.content = xml_digest
|
176
|
+
reference.add_child child_node
|
177
|
+
|
178
|
+
# 3.7 Add Reference and Signature Info
|
179
|
+
signature_info.add_child reference
|
180
|
+
signature.add_child signature_info
|
181
|
+
|
182
|
+
# 4 Sign Signature
|
183
|
+
sign_canon = signature_info.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0)
|
184
|
+
signature_hash = @certificado.key.sign(OpenSSL::Digest::SHA1.new, sign_canon)
|
185
|
+
signature_value = Base64.encode64( signature_hash ).gsub("\n", '')
|
186
|
+
|
187
|
+
# 4.1 Add SignatureValue
|
188
|
+
child_node = Nokogiri::XML::Node.new('SignatureValue', xml)
|
189
|
+
child_node.content = signature_value
|
190
|
+
signature.add_child child_node
|
191
|
+
|
192
|
+
# 5 Create KeyInfo
|
193
|
+
key_info = Nokogiri::XML::Node.new('KeyInfo', xml)
|
194
|
+
|
195
|
+
# 5.1 Add X509 Data and Certificate
|
196
|
+
x509_data = Nokogiri::XML::Node.new('X509Data', xml)
|
197
|
+
x509_certificate = Nokogiri::XML::Node.new('X509Certificate', xml)
|
198
|
+
x509_certificate.content = @certificado.certificate.to_s.gsub(/\-\-\-\-\-[A-Z]+ CERTIFICATE\-\-\-\-\-/, "").gsub(/\n/,"")
|
199
|
+
|
200
|
+
x509_data.add_child x509_certificate
|
201
|
+
key_info.add_child x509_data
|
202
|
+
|
203
|
+
# 5.2 Add KeyInfo
|
204
|
+
signature.add_child key_info
|
205
|
+
|
206
|
+
# 6 Add Signature
|
207
|
+
xml.root().add_child signature
|
208
|
+
|
209
|
+
# Return XML
|
210
|
+
xml.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0)
|
211
|
+
# xml.to_xml( :save_with => 0 )
|
212
|
+
end
|
213
|
+
|
214
|
+
def assinatura_simples
|
215
|
+
value = @options[:inscricao_prestador].rjust(8,'0') + @options[:serie_rps].ljust(5) + @options[:numero_rps].rjust(12,'0') + @options[:data_emissao].delete('-') \
|
216
|
+
+ @options[:tributacao_rps] + @options[:status_rps] + (@options[:iss_retido] ? 'S' : 'N') + @options[:valor_servicos].delete(',').delete('.').rjust(15,'0') \
|
217
|
+
+ @options[:valor_deducoes].delete(',').delete('.').rjust(15,'0') + @options[:codigo_servico].rjust(5,'0') \
|
218
|
+
+ (@options[:cpf_tomador].blank? ? (@options[:cnpj_tomador].blank? ? '3' : '2') : '1') \
|
219
|
+
+ (@options[:cpf_tomador].blank? ? (@options[:cnpj_tomador].blank? ? "".rjust(14,'0') : @options[:cnpj_tomador]) : @options[:cpf_tomador])
|
220
|
+
|
221
|
+
part_1 = @options[:inscricao_prestador].rjust(8,'0')
|
222
|
+
part_2 = @options[:serie_rps].ljust(5)
|
223
|
+
part_3 = @options[:numero_rps].rjust(12,'0')
|
224
|
+
part_4 = @options[:data_emissao].delete('-')
|
225
|
+
part_5 = @options[:tributacao_rps]
|
226
|
+
part_6 = @options[:status_rps]
|
227
|
+
part_7 = @options[:iss_retido] ? 'S' : 'N'
|
228
|
+
part_8 = @options[:valor_servicos].delete(',').delete('.').rjust(15,'0')
|
229
|
+
part_9 = @options[:valor_deducoes].delete(',').delete('.').rjust(15,'0')
|
230
|
+
part_10 = @options[:codigo_servico].rjust(5,'0')
|
231
|
+
part_11 = (@options[:cpf_tomador].blank? ? (@options[:cnpj_tomador].blank? ? '3' : '2') : '1')
|
232
|
+
part_12 = (@options[:cpf_tomador].blank? ? (@options[:cnpj_tomador].blank? ? "".rjust(14,'0') : @options[:cnpj_tomador].rjust(14,'0') ) : @options[:cpf_tomador].rjust(14,'0'))
|
233
|
+
|
234
|
+
value = part_1 + part_2 + part_3 + part_4 + part_5 + part_6 + part_7 + part_8 + part_9 + part_10 + part_11 + part_12
|
235
|
+
|
236
|
+
# PHP Sign
|
237
|
+
# $digestValue = base64_encode( hash( 'sha1', $content, true ) );
|
238
|
+
# $pkeyId = openssl_get_privatekey( file_get_contents( $this->privateKey ) );
|
239
|
+
# openssl_sign( $digestValue, $signatureValue, $pkeyId );
|
240
|
+
|
241
|
+
# a_hash = OpenSSL::Digest::SHA1.digest( value )
|
242
|
+
# Base64.encode64( @certificado.key.private_encrypt( value ) ).gsub("\n",'').strip()
|
243
|
+
|
244
|
+
sign_hash = @certificado.key.sign( OpenSSL::Digest::SHA1.new, value )
|
245
|
+
Base64.encode64( sign_hash ).gsub("\n",'').gsub("\r",'').strip()
|
246
|
+
end
|
247
|
+
|
248
|
+
def to_xml
|
249
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
250
|
+
xml.PedidoEnvioRPS( "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema", "xmlns" => "http://www.prefeitura.sp.gov.br/nfe" ) {
|
251
|
+
xml.Cabecalho( "Versao" => "1", :xmlns => "" ) {
|
252
|
+
xml.CPFCNPJRemetente {
|
253
|
+
xml.CPF @options[:cpf_remetente] unless @options[:cpf_remetente].blank?
|
254
|
+
xml.CNPJ @options[:cnpj_remetente] unless @options[:cnpj_remetente].blank?
|
255
|
+
}
|
256
|
+
}
|
257
|
+
xml.RPS( :xmlns => "" ) {
|
258
|
+
xml.Assinatura assinatura_simples()
|
259
|
+
xml.ChaveRPS {
|
260
|
+
xml.InscricaoPrestador @options[:inscricao_prestador]
|
261
|
+
xml.SerieRPS @options[:serie_rps] unless @options[:serie_rps].blank?
|
262
|
+
xml.NumeroRPS @options[:numero_rps] unless @options[:numero_rps].blank?
|
263
|
+
}
|
264
|
+
xml.TipoRPS @options[:tipo_rps]
|
265
|
+
xml.DataEmissao @options[:data_emissao]
|
266
|
+
xml.StatusRPS @options[:status_rps]
|
267
|
+
xml.TributacaoRPS @options[:tributacao_rps]
|
268
|
+
xml.ValorServicos @options[:valor_servicos]
|
269
|
+
xml.ValorDeducoes @options[:valor_deducoes]
|
270
|
+
xml.ValorPIS @options[:valor_pis] if @options[:valor_pis] != '0'
|
271
|
+
xml.ValorCOFINS @options[:valor_cofins] if @options[:valor_cofins] != '0'
|
272
|
+
xml.ValorINSS @options[:valor_inss] if @options[:valor_inss] != '0'
|
273
|
+
xml.ValorIR @options[:valor_ir] if @options[:valor_ir] != '0'
|
274
|
+
xml.ValorCSLL @options[:valor_csll] if @options[:valor_csll] != '0'
|
275
|
+
xml.CodigoServico @options[:codigo_servico]
|
276
|
+
xml.AliquotaServicos @options[:aliquota_servicos]
|
277
|
+
xml.ISSRetido @options[:iss_retido]
|
278
|
+
unless (@options[:cpf_tomador].blank? and @options[:cnpj_tomador].blank?)
|
279
|
+
xml.CPFCNPJTomador {
|
280
|
+
xml.CPF @options[:cpf_tomador] unless @options[:cpf_tomador].blank?
|
281
|
+
xml.CNPJ @options[:cnpj_tomador] unless @options[:cnpj_tomador].blank?
|
282
|
+
}
|
283
|
+
end
|
284
|
+
xml.InscricaoMunicipalTomador @options[:im_tomador] unless @options[:im_tomador]
|
285
|
+
xml.InscricaoEstadualTomador @options[:ie_tomador] unless @options[:ie_tomador]
|
286
|
+
xml.RazaoSocialTomador @options[:razao_tomador] unless @options[:razao_tomador]
|
287
|
+
unless (@options[:tp_logradouro].blank? and @options[:logradouro].blank? and @options[:nr_endereco] and @options[:compl_endereco])
|
288
|
+
xml.EnderecoTomador {
|
289
|
+
xml.TipoLogradouro @options[:tp_logradouro]
|
290
|
+
xml.Logradouro @options[:logradouro]
|
291
|
+
xml.NumeroEndereco @options[:nr_endereco]
|
292
|
+
xml.ComplementoEndereco @options[:compl_endereco]
|
293
|
+
xml.Bairro @options[:bairro] unless @options[:bairro].blank?
|
294
|
+
xml.Cidade @options[:cidade] unless @options[:cidade].blank?
|
295
|
+
xml.UF @options[:uf] unless @options[:uf]
|
296
|
+
xml.CEP @options[:cep] unless @options[:cep]
|
297
|
+
}
|
298
|
+
end
|
299
|
+
xml.EmailTomador @options[:email_tomador]
|
300
|
+
xml.Discriminacao @options[:discriminacao]
|
301
|
+
}
|
302
|
+
# xml.Signature( "xmlns" => "http://www.w3.org/2000/09/xmldsig#" ) {
|
303
|
+
# TODO: These elements must be added later, after the sign
|
304
|
+
# xml.KeyInfo {
|
305
|
+
# xml.X509Data {
|
306
|
+
# xml.X509Certificate @certificado.certificate.to_s.gsub(/\-\-\-\-\-[A-Z]+ CERTIFICATE\-\-\-\-\-/, "").gsub(/\n/,"")
|
307
|
+
# }
|
308
|
+
# }
|
309
|
+
# }
|
310
|
+
}
|
311
|
+
end
|
312
|
+
# builder.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).gsub("<root>","").gsub("</root>","").gsub("\n","")
|
313
|
+
Nokogiri::XML( builder.to_xml( :save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION ) )
|
314
|
+
end
|
315
|
+
|
316
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "nfe-paulistana/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "nfe-paulistana"
|
7
|
+
s.version = NfePaulistana::VERSION
|
8
|
+
s.authors = ["Marcelo Paez"]
|
9
|
+
s.email = ["marcelo@iugu.com.br"]
|
10
|
+
s.homepage = "https://iugu.com.br"
|
11
|
+
s.summary = %q{Notafiscal Eletronica}
|
12
|
+
s.description = %q{Gema para utilização do Webservice da Nf Paulistana}
|
13
|
+
|
14
|
+
s.rubyforge_project = "nfe-paulistana"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_dependency "nokogiri"
|
23
|
+
s.add_dependency "savon", "0.9.9"
|
24
|
+
s.add_dependency "signer"
|
25
|
+
s.add_development_dependency "rspec"
|
26
|
+
# s.add_runtime_dependency "rest-client"
|
27
|
+
end
|
data/test.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'nfe-paulistana.rb'
|
2
|
+
nfe = NfePaulistana.new({
|
3
|
+
:cert_path => "",
|
4
|
+
:cert_pass => "",
|
5
|
+
:cnpj_remetente => "",
|
6
|
+
:inscricao_prestador => "",
|
7
|
+
:aliquota_servicos => "0.03",
|
8
|
+
:data_emissao => "2013-03-04",
|
9
|
+
:email_tomador => "",
|
10
|
+
:discriminacao => "",
|
11
|
+
:codigo_servico => "",
|
12
|
+
:valor_servicos => "10.00",
|
13
|
+
:tributacao_rps => "T",
|
14
|
+
:status_rps => "N",
|
15
|
+
:tipo_rps => "RPS",
|
16
|
+
:serie_rps => "TESTE",
|
17
|
+
:numero_rps => "1"
|
18
|
+
#:cpf_tomador => ""
|
19
|
+
})
|
20
|
+
ret = nfe.enviar()
|
21
|
+
puts ret
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nfe-paulistana
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Marcelo Paez
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: savon
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - '='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.9.9
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.9
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: signer
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Gema para utilização do Webservice da Nf Paulistana
|
79
|
+
email:
|
80
|
+
- marcelo@iugu.com.br
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- .gitignore
|
86
|
+
- Gemfile
|
87
|
+
- Gemfile.lock
|
88
|
+
- Rakefile
|
89
|
+
- lib/nfe-paulistana.rb
|
90
|
+
- lib/nfe-paulistana/version.rb
|
91
|
+
- nfe-paulistana.gemspec
|
92
|
+
- test.rb
|
93
|
+
homepage: https://iugu.com.br
|
94
|
+
licenses: []
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project: nfe-paulistana
|
113
|
+
rubygems_version: 1.8.24
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Notafiscal Eletronica
|
117
|
+
test_files: []
|