Method: OpenStack::Connection#req
- Defined in:
- lib/openstack/connection.rb
#req(method, path, options = {}) ⇒ Object
This is a much more sane way to make a http request to the api. Example: res = conn.req(‘GET’, “/servers/#id”)
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/openstack/connection.rb', line 179 def req(method, path, = {}) server = [:server] || @service_host port = [:port] || @service_port scheme = [:scheme] || @service_scheme headers = [:headers] || {'content-type' => 'application/json'} data = [:data] attempts = [:attempts] || 0 path = @service_path + path res = csreq(method,server,path,port,scheme,headers,data,attempts) if not res.code.match(/^20.$/) OpenStack::Exception.raise_exception(res) end return res end |