Sha256: 16269e67b5590f892353aa727235c3c4802c7d6e3fbb5a390429f65f8dd9cc74

Contents?: true

Size: 814 Bytes

Versions: 14

Compression:

Stored size: 814 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 CyclomaticComplexity
        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

14 entries across 14 versions & 1 rubygems

Version Path
twitter-5.11.0 lib/twitter/streaming/message_parser.rb
twitter-5.10.0 lib/twitter/streaming/message_parser.rb
twitter-5.9.0 lib/twitter/streaming/message_parser.rb
twitter-5.8.0 lib/twitter/streaming/message_parser.rb
twitter-5.7.1 lib/twitter/streaming/message_parser.rb
twitter-5.7.0 lib/twitter/streaming/message_parser.rb
twitter-5.6.0 lib/twitter/streaming/message_parser.rb
twitter-5.5.1 lib/twitter/streaming/message_parser.rb
twitter-5.5.0 lib/twitter/streaming/message_parser.rb
twitter-5.4.1 lib/twitter/streaming/message_parser.rb
twitter-5.4.0 lib/twitter/streaming/message_parser.rb
twitter-5.3.1 lib/twitter/streaming/message_parser.rb
twitter-5.3.0 lib/twitter/streaming/message_parser.rb
twitter-5.2.0 lib/twitter/streaming/message_parser.rb