Class: DeltavistaCrifDvaInterface::XmlConverter
- Inherits:
-
Object
- Object
- DeltavistaCrifDvaInterface::XmlConverter
show all
- Defined in:
- lib/deltavista_crif_dva_interface/xml_converter.rb
Instance Method Summary
collapse
Instance Method Details
#convert_country(alpha3_code) ⇒ Object
Converts alpha-3 country code into alpha-2 country code
38
39
40
41
42
43
44
45
46
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 38
def convert_country(alpha3_code)
alpha2_code = ''
begin
alpha2_code = SunDawg::CountryIsoTranslater.translate_standard(alpha3_code, "alpha3", "alpha2")
rescue SunDawg::CountryIsoTranslater::NoCountryError
ensure
alpha2_code
end
end
|
#get_value(node, key) ⇒ Object
Returns the value of a XPATH expression
33
34
35
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 33
def get_value(node, key)
node.xpath(key).collect(&:text)[0]
end
|
#response_code(xml) ⇒ Object
20
21
22
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 20
def response_code(xml)
get_value xml, "//response/responseCode"
end
|
#response_text(xml) ⇒ Object
24
25
26
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 24
def response_text(xml)
get_value xml, "//response/responseText"
end
|
#to_hash(xml_doc) ⇒ Object
8
9
10
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 8
def to_hash(xml_doc)
end
|
#to_string(value) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 12
def to_string(value)
if value.is_a? Time
value.strftime("%Y%m%d")
else
value.to_s.strip
end
end
|
#to_xml(object) ⇒ Object
4
5
6
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 4
def to_xml(object)
end
|
#valid_response?(xml) ⇒ Boolean
28
29
30
|
# File 'lib/deltavista_crif_dva_interface/xml_converter.rb', line 28
def valid_response?(xml)
response_code(xml) == '0' ? true : false
end
|