Class: FE::SignedDocument
- Inherits:
-
Object
- Object
- FE::SignedDocument
- Defined in:
- lib/facturacr/signed_document.rb
Instance Attribute Summary collapse
-
#base64 ⇒ Object
Returns the value of attribute base64.
-
#document ⇒ Object
Returns the value of attribute document.
-
#payload ⇒ Object
Returns the value of attribute payload.
Instance Method Summary collapse
-
#initialize(document, xml_provider) ⇒ SignedDocument
constructor
A new instance of SignedDocument.
Constructor Details
#initialize(document, xml_provider) ⇒ SignedDocument
Returns a new instance of SignedDocument.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/facturacr/signed_document.rb', line 7 def initialize(document, xml_provider) # Backwards compatibility with v0.1.4 if xml_provider.is_a?(String) raise ArgumentError, "File: #{xml_provider} does not exist" unless File.exists?(xml_provider) xml_provider = FE::DataProvider.new(:file, xml_provider) end raise ArgumentError, "Invalid Argument" unless xml_provider.is_a?(FE::DataProvider) @document = document @base64 = Base64.encode64(xml_provider.contents).gsub("\n",""); @payload = document.api_payload @payload[:comprobanteXml] = @base64 end |
Instance Attribute Details
#base64 ⇒ Object
Returns the value of attribute base64.
5 6 7 |
# File 'lib/facturacr/signed_document.rb', line 5 def base64 @base64 end |
#document ⇒ Object
Returns the value of attribute document.
5 6 7 |
# File 'lib/facturacr/signed_document.rb', line 5 def document @document end |
#payload ⇒ Object
Returns the value of attribute payload.
5 6 7 |
# File 'lib/facturacr/signed_document.rb', line 5 def payload @payload end |