Class: Boletoman::Services::Itau::Boleto::Response
- Inherits:
-
Object
- Object
- Boletoman::Services::Itau::Boleto::Response
- Defined in:
- lib/boletoman/services/itau/boleto/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #barcode ⇒ Object
- #error? ⇒ Boolean
-
#initialize(raw) ⇒ Response
constructor
A new instance of Response.
- #line ⇒ Object
- #nosso_numero ⇒ Object
Constructor Details
#initialize(raw) ⇒ Response
Returns a new instance of Response.
8 9 10 11 |
# File 'lib/boletoman/services/itau/boleto/response.rb', line 8 def initialize(raw) @status = raw.status @body = JSON.parse(raw.body) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/boletoman/services/itau/boleto/response.rb', line 6 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/boletoman/services/itau/boleto/response.rb', line 6 def status @status end |
Instance Method Details
#barcode ⇒ Object
17 18 19 |
# File 'lib/boletoman/services/itau/boleto/response.rb', line 17 def body['codigo_barras'] end |
#error? ⇒ Boolean
13 14 15 |
# File 'lib/boletoman/services/itau/boleto/response.rb', line 13 def error? status >= 400 end |
#line ⇒ Object
21 22 23 |
# File 'lib/boletoman/services/itau/boleto/response.rb', line 21 def line body['numero_linha_digitavel'] end |
#nosso_numero ⇒ Object
25 26 27 |
# File 'lib/boletoman/services/itau/boleto/response.rb', line 25 def nosso_numero body['nosso_numero'][0..-2] # remove the verificator digit end |