freckle 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +34 -2
- data/lib/freckle.rb +4 -4
- data/test/fixtures/users.json +1 -1
- data/test/freckle_test.rb +5 -5
- metadata +3 -3
data/README.textile
CHANGED
@@ -6,16 +6,48 @@ Only supports reading data.
|
|
6
6
|
|
7
7
|
h2. Example
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
<pre>
|
10
|
+
Freckle.establish_connection( :account => "apitest",
|
11
|
+
:token => "lx3gi6pxdjtjn57afp8c2bv1me7g89j" )
|
11
12
|
|
12
13
|
project = Freckle::Project.all.first
|
14
|
+
user = Freckle::User.by_email("test@example.com")
|
15
|
+
|
16
|
+
# all project's entries
|
13
17
|
project.entries
|
14
18
|
|
19
|
+
# all project's entries for specific people
|
20
|
+
project.entries(:people => [user.id])
|
21
|
+
|
22
|
+
# user's entries for a time range
|
23
|
+
user.entries(:from => "2010-07-01", :to => "2010-07-30")
|
24
|
+
|
25
|
+
# user's unbillable entries
|
26
|
+
user.entries(:billable => false)
|
27
|
+
|
28
|
+
# entries matching search params for multiple people, projects, with tags,
|
29
|
+
# in a date range, and only billable
|
30
|
+
Freckle::Entry.all( :billable => true,
|
31
|
+
:people => [user.id, 5543],
|
32
|
+
:projects => [project.id, 8475],
|
33
|
+
:tags => ["foobar"],
|
34
|
+
:from => "2010-06-01",
|
35
|
+
:to => "2010-07-30")
|
36
|
+
</pre>
|
37
|
+
|
38
|
+
See http://github.com/madrobby/freckle-apidocs/blob/master/entries.mkdn for
|
39
|
+
available entries query parameters.
|
40
|
+
|
15
41
|
h2. TODO
|
16
42
|
|
17
43
|
* CRUD
|
18
44
|
|
45
|
+
h2. Contributors
|
46
|
+
|
47
|
+
Thanks to:
|
48
|
+
|
49
|
+
* Emily Price ("duien":http://github.com/duien)
|
50
|
+
|
19
51
|
h2. License
|
20
52
|
|
21
53
|
The MIT License
|
data/lib/freckle.rb
CHANGED
@@ -30,8 +30,8 @@ class Freckle
|
|
30
30
|
User.new(user['user'], self)
|
31
31
|
end
|
32
32
|
end
|
33
|
-
def
|
34
|
-
self.users.detect{ |u| u.
|
33
|
+
def user_by_email(email)
|
34
|
+
self.users.detect{ |u| u.email == email }
|
35
35
|
end
|
36
36
|
|
37
37
|
def projects(options = {})
|
@@ -85,8 +85,8 @@ class Freckle
|
|
85
85
|
def self.all(options = {})
|
86
86
|
super(:users, options)
|
87
87
|
end
|
88
|
-
def self.
|
89
|
-
Freckle.connection.
|
88
|
+
def self.by_email(email)
|
89
|
+
Freckle.connection.user_by_email(email)
|
90
90
|
end
|
91
91
|
def entries(options = {})
|
92
92
|
people = (options.delete(:people) || [])
|
data/test/fixtures/users.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
[
|
2
|
-
{"user":{"id":5538,"last_name":"Freckle","time_format":"fraction","
|
2
|
+
{"user":{"id":5538,"last_name":"Freckle","time_format":"fraction","first_name":"Lets","email":"apitestadmin@letsfreckle.com"}}
|
3
3
|
]
|
data/test/freckle_test.rb
CHANGED
@@ -27,13 +27,13 @@ class FreckleTest < Test::Unit::TestCase
|
|
27
27
|
assert !@connection.entries.empty?
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
assert_equal nil, @connection.
|
32
|
-
|
30
|
+
def test_user_by_email
|
31
|
+
assert_equal nil, @connection.user_by_email('test@example.com')
|
32
|
+
|
33
33
|
user = @connection.users.first
|
34
|
-
assert_equal user, @connection.
|
34
|
+
assert_equal user, @connection.user_by_email(user.email)
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
### Models
|
38
38
|
|
39
39
|
def test_users_return_user_model
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Todd
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-18 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|