Class: Twitter::Streaming::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter/streaming/event.rb

Constant Summary collapse

LIST_EVENTS =
%i[
  list_created list_destroyed list_updated list_member_added
  list_member_added list_member_removed list_user_subscribed
  list_user_subscribed list_user_unsubscribed list_user_unsubscribed
].freeze
TWEET_EVENTS =
%i[
  favorite unfavorite quoted_tweet
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Event

Returns a new instance of Event.

Parameters:

  • data (Hash)


17
18
19
20
21
22
# File 'lib/twitter/streaming/event.rb', line 17

def initialize(data)
  @name = data[:event].to_sym
  @source = Twitter::User.new(data[:source])
  @target = Twitter::User.new(data[:target])
  @target_object = target_object_factory(@name, data[:target_object])
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/twitter/streaming/event.rb', line 14

def name
  @name
end

#sourceObject (readonly)

Returns the value of attribute source.



14
15
16
# File 'lib/twitter/streaming/event.rb', line 14

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target.



14
15
16
# File 'lib/twitter/streaming/event.rb', line 14

def target
  @target
end

#target_objectObject (readonly)

Returns the value of attribute target_object.



14
15
16
# File 'lib/twitter/streaming/event.rb', line 14

def target_object
  @target_object
end