Class: SunatInvoice::ResponseParser
- Inherits:
-
Object
- Object
- SunatInvoice::ResponseParser
- Defined in:
- lib/sunat_invoice/response_parser.rb
Constant Summary collapse
- STATUS_CODES =
{ 0 => 'process success', 99 => 'in process', 98 => 'process with errors' }.freeze
- ALLOWED_PARSERS =
%w[invoice summary status].freeze
- VALID_PROCESS =
%w[0].freeze
- IN_PROCESS =
%w[99].freeze
Instance Attribute Summary collapse
-
#cdr ⇒ Object
readonly
Returns the value of attribute cdr.
-
#document_number ⇒ Object
readonly
Returns the value of attribute document_number.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#ticket ⇒ Object
readonly
Returns the value of attribute ticket.
Instance Method Summary collapse
-
#initialize(body, parser_type) ⇒ ResponseParser
constructor
A new instance of ResponseParser.
Constructor Details
#initialize(body, parser_type) ⇒ ResponseParser
Returns a new instance of ResponseParser.
19 20 21 22 23 24 25 |
# File 'lib/sunat_invoice/response_parser.rb', line 19 def initialize(body, parser_type) # body: SOAP body as a Hash. Typically Savon Response body. # parser_type: kind of parser to use. raise InvalidResponseParser unless ALLOWED_PARSERS.include?(parser_type) send("parse_#{parser_type}", body) end |
Instance Attribute Details
#cdr ⇒ Object (readonly)
Returns the value of attribute cdr.
7 8 9 |
# File 'lib/sunat_invoice/response_parser.rb', line 7 def cdr @cdr end |
#document_number ⇒ Object (readonly)
Returns the value of attribute document_number.
7 8 9 |
# File 'lib/sunat_invoice/response_parser.rb', line 7 def document_number @document_number end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/sunat_invoice/response_parser.rb', line 7 def @message end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
7 8 9 |
# File 'lib/sunat_invoice/response_parser.rb', line 7 def status_code @status_code end |
#ticket ⇒ Object (readonly)
Returns the value of attribute ticket.
7 8 9 |
# File 'lib/sunat_invoice/response_parser.rb', line 7 def ticket @ticket end |