Class: CloudhouseGuardian::OperatingSystem
- Inherits:
-
BaseObject
- Object
- BaseObject
- CloudhouseGuardian::OperatingSystem
- Defined in:
- lib/cloudhouse_guardian/OperatingSystem.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#operating_system_family_id ⇒ Object
Returns the value of attribute operating_system_family_id.
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) ⇒ OperatingSystem
constructor
A new instance of OperatingSystem.
- #operating_system_family ⇒ 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) ⇒ OperatingSystem
Returns a new instance of OperatingSystem.
7 8 9 10 11 12 13 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 7 def initialize(appliance_url, appliance_api_key, sec_key, insecure = false) super(appliance_url, appliance_api_key, sec_key, insecure) self.description = nil self.id = nil self.name = nil self. = nil end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 3 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 5 def name @name end |
#operating_system_family_id ⇒ Object
Returns the value of attribute operating_system_family_id.
6 7 8 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 6 def @operating_system_family_id end |
Instance Method Details
#from_hash(h) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 15 def from_hash(h) self.description = h['description'] if h.include?('description') self.id = h['id'] if h.include?('id') self.name = h['name'] if h.include?('name') self. = h['operating_system_family_id'] if h.include?('operating_system_family_id') end |
#operating_system_family ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 34 def obj = http_get("/api/v2/operating_system_families/#{self.}.json") elem = OperatingSystemFamily.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure) elem.id = obj["id"] elem.name = obj["name"] return elem end |
#to_hash ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 21 def to_hash h = {} h['description'] = self.description h['id'] = self.id h['name'] = self.name h['operating_system_family_id'] = self. return h end |
#to_json(options = nil) ⇒ Object
29 30 31 32 |
# File 'lib/cloudhouse_guardian/OperatingSystem.rb', line 29 def to_json( = nil) h = to_hash return h.to_json() end |