Class: HTTPAttack::Items::Twitter
- Inherits:
-
Base
- Object
- Base
- HTTPAttack::Items::Twitter
show all
- Defined in:
- lib/httpattack/items/twitter.rb
Constant Summary
collapse
- STATS =
['followers_count', 'friends_count']
Instance Attribute Summary
Attributes inherited from Base
#stats
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
name, #reload_stats, #reload_stats!
Constructor Details
#initialize(username, options = {}) ⇒ Twitter
Returns a new instance of Twitter.
7
8
9
10
11
12
|
# File 'lib/httpattack/items/twitter.rb', line 7
def initialize(username, options = {})
options[:remote_stat] ||= 'followers_count'
raise Items::InvalidStat unless STATS.include?(options[:remote_stat])
@username = username
@remote_stat = options[:remote_stat]
end
|
Class Method Details
.desc ⇒ Object
25
26
27
|
# File 'lib/httpattack/items/twitter.rb', line 25
def desc
'Even your mom is on Twitter.'
end
|
Instance Method Details
#stat ⇒ Object
14
15
16
17
|
# File 'lib/httpattack/items/twitter.rb', line 14
def stat
self.reload_stats! unless stats
stats[@remote_stat].to_i
end
|
#stats_url ⇒ Object
19
20
21
|
# File 'lib/httpattack/items/twitter.rb', line 19
def stats_url
URI.parse("http://twitter.com/users/show/#{@username}.json").to_s
end
|