Class: Rubix::MediaType
Instance Attribute Summary
Attributes inherited from Model
Class Method Summary collapse
Instance Method Summary collapse
-
#create_params ⇒ Object
Requests ==.
Methods inherited from Model
#after_create, all, all_params, all_request, #before_destroy, #before_update, #create, #create_request, #destroy, #destroy_params, #destroy_request, each, find, find_or_create, find_request, get_params, id_field, #id_field, #initialize, list, #new_record?, properties, #request, request, #resource_name, resource_name, #save, #to_hash, #update, #update_params, #update_request, #validate, web_request, zabbix_attr, zabbix_define, zabbix_name
Methods included from Logs
#debug, #error, #fatal, #info, #warn
Constructor Details
This class inherits a constructor from Rubix::Model
Class Method Details
.build(media_type) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rubix/models/media_type.rb', line 67 def self.build media_type new({ :id => media_type[id_field].to_i, :type => self::TYPE_NAMES[media_type['type'].to_i], :name => media_type['description'], :server => media_type['smtp_server'], :helo => media_type['smtp_helo'], :email => media_type['smtp_email'], :path => media_type['exec_path'], :modem => media_type['gsm_modem'], :username => media_type['username'], :password => media_type['passwd'] }) end |
.find_params(options = {}) ⇒ Object
63 64 65 |
# File 'lib/rubix/models/media_type.rb', line 63 def self.find_params ={} get_params.merge(:filter => {id_field => [:id], :description => [:name]}) end |
Instance Method Details
#create_params ⇒ Object
Requests ==
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rubix/models/media_type.rb', line 42 def create_params { :description => name, :type => TYPE_CODES[type] }.tap do |p| case type when :email p[:smtp_server] = server if server p[:smtp_helo] = helo if helo p[:smtp_email] = email if email when :script p[:exec_path] = path if path when :sms p[:gsm_modem] = modem if modem when :jabber p[:username] = username if username p[:passwd] = password if password end end end |