Class: RubyDesk::Snapshot
- Inherits:
-
OdeskEntity
- Object
- OdeskEntity
- RubyDesk::Snapshot
- Defined in:
- lib/ruby_desk/snapshot.rb
Overview
<h2>Response Details</h2> <ul> <li><snapshot> <ul> <li>Snapshot detail container</li> </ul> </li> <li><status>PRIVATE</status>
<ul> <li>Status of the snapshot <ul> <li>LOGIN</li> <li>NORMAL</li> <li>PRIVATE</li> <li>EXIT</li> </ul> </li> </ul> </li> <li><time>1229521500</time>
<ul> <li>The GMT that the snapshot was taken</li> </ul> </li> <li><billing_status>non-billed.disconnected</billing_status> <ul> <li>A snapshot’s billing status <ul> <li>non-billed.disconnected</li> <li>billed.disconnected</li>
<li>billed.connected</li> </ul> </li> </ul> </li> <li><activity>0</activity></li> <li><online_presence></online_presence></li> <li><user> <ul> <li>The general user details associated with the current use</li>
</ul> </li> <li><mouse_events_count/> <ul> <li>The number of mouse events associated with this snapshot</li> </ul> </li> <li><company_id>agencyone</company_id> <ul> <li>Company ID associated with this snapshot</li>
</ul> </li> <li><timezone>America/Los_Angeles</timezone> <ul> <li>User’s time zone</li> </ul> </li> <li><uid/> <ul> <li>The user id</li> </ul>
</li> <li><keyboard_events_count/> <ul> <li>Number of keyboard events counted for this snapshot</li> </ul> </li> <li><last_worked> <ul> <li>The timestamp last worked <ul> <li>Format: [1240637782]</li>
</ul> </li> </ul> </li> <li><memo/> <ul> <li>Memo associated with the current time stamp</li> </ul> </li> <li><active_window_title/> <ul> <li>The title of the active window when the snapshot was taken</li> </ul>
</li> <li><report24_img> <ul> <li>URL to a graph that describes a users activitly over a 24hr period</li> </ul> </li> <li><computer_name/> <ul> <li>The name of the computer where the snapshot was taken</li> </ul> </li> <li><online_presence_img>
<ul> <li>URL for the default online user activity</li> </ul> </li> <li><user_id> <ul> <li>User id associated with the current snapshot</li> </ul> </li> <li><client_version/> <ul> <li>The oDesk Time Tracker version used to take the snapshot</li>
</ul> </li> <li><teamroom_api>/api/team/v1/teamrooms/agencyone.xml</teamroom_api> </li> <li><workdiary_api>/api/team/v1/workdiaries/agencyone/scoopwilson/20081217.xml</workdiary_api></li>
Class Method Summary collapse
-
.snapshot_details(connector, company_id, user_id, timestamp = nil) ⇒ Object
Retrieves details of one snapshot.
-
.work_diary(connector, company_id, user_id, date = nil, timezone = "mine") ⇒ Object
Retrieves work diary as an array of snapshots.
Methods inherited from OdeskEntity
Constructor Details
This class inherits a constructor from RubyDesk::OdeskEntity
Class Method Details
.snapshot_details(connector, company_id, user_id, timestamp = nil) ⇒ Object
Retrieves details of one snapshot
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/ruby_desk/snapshot.rb', line 150 def self.snapshot_details(connector, company_id, user_id, = nil) = case when String then when Date, Time then .strftime("%Y%m%d") when Range then [.first, .last].map{|t|t.strftime("%Y%m%d")}.join(",") when Array then .map{|t| t.strftime("%Y%m%d")}.join(";") end # Invoke API call json = connector.prepare_and_invoke_api_call( "team/v1/workdiaries/#{company_id}/#{user_id}" + ( ? "/#{}" : ""), :method=>:get) # Generate ruby objects for each snapshot [json['snapshot']].flatten.map do |snapshot| self.new(snapshot) end end |
.work_diary(connector, company_id, user_id, date = nil, timezone = "mine") ⇒ Object
Retrieves work diary as an array of snapshots. The Work Diary method retrieves all snapshots from a single user account within a single day. Keep in mind that a day is dependent on server time and not the day in which the query is made. Make sure to test with various locations before you’re done.
138 139 140 141 142 143 144 145 146 147 |
# File 'lib/ruby_desk/snapshot.rb', line 138 def self.work_diary(connector, company_id, user_id, date = nil, timezone = "mine") json = connector.prepare_and_invoke_api_call( "team/v1/workdiaries/#{company_id}/#{user_id}" + (date ? "/"+date : ""), :params=>{:timezone=>timezone}, :method=>:get) return nil unless json['snapshots']['snapshot'] [json['snapshots']['snapshot']].flatten.map do |snapshot| self.new(snapshot) end end |