require 'date' module PureCloud class AnalyticsConversationSegment attr_accessor :segment_id # 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 :monitored_session_id attr_accessor :user_id attr_accessor :team_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 :direction attr_accessor :how_ended attr_accessor :segment_type attr_accessor :purpose attr_accessor :preferred_agent_ids attr_accessor :requested_skill_ids attr_accessor :requested_language_id attr_accessor :properties attr_accessor :ani attr_accessor :dnis attr_accessor :dialer_campaign_id attr_accessor :dialer_contact_list_id attr_accessor :disposition_name attr_accessor :disposition_analyzer attr_accessor :monitored_participant_id attr_accessor :edge_id attr_accessor :source_conversation_id attr_accessor :destination_conversation_id attr_accessor :source_session_id attr_accessor :destination_session_id attr_accessor :remote_name_displayable attr_accessor :sip_response_codes attr_accessor :q850_response_codes attr_accessor :conference attr_accessor :group_id attr_accessor :room_id attr_accessor :subject attr_accessor :address_self attr_accessor :address_other # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'segment_id' => :'segmentId', :'segment_start' => :'segmentStart', :'segment_end' => :'segmentEnd', :'queue_id' => :'queueId', :'monitored_session_id' => :'monitoredSessionId', :'user_id' => :'userId', :'team_id' => :'teamId', :'wrap_up_code' => :'wrapUpCode', :'wrap_up_note' => :'wrapUpNote', :'wrap_up_tags' => :'wrapUpTags', :'error_code' => :'errorCode', :'disconnect_type' => :'disconnectType', :'direction' => :'direction', :'how_ended' => :'howEnded', :'segment_type' => :'segmentType', :'purpose' => :'purpose', :'preferred_agent_ids' => :'preferredAgentIds', :'requested_skill_ids' => :'requestedSkillIds', :'requested_language_id' => :'requestedLanguageId', :'properties' => :'properties', :'ani' => :'ani', :'dnis' => :'dnis', :'dialer_campaign_id' => :'dialerCampaignId', :'dialer_contact_list_id' => :'dialerContactListId', :'disposition_name' => :'dispositionName', :'disposition_analyzer' => :'dispositionAnalyzer', :'monitored_participant_id' => :'monitoredParticipantId', :'edge_id' => :'edgeId', :'source_conversation_id' => :'sourceConversationId', :'destination_conversation_id' => :'destinationConversationId', :'source_session_id' => :'sourceSessionId', :'destination_session_id' => :'destinationSessionId', :'remote_name_displayable' => :'remoteNameDisplayable', :'sip_response_codes' => :'sipResponseCodes', :'q850_response_codes' => :'q850ResponseCodes', :'conference' => :'conference', :'group_id' => :'groupId', :'room_id' => :'roomId', :'subject' => :'subject', :'address_self' => :'addressSelf', :'address_other' => :'addressOther' } end # Attribute type mapping. def self.swagger_types { :'segment_id' => :'String', :'segment_start' => :'DateTime', :'segment_end' => :'DateTime', :'queue_id' => :'String', :'monitored_session_id' => :'String', :'user_id' => :'String', :'team_id' => :'String', :'wrap_up_code' => :'String', :'wrap_up_note' => :'String', :'wrap_up_tags' => :'Array', :'error_code' => :'String', :'disconnect_type' => :'String', :'direction' => :'String', :'how_ended' => :'String', :'segment_type' => :'String', :'purpose' => :'String', :'preferred_agent_ids' => :'Array', :'requested_skill_ids' => :'Array', :'requested_language_id' => :'String', :'properties' => :'Array', :'ani' => :'String', :'dnis' => :'String', :'dialer_campaign_id' => :'String', :'dialer_contact_list_id' => :'String', :'disposition_name' => :'String', :'disposition_analyzer' => :'String', :'monitored_participant_id' => :'String', :'edge_id' => :'String', :'source_conversation_id' => :'String', :'destination_conversation_id' => :'String', :'source_session_id' => :'String', :'destination_session_id' => :'String', :'remote_name_displayable' => :'String', :'sip_response_codes' => :'Array', :'q850_response_codes' => :'Array', :'conference' => :'BOOLEAN', :'group_id' => :'String', :'room_id' => :'String', :'subject' => :'String', :'address_self' => :'String', :'address_other' => :'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[:'segmentId'] self.segment_id = attributes[:'segmentId'] end 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[:'monitoredSessionId'] self.monitored_session_id = attributes[:'monitoredSessionId'] end if attributes[:'userId'] self.user_id = attributes[:'userId'] end if attributes[:'teamId'] self.team_id = attributes[:'teamId'] 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[:'direction'] self.direction = attributes[:'direction'] end if attributes[:'howEnded'] self.how_ended = attributes[:'howEnded'] end if attributes[:'segmentType'] self.segment_type = attributes[:'segmentType'] end if attributes[:'purpose'] self.purpose = attributes[:'purpose'] end if attributes[:'preferredAgentIds'] if (value = attributes[:'preferredAgentIds']).is_a?(Array) self.preferred_agent_ids = value end end if attributes[:'requestedSkillIds'] if (value = attributes[:'requestedSkillIds']).is_a?(Array) self.requested_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[:'ani'] self.ani = attributes[:'ani'] end if attributes[:'dnis'] self.dnis = attributes[:'dnis'] end if attributes[:'dialerCampaignId'] self.dialer_campaign_id = attributes[:'dialerCampaignId'] end if attributes[:'dialerContactListId'] self.dialer_contact_list_id = attributes[:'dialerContactListId'] end if attributes[:'dispositionName'] self.disposition_name = attributes[:'dispositionName'] end if attributes[:'dispositionAnalyzer'] self.disposition_analyzer = attributes[:'dispositionAnalyzer'] end if attributes[:'monitoredParticipantId'] self.monitored_participant_id = attributes[:'monitoredParticipantId'] end if attributes[:'edgeId'] self.edge_id = attributes[:'edgeId'] 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[:'remoteNameDisplayable'] self.remote_name_displayable = attributes[:'remoteNameDisplayable'] 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[:'roomId'] self.room_id = attributes[:'roomId'] end if attributes[:'subject'] self.subject = attributes[:'subject'] end if attributes[:'addressSelf'] self.address_self = attributes[:'addressSelf'] end if attributes[:'addressOther'] self.address_other = attributes[:'addressOther'] 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 direction=(direction) allowed_values = ["inbound", "outbound"] if direction && !allowed_values.include?(direction) fail "invalid value for 'direction', must be one of #{allowed_values}" end @direction = direction end # Custom attribute writer method checking allowed values (enum). def how_ended=(how_ended) allowed_values = ["unknown", "notEnded", "disconnect", "interact", "alert", "hold", "ivr", "voicemail", "error", "conference"] if how_ended && !allowed_values.include?(how_ended) fail "invalid value for 'how_ended', must be one of #{allowed_values}" end @how_ended = how_ended 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 # Custom attribute writer method checking allowed values (enum). def purpose=(purpose) allowed_values = ["manual", "dialer", "inbound", "acd", "ivr", "voicemail", "outbound", "agent", "user", "station", "group", "customer", "external"] if purpose && !allowed_values.include?(purpose) fail "invalid value for 'purpose', must be one of #{allowed_values}" end @purpose = purpose end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && segment_id == o.segment_id && segment_start == o.segment_start && segment_end == o.segment_end && queue_id == o.queue_id && monitored_session_id == o.monitored_session_id && user_id == o.user_id && team_id == o.team_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 && direction == o.direction && how_ended == o.how_ended && segment_type == o.segment_type && purpose == o.purpose && preferred_agent_ids == o.preferred_agent_ids && requested_skill_ids == o.requested_skill_ids && requested_language_id == o.requested_language_id && properties == o.properties && ani == o.ani && dnis == o.dnis && dialer_campaign_id == o.dialer_campaign_id && dialer_contact_list_id == o.dialer_contact_list_id && disposition_name == o.disposition_name && disposition_analyzer == o.disposition_analyzer && monitored_participant_id == o.monitored_participant_id && edge_id == o.edge_id && 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 && remote_name_displayable == o.remote_name_displayable && sip_response_codes == o.sip_response_codes && q850_response_codes == o.q850_response_codes && conference == o.conference && group_id == o.group_id && room_id == o.room_id && subject == o.subject && address_self == o.address_self && address_other == o.address_other end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [segment_id, segment_start, segment_end, queue_id, monitored_session_id, user_id, team_id, wrap_up_code, wrap_up_note, wrap_up_tags, error_code, disconnect_type, direction, how_ended, segment_type, purpose, preferred_agent_ids, requested_skill_ids, requested_language_id, properties, ani, dnis, dialer_campaign_id, dialer_contact_list_id, disposition_name, disposition_analyzer, monitored_participant_id, edge_id, source_conversation_id, destination_conversation_id, source_session_id, destination_session_id, remote_name_displayable, sip_response_codes, q850_response_codes, conference, group_id, room_id, subject, address_self, address_other].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