Class: DaFace::Datasift::Twitter

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/da_face/datasift/twitter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#parse_json, #parse_timestamp, #parse_uri, #symbolize_keys

Constructor Details

#initialize(data) ⇒ Twitter

Returns a new instance of Twitter.



16
17
18
19
20
21
22
23
24
25
# File 'lib/da_face/datasift/twitter.rb', line 16

def initialize data
  if data.keys.include? :retweet
    @tweet = DaFace::Twitter::Parser.parse extract_retweet_info(data), true
    @retweeted = DaFace::Twitter::Parser.parse extract_tweet_info(data), false
    @retweet = true
  else
    @tweet = DaFace::Twitter::Parser.parse extract_tweet_info(data), false
    @retweet = false
  end
end

Instance Attribute Details

#retweetObject (readonly)

Returns the value of attribute retweet.



6
7
8
# File 'lib/da_face/datasift/twitter.rb', line 6

def retweet
  @retweet
end

#retweetedObject (readonly)

Returns the value of attribute retweeted.



6
7
8
# File 'lib/da_face/datasift/twitter.rb', line 6

def retweeted
  @retweeted
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/da_face/datasift/twitter.rb', line 6

def status
  @status
end

#tweetObject (readonly)

Returns the value of attribute tweet.



6
7
8
# File 'lib/da_face/datasift/twitter.rb', line 6

def tweet
  @tweet
end

Class Method Details

.new(data) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/da_face/datasift/twitter.rb', line 8

def self.new data
  if data[:status]
    return DaFace::Datasift::TwitterUserStatus.new(data)        
  else
    super
  end
end

Instance Method Details

#retweet?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/da_face/datasift/twitter.rb', line 27

def retweet?
  @retweet
end