Class: Biro::Bvs::Response
- Inherits:
-
Biro::BaseResponse
- Object
- Biro::BaseResponse
- Biro::Bvs::Response
- Defined in:
- lib/biro/gateways/bvs/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Instance Method Summary collapse
- #debits? ⇒ Boolean
- #debits_error_message ⇒ Object
- #document ⇒ Object
-
#initialize(responses) ⇒ Response
constructor
A new instance of Response.
- #name ⇒ Object
- #returning_debits? ⇒ Boolean
- #returning_score? ⇒ Boolean
- #score_error_message ⇒ Object
- #scores ⇒ Object
Constructor Details
#initialize(responses) ⇒ Response
Returns a new instance of Response.
8 9 10 11 |
# File 'lib/biro/gateways/bvs/response.rb', line 8 def initialize(responses) @body = { } [:score, :debits].each { |r| @body[r] = responses[r].body if responses[r] } end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/biro/gateways/bvs/response.rb', line 6 def body @body end |
Instance Method Details
#debits? ⇒ Boolean
33 34 35 |
# File 'lib/biro/gateways/bvs/response.rb', line 33 def debits? debits_body.debits_info == 'S' end |
#debits_error_message ⇒ Object
37 38 39 |
# File 'lib/biro/gateways/bvs/response.rb', line 37 def debits_body..strip unless returning_debits? end |
#document ⇒ Object
25 26 27 |
# File 'lib/biro/gateways/bvs/response.rb', line 25 def document score_body.response_text_document.to_i end |
#name ⇒ Object
21 22 23 |
# File 'lib/biro/gateways/bvs/response.rb', line 21 def name score_body.response_text_name.strip end |
#returning_debits? ⇒ Boolean
17 18 19 |
# File 'lib/biro/gateways/bvs/response.rb', line 17 def returning_debits? debits_body.return_code == "0" end |
#returning_score? ⇒ Boolean
13 14 15 |
# File 'lib/biro/gateways/bvs/response.rb', line 13 def returning_score? score_body.return_code == "0" end |
#score_error_message ⇒ Object
41 42 43 |
# File 'lib/biro/gateways/bvs/response.rb', line 41 def score_body..strip unless returning_score? end |
#scores ⇒ Object
29 30 31 |
# File 'lib/biro/gateways/bvs/response.rb', line 29 def scores score_body.response_text_result_score.to_i end |