Sha256: fe6d59f9579cf0984d5840beec006f3e7a2ae02184e09a79ea5eb9b6fd9c8e12

Contents?: true

Size: 890 Bytes

Versions: 4

Compression:

Stored size: 890 Bytes

Contents

require "twitter/direct_message"
require "twitter/streaming/deleted_tweet"
require "twitter/streaming/event"
require "twitter/streaming/friend_list"
require "twitter/streaming/stall_warning"
require "twitter/tweet"

module Twitter
  module Streaming
    class MessageParser
      def self.parse(data) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
        if data[:id]
          Tweet.new(data)
        elsif data[:event]
          Event.new(data)
        elsif data[:direct_message]
          DirectMessage.new(data[:direct_message])
        elsif data[:friends]
          FriendList.new(data[:friends])
        elsif data[:delete] && data[:delete][:status]
          DeletedTweet.new(data[:delete][:status])
        elsif data[:warning]
          StallWarning.new(data[:warning])
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter-8.1.0 lib/twitter/streaming/message_parser.rb
twitter-8.0.1 lib/twitter/streaming/message_parser.rb
twitter-8.0.0 lib/twitter/streaming/message_parser.rb
twitter-8.0.0.rc.1 lib/twitter/streaming/message_parser.rb