Class: CloudhouseGuardian::Incident

Inherits:
BaseObject show all
Defined in:
lib/cloudhouse_guardian/Incident.rb

Instance Attribute Summary collapse

Attributes inherited from BaseObject

#appliance_api_key, #appliance_url, #insecure, #sec_key

Instance Method Summary collapse

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) ⇒ Incident

Returns a new instance of Incident.



9
10
11
12
13
14
15
16
17
# File 'lib/cloudhouse_guardian/Incident.rb', line 9

def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
  super(appliance_url, appliance_api_key, sec_key, insecure)
  self.ended_at = nil
  self.external_id = nil
  self.id = nil
  self.short_description = nil
  self.started_at = nil
  self.url = nil
end

Instance Attribute Details

#ended_atObject

Returns the value of attribute ended_at.



3
4
5
# File 'lib/cloudhouse_guardian/Incident.rb', line 3

def ended_at
  @ended_at
end

#external_idObject

Returns the value of attribute external_id.



4
5
6
# File 'lib/cloudhouse_guardian/Incident.rb', line 4

def external_id
  @external_id
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/cloudhouse_guardian/Incident.rb', line 5

def id
  @id
end

#short_descriptionObject

Returns the value of attribute short_description.



6
7
8
# File 'lib/cloudhouse_guardian/Incident.rb', line 6

def short_description
  @short_description
end

#started_atObject

Returns the value of attribute started_at.



7
8
9
# File 'lib/cloudhouse_guardian/Incident.rb', line 7

def started_at
  @started_at
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/cloudhouse_guardian/Incident.rb', line 8

def url
  @url
end

Instance Method Details

#from_hash(h) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/cloudhouse_guardian/Incident.rb', line 19

def from_hash(h)
  self.ended_at = h['ended_at'] if h.include?('ended_at')
  self.external_id = h['external_id'] if h.include?('external_id')
  self.id = h['id'] if h.include?('id')
  self.short_description = h['short_description'] if h.include?('short_description')
  self.started_at = h['started_at'] if h.include?('started_at')
  self.url = h['url'] if h.include?('url')
end

#to_hashObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/cloudhouse_guardian/Incident.rb', line 27

def to_hash
  h = {}
  h['ended_at'] = self.ended_at
  h['external_id'] = self.external_id
  h['id'] = self.id
  h['short_description'] = self.short_description
  h['started_at'] = self.started_at
  h['url'] = self.url
  return h
end

#to_json(options = nil) ⇒ Object



37
38
39
40
# File 'lib/cloudhouse_guardian/Incident.rb', line 37

def to_json(options = nil)
  h = to_hash
  return h.to_json(options)
end