Module: OpsviewRest::Mixin
- Included in:
- Attribute, Contact, Host, Hostcheckcommand, Hostgroup, Hosttemplate, Keyword, MonitoringServer, Role, Servicecheck, Servicegroup, Timeperiod
- Defined in:
- lib/opsview_rest/mixin.rb
Instance Method Summary collapse
Instance Method Details
#resource_path(full = false) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/opsview_rest/mixin.rb', line 4 def resource_path(full=false) if (full == true || full == :full) "/rest/config/#{self.resource_type}" else "config/#{self.resource_type}" end end |
#save(replace = false) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/opsview_rest/mixin.rb', line 12 def save(replace=false) if replace == true || replace == :replace self.opsview.put(self.resource_path, self) else self.opsview.post(self.resource_path, self) end end |
#to_json ⇒ Object
20 21 22 |
# File 'lib/opsview_rest/mixin.rb', line 20 def to_json self..to_json end |