Module: Misty::HTTP::Direct

Included in:
Openstack::ServicePack
Defined in:
lib/misty/http/direct.rb

Overview

Allows to submit http request wwith provided path and override base_path if needed

Instance Method Summary collapse

Instance Method Details

#base_set(base_path) ⇒ Object

Examples

auth = { ... }
cloud = Misty::Cloud.new(:auth => auth)

net = cloud.network.get('/v2.0/networks')
pp net.body

id = cloud.identity.get('/')
pp id.body

servers = cloud.compute.get('/servers')
pp servers.body

img = cloud.image.get('/v1')
pp img.body


22
23
24
# File 'lib/misty/http/direct.rb', line 22

def base_set(base_path)
  base = base_path ? base_path : @base_path
end

#delete(path, base_path = nil) ⇒ Object



26
27
28
# File 'lib/misty/http/direct.rb', line 26

def delete(path, base_path = nil)
  http_delete(base_set(base_path) + path, @headers.get)
end

#get(path, base_path = nil) ⇒ Object



30
31
32
# File 'lib/misty/http/direct.rb', line 30

def get(path, base_path = nil)
  http_get(base_set(base_path) + path, @headers.get)
end

#post(path, data, base_path = nil) ⇒ Object



34
35
36
# File 'lib/misty/http/direct.rb', line 34

def post(path, data, base_path = nil)
  http_post(base_set(base_path) + path, @headers.get, data)
end

#put(path, data, base_path = nil) ⇒ Object



38
39
40
# File 'lib/misty/http/direct.rb', line 38

def put(path, data, base_path = nil)
  http_put(base_set(base_path) + path, @headers.get, data)
end