dotime 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +6 -0
- data/lib/basecamp.rb +18 -9
- data/lib/do_time.rb +1 -1
- metadata +10 -7
data/History.txt
CHANGED
data/lib/basecamp.rb
CHANGED
@@ -23,7 +23,7 @@ end
|
|
23
23
|
# session = Basecamp.new('your.basecamp.com', 'username', 'password')
|
24
24
|
# puts "projects: #{session.projects.length}"
|
25
25
|
class Basecamp
|
26
|
-
|
26
|
+
|
27
27
|
# A wrapper to encapsulate the data returned by Basecamp, for easier access.
|
28
28
|
class Record #:nodoc:
|
29
29
|
attr_reader :type
|
@@ -36,7 +36,7 @@ class Basecamp
|
|
36
36
|
def [](name)
|
37
37
|
name = dashify(name)
|
38
38
|
case @hash[name]
|
39
|
-
when Hash then
|
39
|
+
when Hash then
|
40
40
|
@hash[name] = (@hash[name].keys.length == 1 && Array === @hash[name].values.first) ?
|
41
41
|
@hash[name].values.first.map { |v| Record.new(@hash[name].keys.first, v) } :
|
42
42
|
Record.new(name, @hash[name])
|
@@ -84,7 +84,7 @@ class Basecamp
|
|
84
84
|
# when to encode it as a simple field.
|
85
85
|
class FileUpload
|
86
86
|
attr_reader :filename, :content
|
87
|
-
|
87
|
+
|
88
88
|
def initialize(filename, content)
|
89
89
|
@filename = filename
|
90
90
|
@content = content
|
@@ -148,7 +148,7 @@ class Basecamp
|
|
148
148
|
url = "/projects/#{project_id}/msg"
|
149
149
|
url << "/cat/#{category_id}" if category_id
|
150
150
|
url << "/archive"
|
151
|
-
|
151
|
+
|
152
152
|
records "post", url
|
153
153
|
end
|
154
154
|
|
@@ -424,13 +424,22 @@ class Basecamp
|
|
424
424
|
when "date" then Date.parse(content)
|
425
425
|
else content
|
426
426
|
end
|
427
|
+
# a special case to work-around a bug in XmlSimple. When you have an empty
|
428
|
+
# tag that has an attribute, XmlSimple will not add the __content__ key
|
429
|
+
# to the returned hash. Thus, we check for the presense of the 'type'
|
430
|
+
# attribute to look for empty, typed tags, and simply return nil for
|
431
|
+
# their value.
|
432
|
+
elsif value.keys == %w(type)
|
433
|
+
nil
|
434
|
+
# another special case, introduced by the latest rails, where an array
|
435
|
+
# type now exists. This is parsed by XmlSimple as a two-key hash, where
|
436
|
+
# one key is 'type' and the other is the actual array value.
|
437
|
+
elsif value.keys.length == 2 && value["type"] == "array"
|
438
|
+
value.delete("type")
|
439
|
+
typecast_value(value)
|
427
440
|
else
|
428
441
|
value.empty? ? nil : value.inject({}) do |h,(k,v)|
|
429
|
-
|
430
|
-
h = nil
|
431
|
-
else
|
432
|
-
h[k] = typecast_value(v)
|
433
|
-
end
|
442
|
+
h[k] = typecast_value(v)
|
434
443
|
h
|
435
444
|
end
|
436
445
|
end
|
data/lib/do_time.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: dotime
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2007-07-24 00:00:00 +02:00
|
8
8
|
summary: Cheap time tracking for Basecamp todo lists
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -39,10 +39,13 @@ files:
|
|
39
39
|
- test/test_do_time.rb
|
40
40
|
test_files:
|
41
41
|
- test/test_do_time.rb
|
42
|
-
rdoc_options:
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
rdoc_options:
|
43
|
+
- --main
|
44
|
+
- README.txt
|
45
|
+
extra_rdoc_files:
|
46
|
+
- History.txt
|
47
|
+
- Manifest.txt
|
48
|
+
- README.txt
|
46
49
|
executables:
|
47
50
|
- dotime
|
48
51
|
extensions: []
|
@@ -75,5 +78,5 @@ dependencies:
|
|
75
78
|
requirements:
|
76
79
|
- - ">="
|
77
80
|
- !ruby/object:Gem::Version
|
78
|
-
version: 1.2.
|
81
|
+
version: 1.2.1
|
79
82
|
version:
|