Class: EgonGate::Kobra::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/egon_gate/kobra/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(soap_response) ⇒ Response

Returns a new instance of Response.



7
8
9
10
# File 'lib/egon_gate/kobra/response.rb', line 7

def initialize(soap_response)
  @soap_response = soap_response
  @egsb_string = soap_response.body[:get_data_response][:get_data_result]
end

Instance Method Details

#egsb_responseObject



16
17
18
# File 'lib/egon_gate/kobra/response.rb', line 16

def egsb_response
  @response ||= nori.parse( Base64.decode64 pure_xml[:gate_message][:body] )
end

#error?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/egon_gate/kobra/response.rb', line 20

def error?
  egsb_response.values.first[:odpoved_info][:status][:vysledek_kod] != "OK"
end

#error_messageObject



24
25
26
# File 'lib/egon_gate/kobra/response.rb', line 24

def error_message
  egsb_response.values.first[:odpoved_info][:status][:vysledek_detail][:vysledek_sub_kod]
end

#pure_xmlObject



12
13
14
# File 'lib/egon_gate/kobra/response.rb', line 12

def pure_xml
  @responsed_body ||= nori.parse(@egsb_string)
end