3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/cloudcontrol/connection.rb', line 3
def build_request(type, endpoint, query = nil, body = nil, xml=true)
uri = api_base + endpoint
append_query(uri, query) if query
if xml
request = Typhoeus::Request.new(
uri,
method: type,
body: body,
userpwd: "#{@username}:#{@password}",
headers: { 'Content-Type' =>'text/xml', 'User-Agent' => 'ACP Ruby SDK' }
)
else
request = Typhoeus::Request.new(
uri,
method: type,
body: body,
userpwd: "#{@username}:#{@password}",
headers: { 'Accept' => 'application/json', 'User-Agent' => 'ACP Ruby SDK' }
)
end
end
|