Class: CloudhouseGuardian::OperatingSystemFamily
- Inherits:
-
BaseObject
- Object
- BaseObject
- CloudhouseGuardian::OperatingSystemFamily
- Defined in:
- lib/cloudhouse_guardian/OperatingSystemFamily.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from BaseObject
#appliance_api_key, #appliance_url, #insecure, #sec_key
Instance Method Summary collapse
- #from_hash(h) ⇒ Object
-
#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ OperatingSystemFamily
constructor
A new instance of OperatingSystemFamily.
- #operating_systems ⇒ Object
- #to_hash ⇒ Object
- #to_json(options = nil) ⇒ Object
Methods inherited from BaseObject
#http_delete, #http_get, #http_post, #http_put, #make_headers
Constructor Details
#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ OperatingSystemFamily
Returns a new instance of OperatingSystemFamily.
5 6 7 8 9 |
# File 'lib/cloudhouse_guardian/OperatingSystemFamily.rb', line 5 def initialize(appliance_url, appliance_api_key, sec_key, insecure = false) super(appliance_url, appliance_api_key, sec_key, insecure) self.id = nil self.name = nil end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/cloudhouse_guardian/OperatingSystemFamily.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/cloudhouse_guardian/OperatingSystemFamily.rb', line 4 def name @name end |
Instance Method Details
#from_hash(h) ⇒ Object
11 12 13 14 |
# File 'lib/cloudhouse_guardian/OperatingSystemFamily.rb', line 11 def from_hash(h) self.id = h['id'] if h.include?('id') self.name = h['name'] if h.include?('name') end |
#operating_systems ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cloudhouse_guardian/OperatingSystemFamily.rb', line 26 def obj = http_get("/api/v2/operating_system_families/#{self.id}/operating_systems.json") the_list = OperatingSystemList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure) obj.each do |x| elem = OperatingSystem.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure) elem.id = x["id"] if x.include?("id") elem.name = x["name"] if x.include?("name") the_list << elem end return the_list end |
#to_hash ⇒ Object
15 16 17 18 19 20 |
# File 'lib/cloudhouse_guardian/OperatingSystemFamily.rb', line 15 def to_hash h = {} h['id'] = self.id h['name'] = self.name return h end |
#to_json(options = nil) ⇒ Object
21 22 23 24 |
# File 'lib/cloudhouse_guardian/OperatingSystemFamily.rb', line 21 def to_json( = nil) h = to_hash return h.to_json() end |