Class: MinuteFranck

Inherits:
Thor
  • Object
show all
Defined in:
lib/minute-franck/version.rb,
lib/minute-franck/minute_franck.rb

Constant Summary collapse

VERSION =
"0.2.3"

Instance Method Summary collapse

Instance Method Details

#addObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/minute-franck/minute_franck.rb', line 30

def add
  setup
  desc_line = options[:desc]
  desc_line += ", #{options[:tags].join(',')}" if options[:tags]
  ans = LetsFreckle::Entry.create(:project_id => config["projects"][options[:project]]["id"],
                            :minutes => options[:time],
                            :description => desc_line,
                            :date => options[:date] || Time.now.strftime("%Y-%m-%d"))
  case ans.status
  when 200
    puts "Entry has been added : #{ans['location'].split('/').last}"
  when 201
    puts "Entry has been added : #{ans['location'].split('/').last}"
  else
    puts "there was an error : #{ans.status}"
  end
end