sc2ranks 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -8
- data/VERSION +1 -1
- data/lib/sc2ranks/character.rb +6 -2
- data/sc2ranks.gemspec +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -38,7 +38,7 @@ This is what I've decided to use on my site in order for a user to point us to
|
|
38
38
|
their character. Sc2ranks isn't able to get character code information for new
|
39
39
|
users anymore so they have advised API users to not use character code. The
|
40
40
|
other way to look up a user is by battle.net id but I feel it's much easier for
|
41
|
-
a user to just copy their url instead of having them locate the id
|
41
|
+
a user to just copy their url instead of having them locate the id.
|
42
42
|
|
43
43
|
== Portrait Data
|
44
44
|
|
@@ -60,20 +60,20 @@ object
|
|
60
60
|
Bracket can be 1 through 4. The is_random parameter defaults to false so you
|
61
61
|
don't need to use it. Team data does not include team members yet.
|
62
62
|
|
63
|
-
If you call
|
64
|
-
|
63
|
+
If you call method with a 1 or is_random set to true then you get a single team
|
64
|
+
or nil if no team exists.
|
65
65
|
|
66
|
-
If you call
|
67
|
-
there are none.)
|
66
|
+
If you call this with 2, 3 or 4 and is_random set to false, you get an array of
|
67
|
+
teams (or [] if there are none.)
|
68
68
|
|
69
69
|
# Get 1v1 team
|
70
|
-
team = character.team(1)
|
70
|
+
team = character.team(1) # single team object or nil
|
71
71
|
|
72
72
|
# Get 2v2 random team
|
73
|
-
team = character.team(2, true)
|
73
|
+
team = character.team(2, true) # single team object or nil
|
74
74
|
|
75
75
|
# Get 4v4 teams
|
76
|
-
|
76
|
+
teams = character.team(4) # array of teams or []
|
77
77
|
|
78
78
|
Once you get the team you can use the following methods to reach the data.
|
79
79
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/sc2ranks/character.rb
CHANGED
@@ -27,10 +27,14 @@ class Sc2ranks
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
# Look up a team via bracket number and is_random setting. If you are trying
|
31
|
+
# to find the user's 1v1 team or a random team this will return the Team
|
32
|
+
# object or nil. If you are looking for 2's, 3's or 4's this will return an
|
33
|
+
# array of teams (or an empty array if their are none).
|
30
34
|
def team(bracket, is_random = false)
|
31
|
-
if bracket == 1
|
35
|
+
if bracket == 1 or is_random
|
32
36
|
@teams.detect do |team|
|
33
|
-
team.bracket ==
|
37
|
+
team.bracket == bracket and team.is_random == is_random
|
34
38
|
end
|
35
39
|
else
|
36
40
|
@teams.select do |team|
|
data/sc2ranks.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sc2ranks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christopher Giroir
|