powncer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +22 -1
- data/lib/powncer/note.rb +1 -1
- data/lib/powncer/user.rb +21 -6
- data/lib/powncer/version.rb +1 -1
- data/test/examples/basic_examples.rb +13 -0
- data/test/unit/user_test.rb +6 -0
- metadata +1 -1
data/Rakefile
CHANGED
@@ -57,9 +57,22 @@ namespace :dist do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
Rake::GemPackageTask.new(spec) do |pkg|
|
60
|
-
|
60
|
+
pkg.need_tar = true
|
61
61
|
end
|
62
62
|
|
63
|
+
desc 'Install with gem'
|
64
|
+
task :install => :repackage do
|
65
|
+
sh "sudo gem i pkg/#{spec.name}-#{spec.version}.gem"
|
66
|
+
end
|
67
|
+
|
68
|
+
desc 'Uninstall gem'
|
69
|
+
task :uninstall do
|
70
|
+
sh "sudo gem uninstall #{spec.name} -x"
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'Reinstall gem'
|
74
|
+
task :reinstall => [:uninstall, :install]
|
75
|
+
|
63
76
|
package_name = lambda {|specification| File.join('pkg', "#{specification.name}-#{specification.version}")}
|
64
77
|
|
65
78
|
desc 'Push a release to rubyforge'
|
@@ -70,6 +83,14 @@ namespace :dist do
|
|
70
83
|
rubyforge = RubyForge.new
|
71
84
|
rubyforge.login
|
72
85
|
|
86
|
+
#version_already_released = lambda do
|
87
|
+
# releases = rubyforge.userconfig['release_ids']
|
88
|
+
# releases.has_key?(spec.name) && releases[spec.name][spec.version]
|
89
|
+
#end
|
90
|
+
#
|
91
|
+
#abort("Release #{spec.version} already exists!") if version_already_released.call
|
92
|
+
|
93
|
+
|
73
94
|
if release_id = rubyforge.add_release(spec.rubyforge_project, spec.name, spec.version, "#{package}.tgz")
|
74
95
|
rubyforge.add_file(spec.rubyforge_project, spec.name, release_id, "#{package}.gem")
|
75
96
|
else
|
data/lib/powncer/note.rb
CHANGED
data/lib/powncer/user.rb
CHANGED
@@ -21,25 +21,40 @@ module Powncer
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def friends
|
24
|
-
url = "/users/#{@_username}/friends.#{FORMAT}"
|
24
|
+
url = "/users/#{@_username || self.username}/friends.#{FORMAT}"
|
25
25
|
request(url)["friends"]["users"].collect!{|user| self.class.instantiate(user)}
|
26
26
|
end
|
27
27
|
|
28
28
|
def fans
|
29
|
-
url = "/users/#{@_username}/fans.#{FORMAT}"
|
30
|
-
request(url)["users"].collect!{|user| self.class.instantiate(user)}
|
29
|
+
url = "/users/#{@_username || self.username}/fans.#{FORMAT}"
|
30
|
+
users = request(url)["fans"]["users"].collect!{|user| self.class.instantiate(user)}
|
31
|
+
end
|
32
|
+
|
33
|
+
def fan_of
|
34
|
+
url = "/users/#{@_username || self.username}/fan_of.#{FORMAT}"
|
35
|
+
request(url)["fan_of"]["users"].collect!{|user| self.class.instantiate(user)}
|
31
36
|
end
|
32
37
|
|
33
38
|
def notes
|
34
|
-
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?filter=
|
39
|
+
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?filter=notes"
|
35
40
|
request(url)["notes"].collect!{|note| Note.instantiate(note)}
|
36
41
|
end
|
37
42
|
|
38
|
-
def
|
39
|
-
url = "/
|
43
|
+
def messages
|
44
|
+
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?type=messages"
|
40
45
|
request(url)["notes"].collect!{|note| Note.instantiate(note)}
|
41
46
|
end
|
42
47
|
|
48
|
+
def links
|
49
|
+
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?type=links"
|
50
|
+
request(url)["notes"].collect!{|note| Link.instantiate(note)}
|
51
|
+
end
|
52
|
+
|
53
|
+
def events
|
54
|
+
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?type=events"
|
55
|
+
request(url)["notes"].collect!{|note| Event.instantiate(note)}
|
56
|
+
end
|
57
|
+
|
43
58
|
def send_to
|
44
59
|
self.class.send_to
|
45
60
|
end
|
data/lib/powncer/version.rb
CHANGED
@@ -125,6 +125,19 @@ class Test::Unit::TestCase
|
|
125
125
|
JSON
|
126
126
|
end
|
127
127
|
|
128
|
+
def example_fans_for
|
129
|
+
<<-JSON
|
130
|
+
{
|
131
|
+
"fans": {
|
132
|
+
"total_count": 0,
|
133
|
+
"has_prev_page": false,
|
134
|
+
"users": [],
|
135
|
+
"has_next_page": false
|
136
|
+
}
|
137
|
+
}
|
138
|
+
JSON
|
139
|
+
end
|
140
|
+
|
128
141
|
def example_friends_for
|
129
142
|
<<-JSON
|
130
143
|
{
|
data/test/unit/user_test.rb
CHANGED
@@ -20,6 +20,12 @@ class UserTest < Test::Unit::TestCase
|
|
20
20
|
assert_kind_of Powncer::User, @user.friends[0]
|
21
21
|
end
|
22
22
|
|
23
|
+
def test_user_relationships_return_empty_when_empty
|
24
|
+
"/users/jaehess/fans.json".mock_connection(example_fans_for)
|
25
|
+
assert_not_nil @user.fans
|
26
|
+
assert_kind_of Array, @user.fans
|
27
|
+
end
|
28
|
+
|
23
29
|
def test_user_finder_and_load_profile
|
24
30
|
"/users/jaehess.json".mock_connection(example_profile_for)
|
25
31
|
user = User.find('jaehess')
|