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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df15d0eaa7fcc66f1f60cc4069cfbbc4361b4aa5
4
- data.tar.gz: f9df13bf66454b3202c57782801960ffeafda509
3
+ metadata.gz: 258762c37a0daa100b49faaef32473c461c8d3c2
4
+ data.tar.gz: d7b576074fc571437ae60bb523f38efb8f1cfd62
5
5
  SHA512:
6
- metadata.gz: f1e213d50a56c88b4920ab6269cb6c9ed2c487d167a869dc941594e8af09bebde6b6fab9eba3824a6391eadc82cffa1593a0f7fca6ef282774c2ce8894698e30
7
- data.tar.gz: 96a74bb7b94331c1d717aa2a3e50ee8646c30c6f1c7e087395ca865070e96dc450a5c9d2d47a45984a5c854dd31b4866ebb7e068b168c7771b36f93e3e8f48c3
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module WotXboxApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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