Sorry, I sent an empty file, here's the patch, inline:
diff --git a/lib/Games/WoW/Armory.pm b/lib/Games/WoW/Armory.pm
index b442b49..db5c75c 100644
--- a/lib/Games/WoW/Armory.pm
+++ b/lib/Games/WoW/Armory.pm
@@ -341,7 +341,7 @@ sub get_arena_teams {
# than one team. The following logic tries to figure this out:
my @teams = ( exists $$arena_team{name} )
? ( $arena_team )
- : map { $$arena_team{$_} } keys %{$arena_team};
+ : map +{ %{$arena_team->{$_}}, name=>$_ }, (keys %{$arena_team});
my @team_objs;
foreach my $team ( @teams ){
@@ -359,6 +359,9 @@ sub get_arena_teams {
my @members;
my $members = $$team{members}{character};
+
+ if (defined $members->{name} ) { my %hash = %$members ; delete $hash{name}; $members = { $members->{name} => \%hash } };
+
foreach my $member (keys %{$members}){
my $m = Games::WoW::Armory::Character->new;
$m->name($member);
@@ -397,13 +400,13 @@ sub search_guild {
);
$self->guild( Games::WoW::Armory::Guild->new );
- my $guild = $self->{ data }{ guildInfo }{ guild };
+ my $guild = $self->{ data }{ guildInfo };
my $members
= $self->{ data }{ guildInfo }{ guild }{ members }{ character };
- $self->guild->name( $$guild{ name } );
- $self->guild->battleGroup( $$guild{ battleGroup } );
- $self->guild->realm( $$guild{ realm } );
+ $self->guild->name( $$guild{ guildHeader }{ name } );
+ $self->guild->battleGroup( $$guild{ guildHeader }{ battleGroup } );
+ $self->guild->realm( $$guild{ guildHeader }{ realm } );
my @members;
foreach my $member ( keys %{ $members } ) {
diff --git a/t/01.armory.t b/t/01.armory.t
index aef8baf..74b8712 100644
--- a/t/01.armory.t
+++ b/t/01.armory.t
@@ -11,10 +11,10 @@ can_ok('Games::WoW::Armory', 'search_character');
can_ok('Games::WoW::Armory', 'search_guild');
my $char = Games::WoW::Armory->new();
-$char->search_character({realm => "Elune", character => "Aarnn", country => "EU"});
-is ($char->character->{name}, "Aarnn", "Character name ok");
-is ($char->character->name, "Aarnn", "New character name ok");
-is ($char->character->level, 70, "New characterlevel ok");
+$char->search_character({realm => "Elune", character => "Astelian", country => "EU"});
+is ($char->character->{name}, "Astelian", "Character name ok");
+is ($char->character->name, "Astelian", "New character name ok");
+is ($char->character->level, 80, "New characterlevel ok");
isa_ok ($char->character->reputation, 'HASH', 'Reputation' );
isa_ok ($char->character->arenaTeams, 'ARRAY', 'Arena Teams');
@@ -22,11 +22,11 @@ my $guild = Games::WoW::Armory->new();
$guild->search_guild({realm => "Elune", guild => "Cercle+De+L+Anneau+Rond", country => "EU"});
is ($guild->guild->name, "Cercle De L Anneau Rond", "Guild name");
is ($guild->guild->realm, "Elune", "Realm name");
-is ($guild->guild->battleGroup, "Cataclysme", "Battlegroup name");
+is ($guild->guild->battleGroup, "Cataclysme / Cataclysm", "Battlegroup name");
my $arena = Games::WoW::Armory->new();
-$arena->search_team({team => 'prouteam', ts => 2, country => 'EU', realm => 'Elune'});
-is ($arena->team->name, 'prouteam', 'Team name');
+$arena->search_team({team => 'Ne me kitte pas', ts => 2, country => 'EU', realm => 'Elune'});
+is ($arena->team->name, 'Ne me kitte pas', 'Team name');
is ($arena->team->size, 2, 'Team Size');
-is ($arena->team->battleGroup, 'Cataclysme', 'Battlegroup name');
+is ($arena->team->battleGroup, 'Cataclysme / Cataclysm', 'Battlegroup name');
is ($arena->team->realm, 'Elune', 'Realm name');