Class: TimeCamp::UserCollection

Inherits:
ResourceCollection show all
Defined in:
lib/ruby-timecamp/resources/user_collection.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResourceCollection

#[], #each, #map, #select, #size

Constructor Details

#initialize(response) ⇒ UserCollection

Returns a new instance of UserCollection.



3
4
5
# File 'lib/ruby-timecamp/resources/user_collection.rb', line 3

def initialize(response)
  @resources = response.map{|user| User.new(user) }
end

Class Method Details

.parse(response) ⇒ Object



7
8
9
# File 'lib/ruby-timecamp/resources/user_collection.rb', line 7

def self.parse(response)
  return (response.length > 1) ? UserCollection.new(response) : User.new(response[0])
end