swish 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +10 -0
- data/VERSION +1 -1
- data/lib/dribbble/player.rb +14 -2
- data/swish.gemspec +2 -2
- data/test/player_test.rb +39 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -53,6 +53,8 @@ Not playing in the Ruby league? Here are the others we know of so far:
|
|
53
53
|
player.avatar_url
|
54
54
|
player.url
|
55
55
|
player.location
|
56
|
+
player.twitter_screen_name
|
57
|
+
player.drafted_by_player_id
|
56
58
|
|
57
59
|
# Player stats
|
58
60
|
player.shots_count
|
@@ -68,6 +70,14 @@ Not playing in the Ruby league? Here are the others we know of so far:
|
|
68
70
|
player.shots_following
|
69
71
|
player.shots_following(:page => 5, :per_page => 30)
|
70
72
|
|
73
|
+
# List a player's draftees
|
74
|
+
player.draftees
|
75
|
+
|
76
|
+
# List a player's followers
|
77
|
+
player.followers
|
78
|
+
|
79
|
+
# List the players who a player is following
|
80
|
+
player.following
|
71
81
|
|
72
82
|
|
73
83
|
== Note on Patches/Pull Requests
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/dribbble/player.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Dribbble
|
2
2
|
class Player < Base
|
3
|
-
attr_accessor :id, :name, :url, :avatar_url, :location,
|
3
|
+
attr_accessor :id, :name, :url, :avatar_url, :location, :twitter_screen_name, :drafted_by_player_id,
|
4
4
|
:shots_count, :draftees_count, :followers_count, :following_count
|
5
5
|
|
6
6
|
def self.find(id)
|
@@ -17,5 +17,17 @@ module Dribbble
|
|
17
17
|
def shots_following(options={})
|
18
18
|
Shot.paginated_list(self.class.get("/players/#{@id}/shots/following", :query => options))
|
19
19
|
end
|
20
|
+
|
21
|
+
def draftees(options={})
|
22
|
+
Player.paginated_list(self.class.get("/players/#{@id}/draftees", :query => options), 'players')
|
23
|
+
end
|
24
|
+
|
25
|
+
def followers(options={})
|
26
|
+
Player.paginated_list(self.class.get("/players/#{@id}/followers", :query => options), 'players')
|
27
|
+
end
|
28
|
+
|
29
|
+
def following(options={})
|
30
|
+
Player.paginated_list(self.class.get("/players/#{@id}/following", :query => options), 'players')
|
31
|
+
end
|
20
32
|
end
|
21
|
-
end
|
33
|
+
end
|
data/swish.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{swish}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeremy Weiskotten"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-09}
|
13
13
|
s.description = %q{A Ruby wrapper for the Dribbble API}
|
14
14
|
s.email = %q{jeremy@weiskotten.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/player_test.rb
CHANGED
@@ -8,6 +8,8 @@ class PlayerTest < Test::Unit::TestCase
|
|
8
8
|
assert_equal 'http://dribbble.com/players/simplebits', player.url
|
9
9
|
assert_equal 'Salem, MA', player.location
|
10
10
|
assert_not_nil player.created_at
|
11
|
+
assert_equal 'simplebits', player.twitter_screen_name
|
12
|
+
assert_nil player.drafted_by_player_id # no one drafted Dan
|
11
13
|
|
12
14
|
assert_kind_of Numeric, player.shots_count
|
13
15
|
assert_kind_of Numeric, player.draftees_count
|
@@ -48,4 +50,40 @@ class PlayerTest < Test::Unit::TestCase
|
|
48
50
|
assert_not_equal player, shot.player
|
49
51
|
end
|
50
52
|
end
|
51
|
-
|
53
|
+
|
54
|
+
def test_draftees
|
55
|
+
player = Dribbble::Player.find(1)
|
56
|
+
draftees = player.draftees
|
57
|
+
assert_equal 15, draftees.size, "default page size"
|
58
|
+
draftees.each do |draftee|
|
59
|
+
assert_kind_of Dribbble::Player, draftee
|
60
|
+
end
|
61
|
+
|
62
|
+
draftees = player.draftees(:per_page => 2)
|
63
|
+
assert_equal 2, draftees.size
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_followers
|
67
|
+
player = Dribbble::Player.find(1)
|
68
|
+
followers = player.followers
|
69
|
+
assert_equal 15, followers.size, "default page size"
|
70
|
+
followers.each do |follower|
|
71
|
+
assert_kind_of Dribbble::Player, follower
|
72
|
+
end
|
73
|
+
|
74
|
+
followers = player.followers(:per_page => 2)
|
75
|
+
assert_equal 2, followers.size
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_following
|
79
|
+
player = Dribbble::Player.find(1)
|
80
|
+
following = player.following
|
81
|
+
assert_equal 15, following.size, "default page size"
|
82
|
+
following.each do |following|
|
83
|
+
assert_kind_of Dribbble::Player, following
|
84
|
+
end
|
85
|
+
|
86
|
+
following = player.following(:per_page => 2)
|
87
|
+
assert_equal 2, following.size
|
88
|
+
end
|
89
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy Weiskotten
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-09 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|