require 'date' module PureCloud class ExternalContact # The globally unique identifier for the object. attr_accessor :id attr_accessor :first_name attr_accessor :middle_name attr_accessor :last_name attr_accessor :salutation attr_accessor :title attr_accessor :work_phone attr_accessor :cell_phone attr_accessor :home_phone attr_accessor :other_phone attr_accessor :work_email attr_accessor :personal_email attr_accessor :other_email attr_accessor :address # Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :modify_date # Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :create_date attr_accessor :external_organization # 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', :'first_name' => :'firstName', :'middle_name' => :'middleName', :'last_name' => :'lastName', :'salutation' => :'salutation', :'title' => :'title', :'work_phone' => :'workPhone', :'cell_phone' => :'cellPhone', :'home_phone' => :'homePhone', :'other_phone' => :'otherPhone', :'work_email' => :'workEmail', :'personal_email' => :'personalEmail', :'other_email' => :'otherEmail', :'address' => :'address', :'modify_date' => :'modifyDate', :'create_date' => :'createDate', :'external_organization' => :'externalOrganization', :'self_uri' => :'selfUri' } end # Attribute type mapping. def self.swagger_types { :'id' => :'String', :'first_name' => :'String', :'middle_name' => :'String', :'last_name' => :'String', :'salutation' => :'String', :'title' => :'String', :'work_phone' => :'PhoneNumber', :'cell_phone' => :'PhoneNumber', :'home_phone' => :'PhoneNumber', :'other_phone' => :'PhoneNumber', :'work_email' => :'String', :'personal_email' => :'String', :'other_email' => :'String', :'address' => :'ContactAddress', :'modify_date' => :'DateTime', :'create_date' => :'DateTime', :'external_organization' => :'ExternalOrganization', :'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[:'firstName'] self.first_name = attributes[:'firstName'] end if attributes[:'middleName'] self.middle_name = attributes[:'middleName'] end if attributes[:'lastName'] self.last_name = attributes[:'lastName'] end if attributes[:'salutation'] self.salutation = attributes[:'salutation'] end if attributes[:'title'] self.title = attributes[:'title'] end if attributes[:'workPhone'] self.work_phone = attributes[:'workPhone'] end if attributes[:'cellPhone'] self.cell_phone = attributes[:'cellPhone'] end if attributes[:'homePhone'] self.home_phone = attributes[:'homePhone'] end if attributes[:'otherPhone'] self.other_phone = attributes[:'otherPhone'] end if attributes[:'workEmail'] self.work_email = attributes[:'workEmail'] end if attributes[:'personalEmail'] self.personal_email = attributes[:'personalEmail'] end if attributes[:'otherEmail'] self.other_email = attributes[:'otherEmail'] end if attributes[:'address'] self.address = attributes[:'address'] end if attributes[:'modifyDate'] self.modify_date = attributes[:'modifyDate'] end if attributes[:'createDate'] self.create_date = attributes[:'createDate'] end if attributes[:'externalOrganization'] self.external_organization = attributes[:'externalOrganization'] end if attributes[:'selfUri'] self.self_uri = attributes[:'selfUri'] end end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && first_name == o.first_name && middle_name == o.middle_name && last_name == o.last_name && salutation == o.salutation && title == o.title && work_phone == o.work_phone && cell_phone == o.cell_phone && home_phone == o.home_phone && other_phone == o.other_phone && work_email == o.work_email && personal_email == o.personal_email && other_email == o.other_email && address == o.address && modify_date == o.modify_date && create_date == o.create_date && external_organization == o.external_organization && 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, first_name, middle_name, last_name, salutation, title, work_phone, cell_phone, home_phone, other_phone, work_email, personal_email, other_email, address, modify_date, create_date, external_organization, 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