Class: TweetDump

Inherits:
Object
  • Object
show all
Defined in:
lib/tweetdump.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ TweetDump

Returns a new instance of TweetDump.



12
13
14
15
16
17
18
19
# File 'lib/tweetdump.rb', line 12

def initialize(opts={})
  @screen_name = opts[:screen_name]
  @password = opts[:password]
  @limit = opts[:limit]
  @logfile = opts[:logfile] || '/dev/null'
  @api = opts[:api] || 'streaming'
  @keyword = opts[:keyword]
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



11
12
13
# File 'lib/tweetdump.rb', line 11

def api
  @api
end

#keywordObject

Returns the value of attribute keyword.



11
12
13
# File 'lib/tweetdump.rb', line 11

def keyword
  @keyword
end

#limitObject

Returns the value of attribute limit.



11
12
13
# File 'lib/tweetdump.rb', line 11

def limit
  @limit
end

#logfileObject

Returns the value of attribute logfile.



11
12
13
# File 'lib/tweetdump.rb', line 11

def logfile
  @logfile
end

#passwordObject

Returns the value of attribute password.



11
12
13
# File 'lib/tweetdump.rb', line 11

def password
  @password
end

#screen_nameObject

Returns the value of attribute screen_name.



11
12
13
# File 'lib/tweetdump.rb', line 11

def screen_name
  @screen_name
end

Instance Method Details

#run!Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tweetdump.rb', line 21

def run!
  @count = 1
  @page = 0
  if @api == 'streaming'
    fetch_streaming
  elsif @api == 'search'
    fetch_search
  else
    logger.error "API is invalid or unsupported"
    raise "Unsupported API"
  end
end