Class: Project

Inherits:
OcpApi show all
Defined in:
lib/base/v1/ocpapi/Project.rb

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from OcpApi

#to_s

Methods inherited from V1

#api_version

Methods inherited from Base

#create, #delete, #list, #setup, #setup_by_config_file, #update

Constructor Details

#initializeProject

Returns a new instance of Project.



28
29
30
# File 'lib/base/v1/ocpapi/Project.rb', line 28

def initialize
  super("projects")
end

Instance Method Details

#deleteproject(name) ⇒ Object



62
63
64
65
66
# File 'lib/base/v1/ocpapi/Project.rb', line 62

def deleteproject(name)
  data = nil
  data = delete(name)
  return data
end

#exists?(project_name) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/base/v1/ocpapi/Project.rb', line 48

def exists?(project_name)
  project_list = listprojects
  data = JSON.parse project_list
  list = data['items']
  list.each do |key|
    if project_name == key['metadata']['name']
      return true
    end
  end

  return false

end

#list_projects_arrayObject



38
39
40
41
42
43
44
45
46
# File 'lib/base/v1/ocpapi/Project.rb', line 38

def list_projects_array
  array = Array.new
  project_list = JSON.parse listprojects
  list = project_list['items']
  list.each do |key|
    array.push key['metadata']['name']
  end
  return array
end

#listprojectsObject



32
33
34
35
36
# File 'lib/base/v1/ocpapi/Project.rb', line 32

def listprojects
  data = nil
  data = list
  return data
end