Class: Biro::Bvs::Response

Inherits:
Biro::BaseResponse show all
Defined in:
lib/biro/gateways/bvs/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (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

Returns:

  • (Boolean)


33
34
35
# File 'lib/biro/gateways/bvs/response.rb', line 33

def debits?
  debits_body.debits_info == 'S'
end

#debits_error_messageObject



37
38
39
# File 'lib/biro/gateways/bvs/response.rb', line 37

def debits_error_message
  debits_body.error_message.strip unless returning_debits?
end

#documentObject



25
26
27
# File 'lib/biro/gateways/bvs/response.rb', line 25

def document
  score_body.response_text_document.to_i
end

#nameObject



21
22
23
# File 'lib/biro/gateways/bvs/response.rb', line 21

def name
  score_body.response_text_name.strip
end

#returning_debits?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


13
14
15
# File 'lib/biro/gateways/bvs/response.rb', line 13

def returning_score?
  score_body.return_code == "0"
end

#score_error_messageObject



41
42
43
# File 'lib/biro/gateways/bvs/response.rb', line 41

def score_error_message
  score_body.error_message.strip unless returning_score?
end

#scoresObject



29
30
31
# File 'lib/biro/gateways/bvs/response.rb', line 29

def scores
  score_body.response_text_result_score.to_i
end