Module: Rmclient

Defined in:
lib/rmclient.rb,
lib/rmclient/version.rb

Defined Under Namespace

Classes: Enumeration, Issue, RestAPI, Time_entry, Time_entry_activity

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#mktime_entry(id, date, activity, hours, comment) ⇒ Object

create time entry

Parameters:

  • id

    issue id

  • date

    date for time entry

  • activity (Integer)

    activity id

  • hours (Float)

    no of hours

  • comment (String)

    time entry comment

Returns:

  • true is successful, otherwise false



51
52
53
54
55
# File 'lib/rmclient.rb', line 51

def mktime_entry(id, date, activity, hours, comment)
  # parse date
  a = Time_entry.new(:issue_id => id, :spent_on => date, :hours => hours, :comments => comment, :activity_id => activity)
  a.save()
end

print possible activities



39
40
41
# File 'lib/rmclient.rb', line 39

def print_activities()
  Time_entry_activity.find(:all).each{|a| print "#{a.id} #{a.name}\n"}
end

print issues assigned to user

Parameters:

  • user (defaults to: "me")

    user id



25
26
27
28
# File 'lib/rmclient.rb', line 25

def print_issues(user = "me")
  issues = Issue.find(:all, :params => { :assigned_to_id => user, "limit" => 100})
  issues.each{|i| print "#{i.id} #{i.subject}\n"}
end

print time entries for user

Parameters:

  • user (defaults to: "me")

    id



33
34
35
36
# File 'lib/rmclient.rb', line 33

def print_time_entries(user = "me")
  entries = Time_entry.find(:all, :params => { :user_id => user, "limit" => 100})
  entries.each{|e| print "#{e.id} #{e.spent_on} #{e.hours} #{e.comments}\n"}
end