=begin PureCloud API PureCloud API OpenAPI spec version: v1 Contact: chuck.pulfer@inin.com Generated by: https://github.com/swagger-api/swagger-codegen.git License: ININ http://www.inin.com Terms of Service: http://www.inin.com =end require 'date' module PureCloud class AnalyticsConversationSegment # Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :segment_start # Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :segment_end attr_accessor :queue_id attr_accessor :wrap_up_code attr_accessor :wrap_up_note attr_accessor :wrap_up_tags attr_accessor :error_code attr_accessor :disconnect_type attr_accessor :segment_type attr_accessor :requested_routing_user_ids attr_accessor :requested_routing_skill_ids attr_accessor :requested_language_id attr_accessor :properties attr_accessor :source_conversation_id attr_accessor :destination_conversation_id attr_accessor :source_session_id attr_accessor :destination_session_id attr_accessor :sip_response_codes attr_accessor :q850_response_codes attr_accessor :conference attr_accessor :group_id attr_accessor :subject # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'segment_start' => :'segmentStart', :'segment_end' => :'segmentEnd', :'queue_id' => :'queueId', :'wrap_up_code' => :'wrapUpCode', :'wrap_up_note' => :'wrapUpNote', :'wrap_up_tags' => :'wrapUpTags', :'error_code' => :'errorCode', :'disconnect_type' => :'disconnectType', :'segment_type' => :'segmentType', :'requested_routing_user_ids' => :'requestedRoutingUserIds', :'requested_routing_skill_ids' => :'requestedRoutingSkillIds', :'requested_language_id' => :'requestedLanguageId', :'properties' => :'properties', :'source_conversation_id' => :'sourceConversationId', :'destination_conversation_id' => :'destinationConversationId', :'source_session_id' => :'sourceSessionId', :'destination_session_id' => :'destinationSessionId', :'sip_response_codes' => :'sipResponseCodes', :'q850_response_codes' => :'q850ResponseCodes', :'conference' => :'conference', :'group_id' => :'groupId', :'subject' => :'subject' } end # Attribute type mapping. def self.swagger_types { :'segment_start' => :'DateTime', :'segment_end' => :'DateTime', :'queue_id' => :'String', :'wrap_up_code' => :'String', :'wrap_up_note' => :'String', :'wrap_up_tags' => :'Array', :'error_code' => :'String', :'disconnect_type' => :'String', :'segment_type' => :'String', :'requested_routing_user_ids' => :'Array', :'requested_routing_skill_ids' => :'Array', :'requested_language_id' => :'String', :'properties' => :'Array', :'source_conversation_id' => :'String', :'destination_conversation_id' => :'String', :'source_session_id' => :'String', :'destination_session_id' => :'String', :'sip_response_codes' => :'Array', :'q850_response_codes' => :'Array', :'conference' => :'BOOLEAN', :'group_id' => :'String', :'subject' => :'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[:'segmentStart'] self.segment_start = attributes[:'segmentStart'] end if attributes[:'segmentEnd'] self.segment_end = attributes[:'segmentEnd'] end if attributes[:'queueId'] self.queue_id = attributes[:'queueId'] end if attributes[:'wrapUpCode'] self.wrap_up_code = attributes[:'wrapUpCode'] end if attributes[:'wrapUpNote'] self.wrap_up_note = attributes[:'wrapUpNote'] end if attributes[:'wrapUpTags'] if (value = attributes[:'wrapUpTags']).is_a?(Array) self.wrap_up_tags = value end end if attributes[:'errorCode'] self.error_code = attributes[:'errorCode'] end if attributes[:'disconnectType'] self.disconnect_type = attributes[:'disconnectType'] end if attributes[:'segmentType'] self.segment_type = attributes[:'segmentType'] end if attributes[:'requestedRoutingUserIds'] if (value = attributes[:'requestedRoutingUserIds']).is_a?(Array) self.requested_routing_user_ids = value end end if attributes[:'requestedRoutingSkillIds'] if (value = attributes[:'requestedRoutingSkillIds']).is_a?(Array) self.requested_routing_skill_ids = value end end if attributes[:'requestedLanguageId'] self.requested_language_id = attributes[:'requestedLanguageId'] end if attributes[:'properties'] if (value = attributes[:'properties']).is_a?(Array) self.properties = value end end if attributes[:'sourceConversationId'] self.source_conversation_id = attributes[:'sourceConversationId'] end if attributes[:'destinationConversationId'] self.destination_conversation_id = attributes[:'destinationConversationId'] end if attributes[:'sourceSessionId'] self.source_session_id = attributes[:'sourceSessionId'] end if attributes[:'destinationSessionId'] self.destination_session_id = attributes[:'destinationSessionId'] end if attributes[:'sipResponseCodes'] if (value = attributes[:'sipResponseCodes']).is_a?(Array) self.sip_response_codes = value end end if attributes[:'q850ResponseCodes'] if (value = attributes[:'q850ResponseCodes']).is_a?(Array) self.q850_response_codes = value end end if attributes[:'conference'] self.conference = attributes[:'conference'] else self.conference = false end if attributes[:'groupId'] self.group_id = attributes[:'groupId'] end if attributes[:'subject'] self.subject = attributes[:'subject'] end end # Custom attribute writer method checking allowed values (enum). def disconnect_type=(disconnect_type) allowed_values = ["endpoint", "client", "system", "transfer", "error", "peer", "other", "spam", "transportFailure", "conferenceTransfer", "consultTransfer", "forwardTransfer"] if disconnect_type && !allowed_values.include?(disconnect_type) fail "invalid value for 'disconnect_type', must be one of #{allowed_values}" end @disconnect_type = disconnect_type end # Custom attribute writer method checking allowed values (enum). def segment_type=(segment_type) allowed_values = ["unknown", "alert", "system", "delay", "hold", "interact", "ivr", "dialing", "wrapup", "voicemail"] if segment_type && !allowed_values.include?(segment_type) fail "invalid value for 'segment_type', must be one of #{allowed_values}" end @segment_type = segment_type end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && segment_start == o.segment_start && segment_end == o.segment_end && queue_id == o.queue_id && wrap_up_code == o.wrap_up_code && wrap_up_note == o.wrap_up_note && wrap_up_tags == o.wrap_up_tags && error_code == o.error_code && disconnect_type == o.disconnect_type && segment_type == o.segment_type && requested_routing_user_ids == o.requested_routing_user_ids && requested_routing_skill_ids == o.requested_routing_skill_ids && requested_language_id == o.requested_language_id && properties == o.properties && source_conversation_id == o.source_conversation_id && destination_conversation_id == o.destination_conversation_id && source_session_id == o.source_session_id && destination_session_id == o.destination_session_id && sip_response_codes == o.sip_response_codes && q850_response_codes == o.q850_response_codes && conference == o.conference && group_id == o.group_id && subject == o.subject end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [segment_start, segment_end, queue_id, wrap_up_code, wrap_up_note, wrap_up_tags, error_code, disconnect_type, segment_type, requested_routing_user_ids, requested_routing_skill_ids, requested_language_id, properties, source_conversation_id, destination_conversation_id, source_session_id, destination_session_id, sip_response_codes, q850_response_codes, conference, group_id, subject].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.to_s =~ /^(true|t|yes|y|1)$/i true else false end when :Object # generic object (usually a Hash), return directly value 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