Class: FE::Api::DocumentStatus
- Inherits:
-
Object
- Object
- FE::Api::DocumentStatus
- Defined in:
- lib/facturacr/api/document_status.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#json ⇒ Object
Returns the value of attribute json.
-
#key ⇒ Object
Returns the value of attribute key.
-
#status ⇒ Object
Returns the value of attribute status.
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
- #details ⇒ Object
-
#initialize(json) ⇒ DocumentStatus
constructor
A new instance of DocumentStatus.
- #to_h ⇒ Object
Constructor Details
#initialize(json) ⇒ DocumentStatus
Returns a new instance of DocumentStatus.
12 13 14 15 16 17 18 19 20 |
# File 'lib/facturacr/api/document_status.rb', line 12 def initialize(json) @json = json @response = JSON.parse(json) @xml = Base64.decode64(@response["respuesta-xml"]) if @response["respuesta-xml"] @status = @response["ind-estado"] @date = @response["fecha"] @key = @response["clave"] @document = Nokogiri::XML(@xml) if @xml end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
10 11 12 |
# File 'lib/facturacr/api/document_status.rb', line 10 def date @date end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
9 10 11 |
# File 'lib/facturacr/api/document_status.rb', line 9 def document @document end |
#json ⇒ Object
Returns the value of attribute json.
10 11 12 |
# File 'lib/facturacr/api/document_status.rb', line 10 def json @json end |
#key ⇒ Object
Returns the value of attribute key.
10 11 12 |
# File 'lib/facturacr/api/document_status.rb', line 10 def key @key end |
#status ⇒ Object
Returns the value of attribute status.
10 11 12 |
# File 'lib/facturacr/api/document_status.rb', line 10 def status @status end |
#xml ⇒ Object
Returns the value of attribute xml.
10 11 12 |
# File 'lib/facturacr/api/document_status.rb', line 10 def xml @xml end |
Instance Method Details
#details ⇒ Object
22 23 24 |
# File 'lib/facturacr/api/document_status.rb', line 22 def details @document.css("MensajeHacienda DetalleMensaje").first.text if @document end |
#to_h ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/facturacr/api/document_status.rb', line 26 def to_h { key: @key, date: @date, status: @status, details: details } end |