Class: OpenSourceStats::User
- Inherits:
-
Object
- Object
- OpenSourceStats::User
- Defined in:
- lib/open_source_stats/user.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#login ⇒ Object
Returns the value of attribute login.
Instance Method Summary collapse
-
#events ⇒ Object
Returns an array of in-scope Events from the user’s public activity feed.
-
#initialize(login) ⇒ User
constructor
A new instance of User.
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) @login = login end |
Instance Attribute Details
#login ⇒ Object
Returns the value of attribute login.
4 5 6 |
# File 'lib/open_source_stats/user.rb', line 4 def login @login end |
Instance Method Details
#events ⇒ Object
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 login, :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 |