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 CHANGED
@@ -57,9 +57,22 @@ namespace :dist do
57
57
  end
58
58
 
59
59
  Rake::GemPackageTask.new(spec) do |pkg|
60
- pkg.need_tar = true
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
@@ -14,7 +14,7 @@ module Powncer
14
14
 
15
15
  def recipients
16
16
  url = "/notes/#{self.id}/recipients.#{FORMAT}"
17
- request(url)["recipients"].collect!{|user| User.instantiate(user)}
17
+ request(url)["recipients"]["users"].collect!{|user| User.instantiate(user)}
18
18
  end
19
19
 
20
20
  def type
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=public"
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 links
39
- url = "/public_note_lists/for/#{@_username || self.username}.#{FORMAT}?type=links"
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
@@ -4,7 +4,7 @@ module Powncer # :stopdoc:
4
4
 
5
5
  MAJOR = '0'
6
6
  MINOR = '1'
7
- TINY = '0'
7
+ TINY = '1'
8
8
 
9
9
  API_URL = "http://api.pownce.com"
10
10
  API_VERSION = "2.0"
@@ -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
  {
@@ -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')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powncer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jae Hess