class SwaggyJenkinsClient::HudsonMasterComputer
Attributes
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 52 def self.attribute_map { :'_class' => :'_class', :'display_name' => :'displayName', :'executors' => :'executors', :'icon' => :'icon', :'icon_class_name' => :'iconClassName', :'idle' => :'idle', :'jnlp_agent' => :'jnlpAgent', :'launch_supported' => :'launchSupported', :'load_statistics' => :'loadStatistics', :'manual_launch_allowed' => :'manualLaunchAllowed', :'monitor_data' => :'monitorData', :'num_executors' => :'numExecutors', :'offline' => :'offline', :'offline_cause' => :'offlineCause', :'offline_cause_reason' => :'offlineCauseReason', :'temporarily_offline' => :'temporarilyOffline' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 97 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'_class') self._class = attributes[:'_class'] end if attributes.has_key?(:'displayName') self.display_name = attributes[:'displayName'] end if attributes.has_key?(:'executors') if (value = attributes[:'executors']).is_a?(Array) self.executors = value end end if attributes.has_key?(:'icon') self.icon = attributes[:'icon'] end if attributes.has_key?(:'iconClassName') self.icon_class_name = attributes[:'iconClassName'] end if attributes.has_key?(:'idle') self.idle = attributes[:'idle'] end if attributes.has_key?(:'jnlpAgent') self.jnlp_agent = attributes[:'jnlpAgent'] end if attributes.has_key?(:'launchSupported') self.launch_supported = attributes[:'launchSupported'] end if attributes.has_key?(:'loadStatistics') self.load_statistics = attributes[:'loadStatistics'] end if attributes.has_key?(:'manualLaunchAllowed') self.manual_launch_allowed = attributes[:'manualLaunchAllowed'] end if attributes.has_key?(:'monitorData') self.monitor_data = attributes[:'monitorData'] end if attributes.has_key?(:'numExecutors') self.num_executors = attributes[:'numExecutors'] end if attributes.has_key?(:'offline') self.offline = attributes[:'offline'] end if attributes.has_key?(:'offlineCause') self.offline_cause = attributes[:'offlineCause'] end if attributes.has_key?(:'offlineCauseReason') self.offline_cause_reason = attributes[:'offlineCauseReason'] end if attributes.has_key?(:'temporarilyOffline') self.temporarily_offline = attributes[:'temporarilyOffline'] end end
Attribute type mapping.
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 74 def self.swagger_types { :'_class' => :'String', :'display_name' => :'String', :'executors' => :'Array<HudsonMasterComputerexecutors>', :'icon' => :'String', :'icon_class_name' => :'String', :'idle' => :'BOOLEAN', :'jnlp_agent' => :'BOOLEAN', :'launch_supported' => :'BOOLEAN', :'load_statistics' => :'Label1', :'manual_launch_allowed' => :'BOOLEAN', :'monitor_data' => :'HudsonMasterComputermonitorData', :'num_executors' => :'Integer', :'offline' => :'BOOLEAN', :'offline_cause' => :'String', :'offline_cause_reason' => :'String', :'temporarily_offline' => :'BOOLEAN' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 186 def ==(o) return true if self.equal?(o) self.class == o.class && _class == o._class && display_name == o.display_name && executors == o.executors && icon == o.icon && icon_class_name == o.icon_class_name && idle == o.idle && jnlp_agent == o.jnlp_agent && launch_supported == o.launch_supported && load_statistics == o.load_statistics && manual_launch_allowed == o.manual_launch_allowed && monitor_data == o.monitor_data && num_executors == o.num_executors && offline == o.offline && offline_cause == o.offline_cause && offline_cause_reason == o.offline_cause_reason && temporarily_offline == o.temporarily_offline end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 243 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = SwaggyJenkinsClient.const_get(type).new temp_model.build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 309 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 222 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
@see the `==` method @param [Object] Object to be compared
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 209 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 215 def hash [_class, display_name, executors, icon, icon_class_name, idle, jnlp_agent, launch_supported, load_statistics, manual_launch_allowed, monitor_data, num_executors, offline, offline_cause, offline_cause_reason, temporarily_offline].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 173 def list_invalid_properties invalid_properties = Array.new return invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 295 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 283 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/swaggy_jenkins/models/hudson_master_computer.rb, line 180 def valid? return true end