Class: Base
- Inherits:
-
Object
- Object
- Base
- Defined in:
- lib/base/Base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #create(body) ⇒ Object
- #delete(name) ⇒ Object
-
#initialize(version, api, path, namespace) ⇒ Base
constructor
A new instance of Base.
- #list ⇒ Object
- #setup(ocpconfig) ⇒ Object
- #update(body) ⇒ Object
Constructor Details
#initialize(version, api, path, namespace) ⇒ Base
Returns a new instance of Base.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/base/Base.rb', line 27 def initialize(version, api, path, namespace) @client = OcpClient.instance @api = api @version = version @path = path @namespace = namespace @endpoint = "/"+@api+"/"+@version if !@namespace.nil? @endpoint = @endpoint+"/namespaces/"+@namespace+"/"+@path elsif !@path.nil? @endpoint = @endpoint+"/"+@path end end |
Instance Method Details
#create(body) ⇒ Object
54 55 56 57 58 |
# File 'lib/base/Base.rb', line 54 def create(body) data = nil data = @client.post(@endpoint,body) return data end |
#delete(name) ⇒ Object
66 67 68 69 70 |
# File 'lib/base/Base.rb', line 66 def delete(name) data = nil data = @client.delete(@endpoint+"/"+name) return data end |
#list ⇒ Object
48 49 50 51 52 |
# File 'lib/base/Base.rb', line 48 def list data = nil data = @client.get(@endpoint) return data end |
#setup(ocpconfig) ⇒ Object
44 45 46 |
# File 'lib/base/Base.rb', line 44 def setup(ocpconfig) @client.setup(ocpconfig) end |
#update(body) ⇒ Object
60 61 62 63 64 |
# File 'lib/base/Base.rb', line 60 def update(body) data = nil data = @client.put(@endpoint,body) return data end |