require 'date' module PureCloud # Details about the current state of a Flow Instance class FlowDetails # The globally unique identifier for the object. attr_accessor :id attr_accessor :name # The FlowConfigId that was used to launch this flow. attr_accessor :flow_config_id # The time the flow was launched. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :launch_time # The launch mode for this flow instance. attr_accessor :launch_type # The user who launched the flow, if the flow was launched as the result of that user's action. attr_accessor :launched_by # The flow's running status, which indicates whether the flow is running normally or completed, etc. attr_accessor :status # The documents associated with this flow. attr_accessor :associated_documents # The time the flow completed, if applicable. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :flow_completion_time # The completion reason set at the flow completion time, if applicable. attr_accessor :flow_completion_reason # Additional information if the flow is in error attr_accessor :flow_error_info # The URI for this object attr_accessor :self_uri # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'name' => :'name', :'flow_config_id' => :'flowConfigId', :'launch_time' => :'launchTime', :'launch_type' => :'launchType', :'launched_by' => :'launchedBy', :'status' => :'status', :'associated_documents' => :'associatedDocuments', :'flow_completion_time' => :'flowCompletionTime', :'flow_completion_reason' => :'flowCompletionReason', :'flow_error_info' => :'flowErrorInfo', :'self_uri' => :'selfUri' } end # Attribute type mapping. def self.swagger_types { :'id' => :'String', :'name' => :'String', :'flow_config_id' => :'FlowConfigId', :'launch_time' => :'DateTime', :'launch_type' => :'String', :'launched_by' => :'User', :'status' => :'String', :'associated_documents' => :'Array', :'flow_completion_time' => :'DateTime', :'flow_completion_reason' => :'String', :'flow_error_info' => :'ErrorBody', :'self_uri' => :'String' } end def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} if attributes[:'id'] self.id = attributes[:'id'] end if attributes[:'name'] self.name = attributes[:'name'] end if attributes[:'flowConfigId'] self.flow_config_id = attributes[:'flowConfigId'] end if attributes[:'launchTime'] self.launch_time = attributes[:'launchTime'] end if attributes[:'launchType'] self.launch_type = attributes[:'launchType'] end if attributes[:'launchedBy'] self.launched_by = attributes[:'launchedBy'] end if attributes[:'status'] self.status = attributes[:'status'] end if attributes[:'associatedDocuments'] if (value = attributes[:'associatedDocuments']).is_a?(Array) self.associated_documents = value end end if attributes[:'flowCompletionTime'] self.flow_completion_time = attributes[:'flowCompletionTime'] end if attributes[:'flowCompletionReason'] self.flow_completion_reason = attributes[:'flowCompletionReason'] end if attributes[:'flowErrorInfo'] self.flow_error_info = attributes[:'flowErrorInfo'] end if attributes[:'selfUri'] self.self_uri = attributes[:'selfUri'] end end # Custom attribute writer method checking allowed values (enum). def launch_type=(launch_type) allowed_values = ["UNKNOWN", "NORMAL", "TEST", "AUTOMATIC"] if launch_type && !allowed_values.include?(launch_type) fail "invalid value for 'launch_type', must be one of #{allowed_values}" end @launch_type = launch_type end # Custom attribute writer method checking allowed values (enum). def status=(status) allowed_values = ["UNKNOWN", "RUNNING", "ERROR", "TERMINATED", "COMPLETED"] if status && !allowed_values.include?(status) fail "invalid value for 'status', must be one of #{allowed_values}" end @status = status end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && flow_config_id == o.flow_config_id && launch_time == o.launch_time && launch_type == o.launch_type && launched_by == o.launched_by && status == o.status && associated_documents == o.associated_documents && flow_completion_time == o.flow_completion_time && flow_completion_reason == o.flow_completion_reason && flow_error_info == o.flow_error_info && self_uri == o.self_uri end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [id, name, flow_config_id, launch_time, launch_type, launched_by, status, associated_documents, flow_completion_time, flow_completion_reason, flow_error_info, self_uri].hash end # build the object from hash def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end 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 =~ /^(true|t|yes|y|1)$/i true else false end when /\AArray<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+), (?.+)>\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 _model = Object.const_get("PureCloud").const_get(type).new _model.build_from_hash(value) end end def to_s to_hash.to_s end # to_body is an alias to to_body (backward compatibility)) def to_body to_hash end # return the object in the form of hash 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 # Method to output non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value 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 end end