8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/apitizer/connection/adaptor/standard.rb', line 8
def process(method, address, parameters = {}, = {})
uri = URI(address)
request = build_request(method, address, parameters)
.each { |k, v| request[k] = v }
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if address =~ /^https:/
response = http.request(request)
[ response.code.to_i, response.to_hash, Array(response.body) ]
rescue NoMethodError
raise
rescue NameError
raise Error, 'Invalid method'
rescue SocketError
raise Error, 'Connection failed'
end
|