class ConnectWise::Workflow
Attributes
Metadata
of the entity
Batches can not be turned on until after the workflow is created and it has atleast one event associated with it
If not specified, defaults to Minutes. Months is not supported as month length varies
If activateFlag is true, batchSchedule is required
Must belong to the specified location
If a department is set, a location that contains it must be set
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 60 def self.attribute_map { :'id' => :'id', :'name' => :'name', :'table_type' => :'tableType', :'location' => :'location', :'department' => :'department', :'activate_flag' => :'activateFlag', :'batch_interval' => :'batchInterval', :'batch_frequency_unit' => :'batchFrequencyUnit', :'batch_last_ran' => :'batchLastRan', :'batch_schedule' => :'batchSchedule', :'board' => :'board', :'_info' => :'_info' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/connectwise-ruby-sdk/models/workflow.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?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'tableType') self.table_type = attributes[:'tableType'] end if attributes.has_key?(:'location') self.location = attributes[:'location'] end if attributes.has_key?(:'department') self.department = attributes[:'department'] end if attributes.has_key?(:'activateFlag') self.activate_flag = attributes[:'activateFlag'] end if attributes.has_key?(:'batchInterval') self.batch_interval = attributes[:'batchInterval'] end if attributes.has_key?(:'batchFrequencyUnit') self.batch_frequency_unit = attributes[:'batchFrequencyUnit'] end if attributes.has_key?(:'batchLastRan') self.batch_last_ran = attributes[:'batchLastRan'] end if attributes.has_key?(:'batchSchedule') self.batch_schedule = attributes[:'batchSchedule'] end if attributes.has_key?(:'board') self.board = attributes[:'board'] end if attributes.has_key?(:'_info') self._info = attributes[:'_info'] end end
Attribute type mapping.
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 78 def self.swagger_types { :'id' => :'Integer', :'name' => :'String', :'table_type' => :'WorkflowTableTypeReference', :'location' => :'SystemLocationReference', :'department' => :'SystemDepartmentReference', :'activate_flag' => :'BOOLEAN', :'batch_interval' => :'Integer', :'batch_frequency_unit' => :'String', :'batch_last_ran' => :'DateTime', :'batch_schedule' => :'String', :'board' => :'BoardReference', :'_info' => :'Metadata' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 227 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && table_type == o.table_type && location == o.location && department == o.department && activate_flag == o.activate_flag && batch_interval == o.batch_interval && batch_frequency_unit == o.batch_frequency_unit && batch_last_ran == o.batch_last_ran && batch_schedule == o.batch_schedule && board == o.board && _info == o._info 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/connectwise-ruby-sdk/models/workflow.rb, line 280 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 = ConnectWise.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/connectwise-ruby-sdk/models/workflow.rb, line 346 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
Custom attribute writer method checking allowed values (enum). @param [Object] batch_frequency_unit
Object to be assigned
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 207 def batch_frequency_unit=(batch_frequency_unit) validator = EnumAttributeValidator.new('String', ["Minutes", "Hours", "Days"]) unless validator.valid?(batch_frequency_unit) fail ArgumentError, "invalid value for 'batch_frequency_unit', must be one of #{validator.allowable_values}." end @batch_frequency_unit = batch_frequency_unit end
Custom attribute writer method with validation @param [Object] batch_interval
Value to be assigned
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 192 def batch_interval=(batch_interval) if !batch_interval.nil? && batch_interval > 2147483647 fail ArgumentError, "invalid value for 'batch_interval', must be smaller than or equal to 2147483647." end if !batch_interval.nil? && batch_interval < 0 fail ArgumentError, "invalid value for 'batch_interval', must be greater than or equal to 0." end @batch_interval = batch_interval end
Custom attribute writer method checking allowed values (enum). @param [Object] batch_schedule
Object to be assigned
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 217 def batch_schedule=(batch_schedule) validator = EnumAttributeValidator.new('String', ["AnyTime", "MyCompanyOfficeHours", "SlaHours"]) unless validator.valid?(batch_schedule) fail ArgumentError, "invalid value for 'batch_schedule', must be one of #{validator.allowable_values}." end @batch_schedule = batch_schedule end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 259 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/connectwise-ruby-sdk/models/workflow.rb, line 246 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 252 def hash [id, name, table_type, location, department, activate_flag, batch_interval, batch_frequency_unit, batch_last_ran, batch_schedule, board, _info].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 155 def list_invalid_properties invalid_properties = Array.new if @name.nil? invalid_properties.push("invalid value for 'name', name cannot be nil.") end if @table_type.nil? invalid_properties.push("invalid value for 'table_type', table_type cannot be nil.") end if !@batch_interval.nil? && @batch_interval > 2147483647 invalid_properties.push("invalid value for 'batch_interval', must be smaller than or equal to 2147483647.") end if !@batch_interval.nil? && @batch_interval < 0 invalid_properties.push("invalid value for 'batch_interval', must be greater than or equal to 0.") end return invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/connectwise-ruby-sdk/models/workflow.rb, line 332 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/connectwise-ruby-sdk/models/workflow.rb, line 320 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/connectwise-ruby-sdk/models/workflow.rb, line 178 def valid? return false if @name.nil? return false if @table_type.nil? return false if !@batch_interval.nil? && @batch_interval > 2147483647 return false if !@batch_interval.nil? && @batch_interval < 0 batch_frequency_unit_validator = EnumAttributeValidator.new('String', ["Minutes", "Hours", "Days"]) return false unless batch_frequency_unit_validator.valid?(@batch_frequency_unit) batch_schedule_validator = EnumAttributeValidator.new('String', ["AnyTime", "MyCompanyOfficeHours", "SlaHours"]) return false unless batch_schedule_validator.valid?(@batch_schedule) return true end