Sha256: 207c66a35e289fa9b6614fe723f19ce640ddca3b7f303f2b7868c9918a770dcd
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
module Rubix class Script < Model # Numeric codes of the access types a script can require to run on # a host. # # Default is 'read'. ACCESS_CODES = { :read => 2, :write => 3 }.freeze ACCESS_NAMES = ACCESS_CODES.invert.freeze # # == Properties & Finding == # zabbix_attr :name, :required => true zabbix_attr :command, :required => true zabbix_attr :access, :default => :read # # == Requests == # def create_params { :name => name, :command => command, :host_access => self.class::ACCESS_CODES[access] } end def self.find_params options={} get_params.merge(:filter => {id_field => options[:id], :name => options[:name]}) end def self.build script new({ :id => script[id_field].to_i, :name => script['name'], :command => script['command'], :access => self::ACCESS_NAMES[script['host_access'].to_i] }) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubix-0.5.1 | lib/rubix/models/script.rb |
rubix-0.5.0 | lib/rubix/models/script.rb |