class Base
Attributes
response[R]
Public Class Methods
new(version, api, path, namespace)
click to toggle source
# File lib/base/Base.rb, line 29 def initialize(version, api, path, namespace) @client = OcpClient.instance @api = api @version = version @path = path @namespace = namespace @response = nil @endpoint = "/"+@api+"/"+@version if !@namespace.nil? @endpoint = @endpoint+"/namespaces/"+@namespace+"/"+@path elsif !@path.nil? @endpoint = @endpoint+"/"+@path end end
Public Instance Methods
create(body)
click to toggle source
# File lib/base/Base.rb, line 60 def create(body) @response = @client.post(@endpoint,body) return @response end
delete(name)
click to toggle source
# File lib/base/Base.rb, line 70 def delete(name) @response = @client.delete(@endpoint+"/"+name) return @response end
list()
click to toggle source
# File lib/base/Base.rb, line 55 def list @response = @client.get(@endpoint) return @response end
setup(url, noverifyssl, pretty, debug , token=nil, clientcertfile=nil, clientkeyfile=nil, clientcafile=nil)
click to toggle source
# File lib/base/Base.rb, line 47 def setup(url, noverifyssl, pretty, debug , token=nil, clientcertfile=nil, clientkeyfile=nil, clientcafile=nil) @client.setup(url, noverifyssl, pretty, debug , token, clientcertfile, clientkeyfile, clientcafile) end
setup_by_config_file(configfile, pretty=nil, debug=nil)
click to toggle source
# File lib/base/Base.rb, line 51 def setup_by_config_file(configfile, pretty=nil, debug=nil) @client.setup_by_config_file(configfile, pretty, debug) end
update(body, name)
click to toggle source
# File lib/base/Base.rb, line 65 def update(body, name) @response = @client.put(@endpoint+"/"+name,body) return @response end
Private Instance Methods
is_a_number?(s)
click to toggle source
# File lib/base/Base.rb, line 76 def is_a_number?(s) s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true end