lib/letsfreckle/entry.rb in letsfreckle-client-0.1.2 vs lib/letsfreckle/entry.rb in letsfreckle-client-0.2.0
- old
+ new
@@ -1,39 +1,41 @@
module LetsFreckle
class Entry < DelegateClass(Hashie::Mash)
extend ClientResource
def self.all
- fetch('entries')
+ 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 = {})
- fetch('entries', searchable_options_from(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', :entry => options.merge(:user => LetsFreckle.config.username))
+ 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
+ when Array then
+ result["search[#{key}]"] = value.join(',')
+ else
+ result["search[#{key}]"] = value.to_s
end
end
end
end
end
\ No newline at end of file