Module: Web

Defined in:
lib/web/web_request_handler.rb,
lib/web/secutry_protocols.rb

Overview

Handle all the communication to the service

Defined Under Namespace

Modules: SecutryProtocol

Instance Method Summary collapse

Instance Method Details

#get_web_response(url, headers) ⇒ Object

headers

hash that keeps the headers that need to be send to the service



10
11
12
13
14
15
16
17
# File 'lib/web/web_request_handler.rb', line 10

def get_web_response(url,headers)
	request = HTTPI::Request.new(url)

	request.headers = headers
	response = HTTPI.get(request)

	response
end

#send_message_to_wcf(url, headers, body, *args) ⇒ Object

Send http request to the service Params:

url

the url to send the request to

headers

hash that keeps the headers that need to be send to the service

body

the body of the HTTP request

args

metadata that indicate wich autountication to use



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/web/web_request_handler.rb', line 25

def send_message_to_wcf(url,headers,body,*args)
	request = HTTPI::Request.new(url)
	request.headers = headers
	request.body = body

	#TODO: change to user self.send('use_'+)
	case args.first
		when SecutryProtocol::NTLM
			use_ntlm(request,*args)
		when SecutryProtocol::GGS_API
			use_kerberos(request)
		when SecutryProtocol::BASIC
			use_basic(request,*args)
		when SecutryProtocol::DIGEST
			use_digest(request,*args)
	end

	response = HTTPI.post(request)
	response
end