Class: Yammer::Stats

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Stats

Returns a new instance of Stats.



7
8
9
10
# File 'lib/yammer/stats.rb', line 7

def initialize(options = {})
  options.merge!(:config => "oauth.yml") unless options[:config]
  @yammer = Yammer::Client.new(options)
end

Instance Method Details

#top_updaters(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/yammer/stats.rb', line 12

def top_updaters(options = {})
  users = @yammer.users(:sort_by => "messages", :reverse => false)
  if options.delete(:dump) == true
    users.each {|u| puts "#{u.name} - #{u.stats.updates}" }
  else
    template, output_file = options_or_defaults(options)
    output = ERB.new(IO.read(template), nil, '<>').result(binding)
    File.open(output_file, 'w') {|f| f.write(output)}      
  end
end