slimtimer4r 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +18 -5
- data/lib/slimtimer4r.rb +19 -5
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,22 +1,35 @@
|
|
1
|
+
== 0.2.4 / 2009-02-17
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
* Added date/time sanitization to SlimTimer::Record
|
5
|
+
* You can now pass a custom timeout (in seconds) to the SlimTimer object to
|
6
|
+
bypass the default of 60 seconds (for most platforms).
|
7
|
+
* Thanks to Chris DeRose for these changes (http://www.derosetechnologies.com)
|
8
|
+
|
1
9
|
== 0.2.3 / 2009-02-10
|
2
10
|
|
3
|
-
|
11
|
+
Bug Fixes:
|
12
|
+
* Switched to slimtimer.com instead of www.slimtimer.com due to a 301 Moved Permanently error
|
4
13
|
|
5
14
|
== 0.2.2 / 2008-01-15
|
6
15
|
|
7
|
-
|
16
|
+
Bug Fixes:
|
17
|
+
* Fix the list_entries method to properly set the beginning time to midnight if a Date is passed in.
|
8
18
|
|
9
19
|
== 0.2.1 / 2008-01-10
|
10
20
|
|
11
|
-
|
21
|
+
Bug Fixes:
|
12
22
|
* Update list_timeentries method to automatically append a Time of 23:59:59 to the ending range if a Date object was passed in.
|
13
23
|
|
24
|
+
Enhancements:
|
25
|
+
* RDoc enhancements
|
26
|
+
|
14
27
|
== 0.2.0 / 2008-01-09
|
15
28
|
|
16
|
-
|
29
|
+
Enhancements:
|
17
30
|
* Not-so-ugly code thanks to borrowing from the 37 Signals / Basecamp sample Ruby wrappers
|
18
31
|
|
19
32
|
== 0.1.0 / Sometime back in 2006...
|
20
33
|
|
21
|
-
* Lots of UGLY code
|
34
|
+
* Initial release - Lots of UGLY code
|
22
35
|
|
data/lib/slimtimer4r.rb
CHANGED
@@ -2,7 +2,7 @@ require 'yaml'
|
|
2
2
|
require 'net/http'
|
3
3
|
|
4
4
|
class SlimTimer
|
5
|
-
VERSION = '0.2.
|
5
|
+
VERSION = '0.2.4'
|
6
6
|
|
7
7
|
#
|
8
8
|
# The Record class is used to encapsulate the data returned from the SlimTimer API. This allows access
|
@@ -55,25 +55,38 @@ class SlimTimer
|
|
55
55
|
to_s
|
56
56
|
end
|
57
57
|
|
58
|
+
def updated_at
|
59
|
+
sanitize_time(super)
|
60
|
+
end
|
61
|
+
|
62
|
+
def created_at
|
63
|
+
sanitize_time(super)
|
64
|
+
end
|
65
|
+
|
58
66
|
private
|
59
67
|
|
60
68
|
def dashify(name)
|
61
69
|
name.to_s.tr("_","-")
|
62
70
|
end
|
71
|
+
|
72
|
+
def sanitize_time
|
73
|
+
Time.local(time.year, time.month, time.day, time.hour, time.min, time.sec) unless time.nil?
|
74
|
+
end
|
75
|
+
|
63
76
|
end
|
64
77
|
|
65
78
|
attr_accessor :email, :password, :api_key, :user_id, :access_token, :request
|
66
79
|
|
67
|
-
# Creates a new SlimTimer object and obtains the +access_token+ and +user_id+ from the SlimTimer API by sending your +email+, +password+, and +api_key+. Raises a _RuntimeError_ if it can't authenticate.
|
80
|
+
# Creates a new SlimTimer object and obtains the +access_token+ and +user_id+ from the SlimTimer API by sending your +email+, +password+, and +api_key+. Raises a _RuntimeError_ if it can't authenticate. You can also optionally supply a +connection_timeout+ for the SlimTimer servers (the default is 60 seconds).
|
68
81
|
#
|
69
82
|
# slim_timer = SlimTimer.new("person@example.com", "password", "12345")
|
70
83
|
# => #<SlimTimer:0x68bca8 @password="password"...>
|
71
84
|
#
|
72
85
|
# slim_timer = SlimTimer.new("bademail@example.com", "badpassword", "12345")
|
73
86
|
# => RuntimeError: Error occurred (500)
|
74
|
-
def initialize(email, password, api_key)
|
87
|
+
def initialize(email, password, api_key, connection_timeout=60)
|
75
88
|
@email, @password, @api_key = email, password, api_key
|
76
|
-
connect
|
89
|
+
connect(connection_timeout)
|
77
90
|
get_token
|
78
91
|
end
|
79
92
|
|
@@ -189,8 +202,9 @@ class SlimTimer
|
|
189
202
|
@user_id = values.user_id
|
190
203
|
end
|
191
204
|
|
192
|
-
def connect
|
205
|
+
def connect(connection_timeout)
|
193
206
|
@connection = Net::HTTP.new("slimtimer.com", 80)
|
207
|
+
@connection.read_timeout = connection_timeout
|
194
208
|
end
|
195
209
|
|
196
210
|
def request(method, path, parameters = {}, type="Result")
|
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.4
|
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: 2009-02-
|
12
|
+
date: 2009-02-17 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|