require 'date' module PureCloud class TwitterExpression # The globally unique identifier for the object. attr_accessor :id attr_accessor :name # Creation date for the entity. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :date_created # Date the entity was last modified. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :date_modified # True once the expression has been dispositioned by an agent through the ACD process attr_accessor :is_dispositioned # Indicates if a user/agent found this expression to be undesirable attr_accessor :is_noise # The Gistener that generated this expression attr_accessor :gistener # Twitter: the tweet's unique id attr_accessor :tweet_id # Twitter: the tweets full text attr_accessor :text # Twitter: the date the tweet was created. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ attr_accessor :tweet_created # Twitter: indicates this tweet as a reply to another tweet attr_accessor :is_reply # Twitter: indicates this tweet as a 'retweet' of another tweet attr_accessor :is_retweet # Twitter: when the expression is a retweet, this is Twitter's id of the original tweet attr_accessor :retweet_parent_id # Twitter: the number of times the parent tweet was retweeted - at the time this expression was created attr_accessor :retweet_count # Twitter: indicates this expression as a quoted tweet (a tweet with an addendum as the primary text) attr_accessor :is_quoted_tweet # Twitter: when the expression is a quoted tweet, this is Twitter's id of the original tweet (may not be immediately functional) attr_accessor :quoted_parent_id # Twitter: the expressing user's Twitter id attr_accessor :user_id # Twitter: the user's account name for the core service attr_accessor :user_name # Twitter: the user's custom 'branding' name (allowed to change over time) attr_accessor :user_screen_name # Twitter: the number of times this user has tweeted (includes all forms of expression replies/quotes/retweets) attr_accessor :user_tweet_count # Twitter: the number of followers this user has at the time of this expression attr_accessor :user_followers_count # The Group Tags applied by the generating Gistener attr_accessor :group_tags attr_accessor :routed # 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', :'date_created' => :'dateCreated', :'date_modified' => :'dateModified', :'is_dispositioned' => :'isDispositioned', :'is_noise' => :'isNoise', :'gistener' => :'gistener', :'tweet_id' => :'tweetId', :'text' => :'text', :'tweet_created' => :'tweetCreated', :'is_reply' => :'isReply', :'is_retweet' => :'isRetweet', :'retweet_parent_id' => :'retweetParentId', :'retweet_count' => :'retweetCount', :'is_quoted_tweet' => :'isQuotedTweet', :'quoted_parent_id' => :'quotedParentId', :'user_id' => :'userId', :'user_name' => :'userName', :'user_screen_name' => :'userScreenName', :'user_tweet_count' => :'userTweetCount', :'user_followers_count' => :'userFollowersCount', :'group_tags' => :'groupTags', :'routed' => :'routed', :'self_uri' => :'selfUri' } end # Attribute type mapping. def self.swagger_types { :'id' => :'String', :'name' => :'String', :'date_created' => :'DateTime', :'date_modified' => :'DateTime', :'is_dispositioned' => :'BOOLEAN', :'is_noise' => :'BOOLEAN', :'gistener' => :'Gistener', :'tweet_id' => :'String', :'text' => :'String', :'tweet_created' => :'DateTime', :'is_reply' => :'BOOLEAN', :'is_retweet' => :'BOOLEAN', :'retweet_parent_id' => :'String', :'retweet_count' => :'Integer', :'is_quoted_tweet' => :'BOOLEAN', :'quoted_parent_id' => :'String', :'user_id' => :'String', :'user_name' => :'String', :'user_screen_name' => :'String', :'user_tweet_count' => :'Integer', :'user_followers_count' => :'Integer', :'group_tags' => :'Array', :'routed' => :'BOOLEAN', :'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[:'dateCreated'] self.date_created = attributes[:'dateCreated'] end if attributes[:'dateModified'] self.date_modified = attributes[:'dateModified'] end if attributes[:'isDispositioned'] self.is_dispositioned = attributes[:'isDispositioned'] else self.is_dispositioned = false end if attributes[:'isNoise'] self.is_noise = attributes[:'isNoise'] else self.is_noise = false end if attributes[:'gistener'] self.gistener = attributes[:'gistener'] end if attributes[:'tweetId'] self.tweet_id = attributes[:'tweetId'] end if attributes[:'text'] self.text = attributes[:'text'] end if attributes[:'tweetCreated'] self.tweet_created = attributes[:'tweetCreated'] end if attributes[:'isReply'] self.is_reply = attributes[:'isReply'] else self.is_reply = false end if attributes[:'isRetweet'] self.is_retweet = attributes[:'isRetweet'] else self.is_retweet = false end if attributes[:'retweetParentId'] self.retweet_parent_id = attributes[:'retweetParentId'] end if attributes[:'retweetCount'] self.retweet_count = attributes[:'retweetCount'] end if attributes[:'isQuotedTweet'] self.is_quoted_tweet = attributes[:'isQuotedTweet'] else self.is_quoted_tweet = false end if attributes[:'quotedParentId'] self.quoted_parent_id = attributes[:'quotedParentId'] end if attributes[:'userId'] self.user_id = attributes[:'userId'] end if attributes[:'userName'] self.user_name = attributes[:'userName'] end if attributes[:'userScreenName'] self.user_screen_name = attributes[:'userScreenName'] end if attributes[:'userTweetCount'] self.user_tweet_count = attributes[:'userTweetCount'] end if attributes[:'userFollowersCount'] self.user_followers_count = attributes[:'userFollowersCount'] end if attributes[:'groupTags'] if (value = attributes[:'groupTags']).is_a?(Array) self.group_tags = value end end if attributes[:'routed'] self.routed = attributes[:'routed'] else self.routed = false 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 && name == o.name && date_created == o.date_created && date_modified == o.date_modified && is_dispositioned == o.is_dispositioned && is_noise == o.is_noise && gistener == o.gistener && tweet_id == o.tweet_id && text == o.text && tweet_created == o.tweet_created && is_reply == o.is_reply && is_retweet == o.is_retweet && retweet_parent_id == o.retweet_parent_id && retweet_count == o.retweet_count && is_quoted_tweet == o.is_quoted_tweet && quoted_parent_id == o.quoted_parent_id && user_id == o.user_id && user_name == o.user_name && user_screen_name == o.user_screen_name && user_tweet_count == o.user_tweet_count && user_followers_count == o.user_followers_count && group_tags == o.group_tags && routed == o.routed && 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, date_created, date_modified, is_dispositioned, is_noise, gistener, tweet_id, text, tweet_created, is_reply, is_retweet, retweet_parent_id, retweet_count, is_quoted_tweet, quoted_parent_id, user_id, user_name, user_screen_name, user_tweet_count, user_followers_count, group_tags, routed, 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