Sha256: b44afca7676637e1b3fac9771f0412f30dfb7125903bef334f910ce03f6eecd1
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
module LetsFreckle class Entry < DelegateClass(Hashie::Mash) extend ClientResource def self.all fetch('entries') end # Fetches all entries. Supported options are: # :people => ['ryan', 'frank'] # :projects => ['project1', 'project2'] # :tags => ['tag1', 'tag2'] # :from => '2011-01-01' # :to => '2012-01-01' # :billable => true/false def self.find(options = {}) fetch('entries', searchable_options_from(options)) end # Creates a new entry. Supported options are: # :minutes => '4h' (required) # :project_id => 3221 # :description => 'new task' # :date => '2011-08-01' def self.create(options = {}) raise ArgumentError, ':username config missing' unless LetsFreckle.config.username raise ArgumentError, ':minutes missing' unless options.has_key?(:minutes) post('entries', :entry => options.merge(:user => LetsFreckle.config.username)) end def self.searchable_options_from(options = {}) options.each_with_object({}) do |(key, value), result| case value when Array then result["search[#{key}]"] = value.join(',') else result["search[#{key}]"] = value.to_s end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
letsfreckle-client-0.1.2 | lib/letsfreckle/entry.rb |
letsfreckle-client-0.1.1 | lib/letsfreckle/entry.rb |
letsfreckle-client-0.1.0 | lib/letsfreckle/entry.rb |