Class: Biro::Bvs::ScoreResponseBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/biro/gateways/bvs/builders/score_response_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ ScoreResponseBuilder

Returns a new instance of ScoreResponseBuilder.



4
5
6
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 4

def initialize(body)
  @body = build(body)
end

Instance Method Details

#build(body) ⇒ Object



96
97
98
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 96

def build(body)
  body.gsub("\n", '').gsub("\t", '').gsub("\\t", '').gsub("\\n", '').scan(/<PRE>([^<>]*)<\/PRE>/imu).flatten[0]
end

#error_messageObject



92
93
94
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 92

def error_message
  response_text[8..100] || ""
end

#reserved_applicantObject



16
17
18
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 16

def reserved_applicant
  @body[10..19]
end

#reserved_bvsObject



20
21
22
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 20

def reserved_bvs
  @body[20..39]
end

#response_textObject



52
53
54
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 52

def response_text
  @body[71,response_text_size] || ""
end

#response_text_descriptionObject



84
85
86
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 84

def response_text_description
  response_text[141..160]
end

#response_text_documentObject



72
73
74
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 72

def response_text_document
  response_text[8..21]
end

#response_text_document_typeObject



68
69
70
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 68

def response_text_document_type
  response_text[7]
end

#response_text_initObject



56
57
58
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 56

def response_text_init
  response_text[0..2]
end

#response_text_is_presentObject



64
65
66
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 64

def response_text_is_present
  response_text[6]
end

#response_text_nameObject



76
77
78
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 76

def response_text_name
  response_text[22..136]  || ""
end

#response_text_overObject



88
89
90
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 88

def response_text_over
  response_text[160..500]
end

#response_text_result_scoreObject



80
81
82
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 80

def response_text_result_score
  response_text[137..140]
end

#response_text_sizeObject



48
49
50
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 48

def response_text_size
  @body[67..70].to_i
end

#response_text_typeObject



60
61
62
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 60

def response_text_type
  response_text[3..5]
end

#response_typeObject



36
37
38
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 36

def response_type
  @body[58]
end

#return_codeObject



40
41
42
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 40

def return_code
  @body[59]
end

#search_numberObject



44
45
46
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 44

def search_number
  @body[60..66]
end

#search_typeObject



28
29
30
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 28

def search_type
  @body[48..55]
end

#search_versionObject



32
33
34
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 32

def search_version
  @body[56..57]
end

#service_codeObject



24
25
26
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 24

def service_code
  @body[40..47]
end

#transactionObject



8
9
10
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 8

def transaction
  @body[0..7]
end

#versionObject



12
13
14
# File 'lib/biro/gateways/bvs/builders/score_response_builder.rb', line 12

def version
  @body[8..9]
end