Class: OpenSourceStats::User

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

Direct Known Subclasses

Organization

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(login) ⇒ User

Returns a new instance of User.



6
7
8
# File 'lib/open_source_stats/user.rb', line 6

def initialize()
  @login = 
end

Instance Attribute Details

#loginObject

Returns the value of attribute login.



4
5
6
# File 'lib/open_source_stats/user.rb', line 4

def 
  @login
end

Instance Method Details

#eventsObject

Returns an array of in-scope Events from the user’s public activity feed



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/open_source_stats/user.rb', line 11

def events
  @events ||= begin
    if self.class == OpenSourceStats::User
      events = client.user_public_events , :per_page => 100
    else
      events = client.organization_public_events name, :per_page => 100
    end

    events.concat client.get client.last_response.rels[:next].href while next_page?
    events = events.map { |e| Event.new(e) }
    events.select { |e| e.in_scope? }
  end
end