4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/catapult/catapult_methods.rb', line 4
def build_request(url, method = "GET")
uri = URI.parse(BaseUrl+ url)
http = Net::HTTP.new(uri.host, uri.port)
c_type = {'Content-Type' =>'application/xml'}
request = case method
when "GET"
Net::HTTP::Get.new(uri.request_uri, c_type)
when "POST"
Net::HTTP::Post.new(uri.request_uri, c_type)
when "DELETE"
Net::HTTP::Delete.new(uri.request_uri, c_type)
when "PUT"
Net::HTTP::Put.new(uri.request_uri, c_type)
end
request.basic_auth(Catapult.username, Catapult.password)
return http, request
end
|