Class: FmTimbradoCfdi::FmCliente
- Inherits:
-
Object
- Object
- FmTimbradoCfdi::FmCliente
- Defined in:
- lib/fm_timbrado_cfdi/fm_cliente.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#fm_wsdl ⇒ Object
Returns the value of attribute fm_wsdl.
-
#log ⇒ Object
Returns the value of attribute log.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#ssl_verify_mode ⇒ Object
Returns the value of attribute ssl_verify_mode.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
-
#user_pass ⇒ Object
Returns the value of attribute user_pass.
Instance Method Summary collapse
- #cancelar(rfc, uuid, opciones = {}) ⇒ Object
-
#initialize ⇒ FmCliente
constructor
A new instance of FmCliente.
- #subir_certificado(rfc, certificado, llave, password, opciones = {}) ⇒ Object
- #timbrar(rfc, documento, opciones = {}) ⇒ Object
Constructor Details
#initialize ⇒ FmCliente
Returns a new instance of FmCliente.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 9 def initialize # La configuracion por default es la del ambiente de pruebas de FM # Datos de acceso al webservice @user_id = 'UsuarioPruebasWS' @user_pass = 'b9ec2afa3361a59af4b4d102d3f704eabdf097d4' # Datos del webservise de prueba @namespace = "https://t2demo.facturacionmoderna.com/timbrado/soap" @endpoint = "https://t2demo.facturacionmoderna.com/timbrado/soap" @fm_wsdl = "https://t2demo.facturacionmoderna.com/timbrado/wsdl" #Opciones adicionales @log = false @log_level = :error @ssl_verify_mode = :none end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def endpoint @endpoint end |
#fm_wsdl ⇒ Object
Returns the value of attribute fm_wsdl.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def fm_wsdl @fm_wsdl end |
#log ⇒ Object
Returns the value of attribute log.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def log @log end |
#log_level ⇒ Object
Returns the value of attribute log_level.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def log_level @log_level end |
#namespace ⇒ Object
Returns the value of attribute namespace.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def namespace @namespace end |
#ssl_verify_mode ⇒ Object
Returns the value of attribute ssl_verify_mode.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def ssl_verify_mode @ssl_verify_mode end |
#user_id ⇒ Object
Returns the value of attribute user_id.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def user_id @user_id end |
#user_pass ⇒ Object
Returns the value of attribute user_pass.
7 8 9 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 7 def user_pass @user_pass end |
Instance Method Details
#cancelar(rfc, uuid, opciones = {}) ⇒ Object
40 41 42 43 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 40 def cancelar(rfc, uuid, opciones = {}) respuesta = webservice_call(:request_cancelar_cfdi, rfc, {uuid: uuid}.merge(opciones)) FmRespuestaCancelacion.new(respuesta) end |
#subir_certificado(rfc, certificado, llave, password, opciones = {}) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 32 def subir_certificado(rfc, certificado, llave, password, opciones = {}) parametros = { "archivoCer" => Base64::encode64(certificado), "archivoKey" => Base64::encode64(llave), "clave" => password } respuesta = webservice_call(:activar_cancelacion, rfc, parametros.merge(opciones)) FmRespuestaCancelacion.new(respuesta) end |
#timbrar(rfc, documento, opciones = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/fm_timbrado_cfdi/fm_cliente.rb', line 25 def timbrar(rfc, documento, opciones={}) text_to_cfdi = Base64::encode64( documento ) # Realizamos la peticion respuesta = webservice_call(:request_timbrar_cfdi, rfc, {"text2CFDI" => text_to_cfdi}.merge(opciones)) FmRespuesta.new(respuesta) end |