slimtimer4r 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/slimtimer4r.rb +22 -5
- metadata +2 -2
data/History.txt
CHANGED
data/lib/slimtimer4r.rb
CHANGED
@@ -2,10 +2,12 @@ require 'yaml'
|
|
2
2
|
require 'net/http'
|
3
3
|
|
4
4
|
class SlimTimer
|
5
|
-
VERSION = '0.2.
|
5
|
+
VERSION = '0.2.1'
|
6
6
|
|
7
7
|
#
|
8
|
-
# The Record class is used to encapsulate the data returned from the SlimTimer API
|
8
|
+
# The Record class is used to encapsulate the data returned from the SlimTimer API. This allows access
|
9
|
+
# to hash key/value pairs using the @entry.task.name format rather than @entry["task"]["name"].
|
10
|
+
#
|
9
11
|
class Record
|
10
12
|
attr_reader :type, :hash
|
11
13
|
|
@@ -75,7 +77,7 @@ class SlimTimer
|
|
75
77
|
get_token
|
76
78
|
end
|
77
79
|
|
78
|
-
# Returns
|
80
|
+
# Returns an array of Record objects, each representing a task. Returns an empty array if nothing is found.
|
79
81
|
#
|
80
82
|
# Options:
|
81
83
|
# <tt>show_completed</tt>:: Include completed tasks. Specify +only+ to only include the completed tasks. Valid options are +yes+, +no+, and +only+. Default is +yes+.
|
@@ -84,7 +86,7 @@ class SlimTimer
|
|
84
86
|
request("get", "#{@user_id}/tasks?api_key=#{@api_key}&access_token=#{@access_token}&show_completed=#{show_completed}&role=#{role}", "Tasks")
|
85
87
|
end
|
86
88
|
|
87
|
-
# Returns a specific task. Returns _nil_ if the record is not found.
|
89
|
+
# Returns a specific task as a Record object. Returns _nil_ if the record is not found.
|
88
90
|
#
|
89
91
|
# Options:
|
90
92
|
# <tt>task_id</tt>:: The id of the task you would like to retrieve.
|
@@ -104,9 +106,24 @@ class SlimTimer
|
|
104
106
|
request("put", "#{@user_id}/tasks/#{task_id}", {"access_token" => @access_token, "api_key" => @api_key, "task" => {"name" => name, "tags" => tags, "coworker_emails" => coworker_emails, "reporter_emails" => reporter_emails, "completed_on" => completed_on}}, "Task")
|
105
107
|
end
|
106
108
|
|
109
|
+
# Returns an array of Record objects, each representing a time entry. Returns an empty array if nothing is found.
|
110
|
+
#
|
111
|
+
# Options:
|
112
|
+
# <tt>range_start</tt>:: Only include entries after this time. Takes either a Date
|
113
|
+
# or Time object as a parameter. If a Date object is used,
|
114
|
+
# it will append a time of 00:00:00 to the request. Default
|
115
|
+
# is +nil+, meaning there is no start range.
|
116
|
+
# <tt>range_end </tt>:: Only include entries before this time. Takes either a Date
|
117
|
+
# or Time object as a parameter. If a Date object is used,
|
118
|
+
# it will append a time of 23:59:59 to the request. Default
|
119
|
+
# is +nil+, meaning there is no end range.
|
107
120
|
def list_timeentries(range_start=nil, range_end=nil)
|
108
121
|
range_start = range_start.strftime("%Y-%m-%dT%H:%M:%SZ") unless range_start.nil?
|
109
|
-
|
122
|
+
if range_end.is_a?(Date)
|
123
|
+
range_end = range_end.strftime("%Y-%m-%dT23:59:59Z")
|
124
|
+
else
|
125
|
+
range_end = range_end.strftime("%Y-%m-%dT%H:%M:%SZ") unless range_end.nil?
|
126
|
+
end
|
110
127
|
request("get", "#{@user_id}/time_entries?api_key=#{@api_key}&access_token=#{@access_token}&range_start=#{range_start}&range_end=#{range_end}", "TimeEntries")
|
111
128
|
end
|
112
129
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slimtimer4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Markow
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-01-
|
12
|
+
date: 2008-01-10 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|