Sha256: 130875b3318547259507f661065d55e2bd3cd37dd5b426633a29c8ece204035f
Contents?: true
Size: 901 Bytes
Versions: 8
Compression:
Stored size: 901 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 GnipApi::JsonParser.new.encode(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
8 entries across 8 versions & 1 rubygems