Class: FE::SignedDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/facturacr/signed_document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, path) ⇒ SignedDocument

Returns a new instance of SignedDocument.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/facturacr/signed_document.rb', line 7

def initialize(document, path)
  @document = document
  @path = path
  @base64 = nil
  if File.exist?(@path)
    file = File.open(@path,"rb")
    @base64 = Base64.encode64(file.read).gsub("\n","");
  end
  @payload = document.api_payload
  @payload[:comprobanteXml] = @base64
end

Instance Attribute Details

#base64Object

Returns the value of attribute base64.



5
6
7
# File 'lib/facturacr/signed_document.rb', line 5

def base64
  @base64
end

#documentObject

Returns the value of attribute document.



5
6
7
# File 'lib/facturacr/signed_document.rb', line 5

def document
  @document
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/facturacr/signed_document.rb', line 5

def path
  @path
end

#payloadObject

Returns the value of attribute payload.



5
6
7
# File 'lib/facturacr/signed_document.rb', line 5

def payload
  @payload
end