cfdi 0.0.9 → 0.1.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 +4 -4
- data/.gitignore +1 -0
- data/cfdi.gemspec +1 -0
- data/doc/CFDI/Certificado.html +533 -0
- data/doc/CFDI/Complemento.html +150 -0
- data/doc/CFDI/Comprobante.html +1758 -0
- data/doc/CFDI/Concepto.html +461 -0
- data/doc/CFDI/Domicilio.html +1040 -0
- data/doc/CFDI/ElementoComprobante.html +547 -0
- data/doc/CFDI/Entidad.html +600 -0
- data/doc/CFDI/Key.html +373 -0
- data/doc/CFDI.html +511 -0
- data/doc/Float.html +231 -0
- data/doc/_index.html +194 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file_list.html +53 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +194 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +305 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/certificado.rb +17 -2
- data/lib/cfdi.rb +5 -1
- data/lib/complemento.rb +2 -0
- data/lib/comprobante.rb +97 -6
- data/lib/comun.rb +25 -2
- data/lib/concepto.rb +25 -6
- data/lib/entidad.rb +38 -3
- data/lib/key.rb +15 -1
- data/lib/xml.rb +5 -0
- data/test/comprobante_spec.rb +57 -0
- data/test/entidar_spec.rb +20 -0
- metadata +45 -3
data/doc/CFDI/Key.html
ADDED
@@ -0,0 +1,373 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: CFDI::Key
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (K)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../CFDI.html" title="CFDI (module)">CFDI</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Key</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: CFDI::Key
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">OpenSSL::PKey::RSA</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">OpenSSL::PKey::RSA</li>
|
82
|
+
|
83
|
+
<li class="next">CFDI::Key</li>
|
84
|
+
|
85
|
+
</ul>
|
86
|
+
<a href="#" class="inheritanceTree">show all</a>
|
87
|
+
|
88
|
+
</dd>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<dt class="r2 last">Defined in:</dt>
|
99
|
+
<dd class="r2 last">lib/key.rb</dd>
|
100
|
+
|
101
|
+
</dl>
|
102
|
+
<div class="clear"></div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>Una llave privada, en formato X509 no PKCS7</p>
|
108
|
+
|
109
|
+
<p>Para convertirlos, nomás hacemos</p>
|
110
|
+
|
111
|
+
<pre class="code ruby"><code class="ruby">openssl pkcs8 -inform DER -in nombreGiganteDelSAT.key -passin pass:miFIELCreo >> certX509.pem</code></pre>
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
<div class="tags">
|
117
|
+
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<h2>
|
128
|
+
Instance Method Summary
|
129
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
130
|
+
</h2>
|
131
|
+
|
132
|
+
<ul class="summary">
|
133
|
+
|
134
|
+
<li class="public ">
|
135
|
+
<span class="summary_signature">
|
136
|
+
|
137
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (CFDI::Key) <strong>initialize</strong>(file, password = nil) </a>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</span>
|
142
|
+
|
143
|
+
|
144
|
+
<span class="note title constructor">constructor</span>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<span class="summary_desc"><div class='inline'>
|
154
|
+
<p>Crea una llave privada.</p>
|
155
|
+
</div></span>
|
156
|
+
|
157
|
+
</li>
|
158
|
+
|
159
|
+
|
160
|
+
<li class="public ">
|
161
|
+
<span class="summary_signature">
|
162
|
+
|
163
|
+
<a href="#sella-instance_method" title="#sella (instance method)">- (CFDI::comprobante) <strong>sella</strong>(factura) </a>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
</span>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<span class="summary_desc"><div class='inline'>
|
178
|
+
<p>sella una factura.</p>
|
179
|
+
</div></span>
|
180
|
+
|
181
|
+
</li>
|
182
|
+
|
183
|
+
|
184
|
+
</ul>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<div id="constructor_details" class="method_details_list">
|
189
|
+
<h2>Constructor Details</h2>
|
190
|
+
|
191
|
+
<div class="method_details first">
|
192
|
+
<h3 class="signature first" id="initialize-instance_method">
|
193
|
+
|
194
|
+
- (<tt><span class='object_link'><a href="" title="CFDI::Key (class)">CFDI::Key</a></span></tt>) <strong>initialize</strong>(file, password = nil)
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
</h3><div class="docstring">
|
201
|
+
<div class="discussion">
|
202
|
+
|
203
|
+
<p>Crea una llave privada</p>
|
204
|
+
|
205
|
+
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
<div class="tags">
|
209
|
+
<p class="tag_title">Parameters:</p>
|
210
|
+
<ul class="param">
|
211
|
+
|
212
|
+
<li>
|
213
|
+
|
214
|
+
<span class='name'>file</span>
|
215
|
+
|
216
|
+
|
217
|
+
<span class='type'>(<tt>IO</tt>, <tt>String</tt>)</span>
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
—
|
222
|
+
<div class='inline'>
|
223
|
+
<p>El `path` de esta llave o los bytes de la misma</p>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
228
|
+
<li>
|
229
|
+
|
230
|
+
<span class='name'>password=nil</span>
|
231
|
+
|
232
|
+
|
233
|
+
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
—
|
238
|
+
<div class='inline'>
|
239
|
+
<p>El password de esta llave</p>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
</ul>
|
245
|
+
|
246
|
+
|
247
|
+
</div><table class="source_code">
|
248
|
+
<tr>
|
249
|
+
<td>
|
250
|
+
<pre class="lines">
|
251
|
+
|
252
|
+
|
253
|
+
17
|
254
|
+
18
|
255
|
+
19
|
256
|
+
20
|
257
|
+
21
|
258
|
+
22</pre>
|
259
|
+
</td>
|
260
|
+
<td>
|
261
|
+
<pre class="code"><span class="info file"># File 'lib/key.rb', line 17</span>
|
262
|
+
|
263
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_password'>password</span><span class='op'>=</span><span class='kw'>nil</span>
|
264
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
|
265
|
+
<span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
|
266
|
+
<span class='kw'>end</span>
|
267
|
+
<span class='kw'>super</span> <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_password'>password</span>
|
268
|
+
<span class='kw'>end</span></pre>
|
269
|
+
</td>
|
270
|
+
</tr>
|
271
|
+
</table>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
</div>
|
275
|
+
|
276
|
+
|
277
|
+
<div id="instance_method_details" class="method_details_list">
|
278
|
+
<h2>Instance Method Details</h2>
|
279
|
+
|
280
|
+
|
281
|
+
<div class="method_details first">
|
282
|
+
<h3 class="signature first" id="sella-instance_method">
|
283
|
+
|
284
|
+
- (<tt>CFDI::comprobante</tt>) <strong>sella</strong>(factura)
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
</h3><div class="docstring">
|
291
|
+
<div class="discussion">
|
292
|
+
|
293
|
+
<p>sella una factura</p>
|
294
|
+
|
295
|
+
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
<div class="tags">
|
299
|
+
<p class="tag_title">Parameters:</p>
|
300
|
+
<ul class="param">
|
301
|
+
|
302
|
+
<li>
|
303
|
+
|
304
|
+
<span class='name'>factura</span>
|
305
|
+
|
306
|
+
|
307
|
+
<span class='type'>(<tt><span class='object_link'><a href="Comprobante.html" title="CFDI::Comprobante (class)">CFDI::Comprobante</a></span></tt>)</span>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
—
|
312
|
+
<div class='inline'>
|
313
|
+
<p>El comprobante a sellar</p>
|
314
|
+
</div>
|
315
|
+
|
316
|
+
</li>
|
317
|
+
|
318
|
+
</ul>
|
319
|
+
|
320
|
+
<p class="tag_title">Returns:</p>
|
321
|
+
<ul class="return">
|
322
|
+
|
323
|
+
<li>
|
324
|
+
|
325
|
+
|
326
|
+
<span class='type'>(<tt>CFDI::comprobante</tt>)</span>
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
—
|
331
|
+
<div class='inline'>
|
332
|
+
<p>El comprobante con el `sello`</p>
|
333
|
+
</div>
|
334
|
+
|
335
|
+
</li>
|
336
|
+
|
337
|
+
</ul>
|
338
|
+
|
339
|
+
</div><table class="source_code">
|
340
|
+
<tr>
|
341
|
+
<td>
|
342
|
+
<pre class="lines">
|
343
|
+
|
344
|
+
|
345
|
+
29
|
346
|
+
30
|
347
|
+
31
|
348
|
+
32</pre>
|
349
|
+
</td>
|
350
|
+
<td>
|
351
|
+
<pre class="code"><span class="info file"># File 'lib/key.rb', line 29</span>
|
352
|
+
|
353
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_sella'>sella</span> <span class='id identifier rubyid_factura'>factura</span>
|
354
|
+
<span class='id identifier rubyid_cadena_original'>cadena_original</span> <span class='op'>=</span> <span class='id identifier rubyid_factura'>factura</span><span class='period'>.</span><span class='id identifier rubyid_cadena_original'>cadena_original</span>
|
355
|
+
<span class='id identifier rubyid_factura'>factura</span><span class='period'>.</span><span class='id identifier rubyid_sello'>sello</span> <span class='op'>=</span> <span class='const'>Base64</span><span class='op'>::</span><span class='id identifier rubyid_encode64'>encode64</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span> <span class='id identifier rubyid_cadena_original'>cadena_original</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\n</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
356
|
+
<span class='kw'>end</span></pre>
|
357
|
+
</td>
|
358
|
+
</tr>
|
359
|
+
</table>
|
360
|
+
</div>
|
361
|
+
|
362
|
+
</div>
|
363
|
+
|
364
|
+
</div>
|
365
|
+
|
366
|
+
<div id="footer">
|
367
|
+
Generated on Wed Oct 30 20:47:07 2013 by
|
368
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
369
|
+
0.8.7.2 (ruby-2.0.0).
|
370
|
+
</div>
|
371
|
+
|
372
|
+
</body>
|
373
|
+
</html>
|