Permalink
Browse files

add support for private.timetracker.search API method

  • Loading branch information...
1 parent 79210da commit 2e00031f14fac7a8fa613330ab85e317035f16e2 @jnewland committed May 25, 2010
Showing with 41 additions and 1 deletion.
  1. +0 −1 TODO
  2. +4 −0 lib/help_spot.rb
  3. +29 −0 spec/fixtures/private.timetracker.search.xml
  4. +8 −0 spec/help_spot_spec.rb
View
1 TODO
@@ -8,7 +8,6 @@ private.request.getTimeEvents
private.request.getMailboxes
private.request.merge
private.filter.getColumnNames
-private.timetracker.search
private.user.getFilters
private.user.preferences
private.util.getActiveStaff
View
@@ -58,6 +58,10 @@ def filter(id, options = {})
api_request(:get, 'private.filter.get', options.merge(:xFilter => id), {:collection => 'filter', :item => 'request'})
end
+ def search_time_events(options = {})
+ api_request(:get, 'private.timetracker.search', options, {:collection => 'time_events', :item => 'event'})
+ end
+
private
def api_request(http_method, method, options = {}, munge_options = {})
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<time_events>
+ <event>
+ <xTimeId>4502</xTimeId>
+ <xRequest>12481</xRequest>
+ <xPerson>Ian Landsman</xPerson>
+ <iSeconds>5400</iSeconds>
+ <dtGMTDate>June 9, 2008</dtGMTDate>
+ <dtGMTDateAdded>June 9 2008, 11:48 AM</dtGMTDateAdded>
+ <tDescription>Fixed 3rd floor network printer</tDescription>
+ <sUserId>76548</sUserId>
+ <sFirstName>Ian</sFirstName>
+ <sLastName>Landsman</sLastName>
+ <sEmail>ian@userscape.com</sEmail>
+ </event>
+ <event>
+ <xTimeId>4503</xTimeId>
+ <xRequest>12481</xRequest>
+ <xPerson>Ian Landsman</xPerson>
+ <iSeconds>5400</iSeconds>
+ <dtGMTDate>June 9, 2008</dtGMTDate>
+ <dtGMTDateAdded>June 9 2008, 11:49 AM</dtGMTDateAdded>
+ <tDescription>Fixed 4th floor network printer</tDescription>
+ <sUserId>76548</sUserId>
+ <sFirstName>Ian</sFirstName>
+ <sLastName>Landsman</sLastName>
+ <sEmail>ian@userscape.com</sEmail>
+ </event>
+</time_events>
View
@@ -84,4 +84,12 @@
requests.first.tNote.should == 'I would like to be able to upload documents over 1 gigabyte.'
end
end
+ describe 'time tracking events' do
+ it "can be searched" do
+ @help_spot.stub_get('/api/index.php?method=private.timetracker.search&start_time=1', 'private.timetracker.search.xml')
+ time_events = @help_spot.search_time_events(:start_time => 1)
+ time_events.size.should == 2
+ time_events.first.iSeconds.should == "5400"
+ end
+ end
end

0 comments on commit 2e00031

Please sign in to comment.