class TimeCamp::EntryCollection
Public Class Methods
new(response)
click to toggle source
# File lib/ruby-timecamp/resources/entry_collection.rb, line 3 def initialize(response) @resources = response.map{|entry| Entry.new(entry) } end
parse(response)
click to toggle source
# File lib/ruby-timecamp/resources/entry_collection.rb, line 11 def self.parse(response) return EntryCollection.new([]) if response.blank? return response.is_a?(Array) ? EntryCollection.new(response) : Entry.new(response) end
Public Instance Methods
find(entry_id)
click to toggle source
# File lib/ruby-timecamp/resources/entry_collection.rb, line 7 def find(entry_id) return @resources.select{ |entry| entry.id == entry_id }.try(:first) end