Sha256: fc2c3881d5f63ed48db8582dd1da0f893f29f0b4ecf7d8c3d1a9d05036307e8d
Contents?: true
Size: 1.21 KB
Versions: 13
Compression:
Stored size: 1.21 KB
Contents
module EgovUtils module Iszr class Request < ActiveInteraction::Base def execute handle_response! end private def envelope Nokogiri::XML::Builder.new do |xml| xml.GateMessage { xml.Version '2.0' xml.Header { xml.MessageDetails(type: 'request') { xml.Class(mode: 'sync') { xml.text service_id } } xml.SenderDetails { xml.Authentication(type: 'clear') { xml.ISId EgovUtils::Settings['iszr']['ais'] } } } xml.Body encoded_body(body) } end end def encoded_body(body) Base64.encode64(body.to_xml) end def response @response ||= Client.new(envelope.to_xml).call end def response_body @response_body ||= begin body = Nokogiri::XML( response.body[:get_data_response][:get_data_result] ).xpath("//Body").text Nokogiri::XML(Base64.decode64(body)).remove_namespaces! end end def handle_response! response_body end end end end
Version data entries
13 entries across 13 versions & 1 rubygems