Class: VirtualBox::VRDEServer
- Inherits:
-
AbstractModel
- Object
- AbstractModel
- VirtualBox::VRDEServer
- Defined in:
- lib/virtualbox/vrde_server.rb
Overview
Represents the VRDP Server settings of a VM.
Class Method Summary collapse
-
.populate_relationship(caller, imachine) ⇒ VRDEServer
Populates a relationship with another model.
-
.save_relationship(caller, instance) ⇒ Object
Saves the relationship.
Instance Method Summary collapse
-
#initialize(parent, vrde_settings) ⇒ VRDEServer
constructor
A new instance of VRDEServer.
- #save ⇒ Object
- #validate ⇒ Object
Methods inherited from AbstractModel
#destroy, #errors, errors_for_relationship, #existing_record!, #inspect, #lazy_attribute?, #lazy_relationship?, #new_record!, #new_record?, #parent_machine, #populate_attributes, #populate_relationship, #populate_relationships, reload!, #reload!, reload?, reloaded!, #save!, #save_attribute, #save_changed_interface_attributes, #save_interface_attribute, #set_relationship, #write_attribute
Methods included from AbstractModel::Validatable
#__validates_extract_options, #add_error, #clear_errors, #errors, #errors_on, #full_error_messages, #valid?, #validates_format_of, #validates_inclusion_of, #validates_numericality_of, #validates_presence_of
Methods included from AbstractModel::Relatable
#destroy_relationship, #destroy_relationships, #has_relationship?, included, #lazy_relationship?, #loaded_relationship?, #populate_relationship, #populate_relationships, #read_relationship, #relationship_class, #relationship_data, #save_relationship, #save_relationships, #set_relationship
Methods included from AbstractModel::VersionMatcher
#assert_version_match, #split_version, #version_match?
Methods included from AbstractModel::Dirty
#changed?, #changes, #clear_dirty!, #ignore_dirty, #method_missing, #set_dirty!
Methods included from AbstractModel::InterfaceAttributes
#load_interface_attribute, #load_interface_attributes, #save_interface_attribute, #save_interface_attributes, #spec_to_proc
Methods included from AbstractModel::Attributable
#attributes, #has_attribute?, included, #lazy_attribute?, #loaded_attribute?, #populate_attributes, #read_attribute, #readonly_attribute?, #write_attribute
Methods included from Logger
included, #logger, #logger_output=
Constructor Details
#initialize(parent, vrde_settings) ⇒ VRDEServer
Returns a new instance of VRDEServer.
31 32 33 34 35 36 37 38 |
# File 'lib/virtualbox/vrde_server.rb', line 31 def initialize(parent, vrde_settings) write_attribute(:parent, parent) # Load the attributes and mark the whole thing as existing load_interface_attributes(vrde_settings) clear_dirty! existing_record! end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class VirtualBox::AbstractModel::Dirty
Class Method Details
.populate_relationship(caller, imachine) ⇒ VRDEServer
Populates a relationship with another model.
**This method typically won’t be used except internally.**
19 20 21 |
# File 'lib/virtualbox/vrde_server.rb', line 19 def populate_relationship(caller, imachine) data = new(caller, imachine.vrde_server) end |
.save_relationship(caller, instance) ⇒ Object
Saves the relationship.
**This method typically won’t be used except internally.**
26 27 28 |
# File 'lib/virtualbox/vrde_server.rb', line 26 def save_relationship(caller, instance) instance.save end |
Instance Method Details
#save ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/virtualbox/vrde_server.rb', line 48 def save parent.with_open_session do |session| machine = session.machine # Save them save_changed_interface_attributes(machine.vrde_server) end end |
#validate ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/virtualbox/vrde_server.rb', line 40 def validate super validates_inclusion_of :enabled, :allow_multi_connection, :reuse_single_connection, :in => [true, false] validates_inclusion_of :auth_type, :in => COM::Util.versioned_interface(:AuthType).map validates_numericality_of :auth_timeout end |