Sha256: 4a4ac6ab35058037de62eae7d04f49bc7121c0f9079bc3384ff34265a558d9fc
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
module LetsFreckle class Entry < DelegateClass(Hashie::Mash) extend ClientResource def self.all get('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 = {}) get('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', options.merge(:root => :entry, :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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
letsfreckle-client-0.2.1 | lib/letsfreckle/entry.rb |
letsfreckle-client-0.2.0 | lib/letsfreckle/entry.rb |