Class: HaloWaypoint::Player

Inherits:
Resource show all
Defined in:
lib/halo_waypoint/player.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Resource

#assign_attributes, #initialize, string_to_key

Constructor Details

This class inherits a constructor from HaloWaypoint::Resource

Instance Attribute Details

#background_image_urlObject (readonly)

Returns the value of attribute background_image_url.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def background_image_url
  @background_image_url
end

#emblem_image_urlObject (readonly)

Returns the value of attribute emblem_image_url.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def emblem_image_url
  @emblem_image_url
end

#favorite_weapon_descriptionObject (readonly)

Returns the value of attribute favorite_weapon_description.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def favorite_weapon_description
  @favorite_weapon_description
end

#favorite_weapon_idObject (readonly)

Returns the value of attribute favorite_weapon_id.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def favorite_weapon_id
  @favorite_weapon_id
end

#favorite_weapon_image_urlObject (readonly)

Returns the value of attribute favorite_weapon_image_url.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def favorite_weapon_image_url
  @favorite_weapon_image_url
end

#favorite_weapon_nameObject (readonly)

Returns the value of attribute favorite_weapon_name.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def favorite_weapon_name
  @favorite_weapon_name
end

#favorite_weapon_total_killsObject (readonly)

Returns the value of attribute favorite_weapon_total_kills.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def favorite_weapon_total_kills
  @favorite_weapon_total_kills
end

#game_modesObject (readonly)

Returns the value of attribute game_modes.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def game_modes
  @game_modes
end

#gamertagObject (readonly)

Returns the value of attribute gamertag.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def gamertag
  @gamertag
end

#next_rank_idObject (readonly)

Returns the value of attribute next_rank_id.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def next_rank_id
  @next_rank_id
end

#next_rank_image_urlObject (readonly)

Returns the value of attribute next_rank_image_url.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def next_rank_image_url
  @next_rank_image_url
end

#next_rank_nameObject (readonly)

Returns the value of attribute next_rank_name.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def next_rank_name
  @next_rank_name
end

#next_rank_start_xpObject (readonly)

Returns the value of attribute next_rank_start_xp.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def next_rank_start_xp
  @next_rank_start_xp
end

#rank_idObject (readonly)

Returns the value of attribute rank_id.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def rank_id
  @rank_id
end

#rank_image_urlObject (readonly)

Returns the value of attribute rank_image_url.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def rank_image_url
  @rank_image_url
end

#rank_nameObject (readonly)

Returns the value of attribute rank_name.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def rank_name
  @rank_name
end

#rank_start_xpObject (readonly)

Returns the value of attribute rank_start_xp.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def rank_start_xp
  @rank_start_xp
end

#service_tagObject (readonly)

Returns the value of attribute service_tag.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def service_tag
  @service_tag
end

#specializationsObject (readonly)

Returns the value of attribute specializations.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def specializations
  @specializations
end

#top_medalsObject (readonly)

Returns the value of attribute top_medals.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def top_medals
  @top_medals
end

#top_skill_rankObject (readonly)

Returns the value of attribute top_skill_rank.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def top_skill_rank
  @top_skill_rank
end

#xpObject (readonly)

Returns the value of attribute xp.



3
4
5
# File 'lib/halo_waypoint/player.rb', line 3

def xp
  @xp
end

Class Method Details

.find(gamertag, game = 'h4') ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/halo_waypoint/player.rb', line 10

def find(gamertag, game = 'h4')
  response = HaloWaypoint.get(URI.escape("/en-us/players/#{gamertag}/#{game}/playercard"))
  data = response.parsed_response
  if data['PlayerCardResponse'] && data['PlayerCardResponse']['StatusCode'] == '1'
    new(data['PlayerCardResponse'])
  else
    raise 'Player Not Found'
  end
end