wot_xbox_api 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wot_xbox_api/clan.rb +29 -0
- data/lib/wot_xbox_api/client.rb +3 -3
- data/lib/wot_xbox_api/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 258762c37a0daa100b49faaef32473c461c8d3c2
|
4
|
+
data.tar.gz: d7b576074fc571437ae60bb523f38efb8f1cfd62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebb95d0ad9aee921d77a66fa2ce07c60eddfca00acf37399335c65cee27e37eefae729938d56a3eeee96c5527d3a62f3582dcdf417e03e8f21638198ce635ad5
|
7
|
+
data.tar.gz: ffee2931b9460e787d2df31a326355aaca3fe54369605d7aca25165c9d866ba7d574f6352ac38b23eb8532d59e803fc800270e5cd115dcd657100aa934387119
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module WotXboxApi
|
2
|
+
class Clan
|
3
|
+
|
4
|
+
DATA_ID_XPATH = "//div[@class='clans_list-box']/table/tr/@data-id"
|
5
|
+
|
6
|
+
attr_accessor :clan_tag, :members, :member_ids
|
7
|
+
|
8
|
+
def initialize(clan_tag, retrieve_members, document)
|
9
|
+
self.clan_tag = clan_tag
|
10
|
+
if retrieve_members
|
11
|
+
load_players(document)
|
12
|
+
else
|
13
|
+
load_player_ids(document)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def load_player_ids(document)
|
18
|
+
self.member_ids = document.xpath(DATA_ID_XPATH).collect do |player_id|
|
19
|
+
player_id.value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_players(document)
|
24
|
+
self.members = document.xpath(DATA_ID_XPATH).collect do |player_id|
|
25
|
+
WotXboxApi::Client.player_stats(player_id.value)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/wot_xbox_api/client.rb
CHANGED
@@ -26,11 +26,11 @@ module WotXboxApi
|
|
26
26
|
))
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.clan_stats(clan_tag)
|
30
|
-
WotXboxApi::Clan.new(clan_tag, Nokogiri::HTML(
|
29
|
+
def self.clan_stats(clan_tag, retrieve_members=false)
|
30
|
+
WotXboxApi::Clan.new(clan_tag, retrieve_members, Nokogiri::HTML(
|
31
31
|
get("/en/clans/xbox/#{clan_tag}").body
|
32
32
|
))
|
33
|
-
end
|
33
|
+
end
|
34
34
|
|
35
35
|
def player_search
|
36
36
|
#todo
|
data/lib/wot_xbox_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wot_xbox_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Calvert
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- bin/setup
|
154
154
|
- lib/wot_xbox_api.rb
|
155
155
|
- lib/wot_xbox_api/call_failed_exception.rb
|
156
|
+
- lib/wot_xbox_api/clan.rb
|
156
157
|
- lib/wot_xbox_api/client.rb
|
157
158
|
- lib/wot_xbox_api/leaderboard.rb
|
158
159
|
- lib/wot_xbox_api/player_stats.rb
|