Class: CloudhouseGuardian::ExternalEvent
- Inherits:
-
BaseObject
- Object
- BaseObject
- CloudhouseGuardian::ExternalEvent
- Defined in:
- lib/cloudhouse_guardian/ExternalEvent.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#variables ⇒ Object
Returns the value of attribute variables.
Attributes inherited from BaseObject
#appliance_api_key, #appliance_url, #insecure, #sec_key
Instance Method Summary collapse
- #create ⇒ Object
- #from_hash(h) ⇒ Object
-
#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ ExternalEvent
constructor
A new instance of ExternalEvent.
- #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) ⇒ ExternalEvent
Returns a new instance of ExternalEvent.
5 6 7 8 9 |
# File 'lib/cloudhouse_guardian/ExternalEvent.rb', line 5 def initialize(appliance_url, appliance_api_key, sec_key, insecure = false) super(appliance_url, appliance_api_key, sec_key, insecure) self.type = nil self.variables = EventVariables.new(appliance_url, appliance_api_key, sec_key, insecure) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/cloudhouse_guardian/ExternalEvent.rb', line 3 def type @type end |
#variables ⇒ Object
Returns the value of attribute variables.
4 5 6 |
# File 'lib/cloudhouse_guardian/ExternalEvent.rb', line 4 def variables @variables end |
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 |
# File 'lib/cloudhouse_guardian/ExternalEvent.rb', line 26 def create h = {} h["variables"] = self.variables.to_hash h["variables"]["type"] = self.type http_post("/api/v2/events.json", h) end |
#from_hash(h) ⇒ Object
11 12 13 14 |
# File 'lib/cloudhouse_guardian/ExternalEvent.rb', line 11 def from_hash(h) self.type = h['type'] if h.include?('type') self.variables = h['variables'] if h.include?('variables') end |
#to_hash ⇒ Object
15 16 17 18 19 20 |
# File 'lib/cloudhouse_guardian/ExternalEvent.rb', line 15 def to_hash h = {} h['type'] = self.type h['variables'] = self.variables return h end |
#to_json(options = nil) ⇒ Object
21 22 23 24 |
# File 'lib/cloudhouse_guardian/ExternalEvent.rb', line 21 def to_json( = nil) h = to_hash return h.to_json() end |