Class: HTTPAttack::Items::StatusNet
- Defined in:
- lib/httpattack/items/status_net.rb
Overview
Item for the Status.net software (status.net/), which is used by the identi.ca service (identi.ca/).
You can specify the :api_root
option to point to a different URL running Status.net (defaults to identi.ca).
Constant Summary collapse
- STATS =
['followers_count', 'friends_count']
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(username, options = {}) ⇒ StatusNet
constructor
A new instance of StatusNet.
- #stat ⇒ Object
- #stats_url ⇒ Object
Methods inherited from Base
name, #reload_stats, #reload_stats!
Constructor Details
#initialize(username, options = {}) ⇒ StatusNet
Returns a new instance of StatusNet.
12 13 14 15 16 17 18 19 |
# File 'lib/httpattack/items/status_net.rb', line 12 def initialize(username, = {}) [:remote_stat] ||= 'followers_count' [:api_root] ||= 'identi.ca/api' raise Items::InvalidStat unless STATS.include?([:remote_stat]) @username = username @remote_stat = [:remote_stat] @options = end |
Class Method Details
.desc ⇒ Object
32 33 34 |
# File 'lib/httpattack/items/status_net.rb', line 32 def desc 'Open Source microblogging software.' end |
Instance Method Details
#stat ⇒ Object
21 22 23 24 |
# File 'lib/httpattack/items/status_net.rb', line 21 def stat self.reload_stats! unless stats stats[@remote_stat].to_i end |
#stats_url ⇒ Object
26 27 28 |
# File 'lib/httpattack/items/status_net.rb', line 26 def stats_url URI.parse("http://#{@options[:api_root]}/users/show/#{@username}.json").to_s end |