Class: CloudhouseGuardian::NodeScan
- Inherits:
-
BaseObject
- Object
- BaseObject
- CloudhouseGuardian::NodeScan
- Defined in:
- lib/cloudhouse_guardian/NodeScan.rb
Instance Attribute Summary collapse
-
#associated_id ⇒ Object
Returns the value of attribute associated_id.
-
#category ⇒ Object
Returns the value of attribute category.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#label ⇒ Object
Returns the value of attribute label.
-
#node_id ⇒ Object
Returns the value of attribute node_id.
-
#scan_options ⇒ Object
Returns the value of attribute scan_options.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
-
#tsv ⇒ Object
Returns the value of attribute tsv.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
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) ⇒ NodeScan
constructor
A new instance of NodeScan.
- #load ⇒ Object
- #node ⇒ 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) ⇒ NodeScan
Returns a new instance of NodeScan.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 14 def initialize(appliance_url, appliance_api_key, sec_key, insecure = false) super(appliance_url, appliance_api_key, sec_key, insecure) self.associated_id = nil self.category = nil self.created_at = nil self.data = nil self.id = nil self.label = nil self.node_id = nil self. = nil self.task_id = nil self.tsv = nil self.updated_at = nil end |
Instance Attribute Details
#associated_id ⇒ Object
Returns the value of attribute associated_id.
3 4 5 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 3 def associated_id @associated_id end |
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 4 def category @category end |
#created_at ⇒ Object
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 5 def created_at @created_at end |
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 6 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 7 def id @id end |
#label ⇒ Object
Returns the value of attribute label.
8 9 10 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 8 def label @label end |
#node_id ⇒ Object
Returns the value of attribute node_id.
9 10 11 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 9 def node_id @node_id end |
#scan_options ⇒ Object
Returns the value of attribute scan_options.
10 11 12 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 10 def @scan_options end |
#task_id ⇒ Object
Returns the value of attribute task_id.
11 12 13 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 11 def task_id @task_id end |
#tsv ⇒ Object
Returns the value of attribute tsv.
12 13 14 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 12 def tsv @tsv end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
13 14 15 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 13 def updated_at @updated_at end |
Instance Method Details
#from_hash(h) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 29 def from_hash(h) self.associated_id = h['associated_id'] if h.include?('associated_id') self.category = h['category'] if h.include?('category') self.created_at = h['created_at'] if h.include?('created_at') self.data = h['data'] if h.include?('data') self.id = h['id'] if h.include?('id') self.label = h['label'] if h.include?('label') self.node_id = h['node_id'] if h.include?('node_id') self. = h['scan_options'] if h.include?('scan_options') self.task_id = h['task_id'] if h.include?('task_id') self.tsv = h['tsv'] if h.include?('tsv') self.updated_at = h['updated_at'] if h.include?('updated_at') end |
#load ⇒ Object
62 63 64 65 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 62 def load obj = http_get("/api/v2/node_scans/#{self.id}.json") from_hash(obj) end |
#node ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 68 def node obj = http_get("/api/v2/nodes/{node_id}.json") elem = Node.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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 42 def to_hash h = {} h['associated_id'] = self.associated_id h['category'] = self.category h['created_at'] = self.created_at h['data'] = self.data h['id'] = self.id h['label'] = self.label h['node_id'] = self.node_id h['scan_options'] = self. h['task_id'] = self.task_id h['tsv'] = self.tsv h['updated_at'] = self.updated_at return h end |
#to_json(options = nil) ⇒ Object
57 58 59 60 |
# File 'lib/cloudhouse_guardian/NodeScan.rb', line 57 def to_json( = nil) h = to_hash return h.to_json() end |