Sha256: df7e36c6f7a7ce44127f6f1a9b75c5c803573c05c5eadecdfebfceacd5bd7e6e
Contents?: true
Size: 884 Bytes
Versions: 6
Compression:
Stored size: 884 Bytes
Contents
module Gnip class Message SYSTEM_MESSAGE_TYPES = ['error', 'warn', 'info'] def self.build params return build_system_message(params) if (SYSTEM_MESSAGE_TYPES & params.keys).any? return build_activity(params) if params['objectType'] && params['objectType'] == 'activity' raise Gnip::UndefinedMessage end def system_message? @message_type ? true : false end def error? @message_type == 'error' end def warn? @message_type == 'warn' end def info? @message_type == 'info' end def activity? @object_type == 'activity' end def generate_json data JSON.generate(data) end private def self.build_system_message params Gnip::SystemMessage.new params end def self.build_activity params Gnip::Activity.new params end end end
Version data entries
6 entries across 6 versions & 1 rubygems