Class: Wowr::Classes::Character
- Inherits:
-
Object
- Object
- Wowr::Classes::Character
- Defined in:
- lib/wowr/classes.rb
Overview
Short character info, used in guild lists etc. Note that the way that searches and character listings within guilds works, there can be a variable amount of information filled in within the class. Guild listings and search results contain a smaller amount of information than single queries
Instance Attribute Summary collapse
-
#battle_group ⇒ Object
readonly
Returns the value of attribute battle_group.
-
#contribution ⇒ Object
readonly
Returns the value of attribute contribution.
-
#gender ⇒ Object
readonly
Returns the value of attribute gender.
-
#gender_id ⇒ Object
readonly
Returns the value of attribute gender_id.
-
#guild ⇒ Object
readonly
Returns the value of attribute guild.
-
#guild_id ⇒ Object
readonly
Returns the value of attribute guild_id.
-
#guild_url ⇒ Object
readonly
Returns the value of attribute guild_url.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#klass_id ⇒ Object
readonly
Returns the value of attribute klass_id.
-
#last_login ⇒ Object
readonly
Returns the value of attribute last_login.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#race ⇒ Object
readonly
Returns the value of attribute race.
-
#race_id ⇒ Object
readonly
Returns the value of attribute race_id.
-
#rank ⇒ Object
readonly
Returns the value of attribute rank.
-
#relevance ⇒ Object
readonly
Returns the value of attribute relevance.
-
#search_rank ⇒ Object
readonly
Returns the value of attribute search_rank.
-
#season_games_played ⇒ Object
readonly
Returns the value of attribute season_games_played.
-
#season_games_won ⇒ Object
readonly
Returns the value of attribute season_games_won.
-
#team_rank ⇒ Object
readonly
Returns the value of attribute team_rank.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(elem) ⇒ Character
constructor
A new instance of Character.
Constructor Details
#initialize(elem) ⇒ Character
Returns a new instance of Character.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/wowr/classes.rb', line 46 def initialize(elem) @name = elem[:name] @level = elem[:level].to_i @url = elem[:url] || elem[:charUrl] @rank = elem[:rank].to_i @klass = elem[:class] @klass_id = elem[:classId].to_i @gender = elem[:gender] @gender_id = elem[:genderId].to_i @race = elem[:race] @race_id = elem[:raceId].to_i @guild = elem[:guild] == "" ? nil : elem[:guild] @guild_id = elem[:guildId].to_i == 0 ? nil : elem[:guildId].to_i @guild_url = elem[:guildUrl] == "" ? nil : elem[:guildUrl] @battle_group = elem[:battleGroup] == "" ? nil : elem[:battleGroup] @battle_group_id = elem[:battleGroupId].to_i @relevance = elem[:relevance].to_i @search_rank = elem[:searchRank].to_i # Incoming string is 2007-02-24 20:33:04.0, parse to datetime #@last_login = elem[:lastLoginDate] == "" ? nil : DateTime.parse(elem[:lastLoginDate]) @last_login = elem[:lastLoginDate] == "" ? nil : elem[:lastLoginDate] # From ArenaTeam info, can be blank on normal requests #<character battleGroup="" charUrl="r=Draenor&n=Lothaar" class="Paladin" classId="2" # contribution="1602" gamesPlayed="10" gamesWon="7" gender="Male" genderId="0" # guild="Passion" guildId="36659" guildUrl="r=Draenor&n=Passion&p=1" name="Lothaar" # race="Human" raceId="1" seasonGamesPlayed="20" seasonGamesWon="13" teamRank="1"/> @season_games_played = elem[:seasonGamesPlayed] == "" ? nil : elem[:seasonGamesPlayed].to_i @season_games_won = elem[:seasonGamesWon] == "" ? nil : elem[:seasonGamesWon].to_i @team_rank = elem[:teamRank] == "" ? nil : elem[:teamRank].to_i @contribution = elem[:contribution] == "" ? nil : elem[:contribution].to_i #@char_url = elem[:charUrl] # TODO: Merge with URL? end |
Instance Attribute Details
#battle_group ⇒ Object (readonly)
Returns the value of attribute battle_group.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def battle_group @battle_group end |
#contribution ⇒ Object (readonly)
Returns the value of attribute contribution.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def contribution @contribution end |
#gender ⇒ Object (readonly)
Returns the value of attribute gender.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def gender @gender end |
#gender_id ⇒ Object (readonly)
Returns the value of attribute gender_id.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def gender_id @gender_id end |
#guild ⇒ Object (readonly)
Returns the value of attribute guild.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def guild @guild end |
#guild_id ⇒ Object (readonly)
Returns the value of attribute guild_id.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def guild_id @guild_id end |
#guild_url ⇒ Object (readonly)
Returns the value of attribute guild_url.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def guild_url @guild_url end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def klass @klass end |
#klass_id ⇒ Object (readonly)
Returns the value of attribute klass_id.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def klass_id @klass_id end |
#last_login ⇒ Object (readonly)
Returns the value of attribute last_login.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def last_login @last_login end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def level @level end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def name @name end |
#race ⇒ Object (readonly)
Returns the value of attribute race.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def race @race end |
#race_id ⇒ Object (readonly)
Returns the value of attribute race_id.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def race_id @race_id end |
#rank ⇒ Object (readonly)
Returns the value of attribute rank.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def rank @rank end |
#relevance ⇒ Object (readonly)
Returns the value of attribute relevance.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def relevance @relevance end |
#search_rank ⇒ Object (readonly)
Returns the value of attribute search_rank.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def search_rank @search_rank end |
#season_games_played ⇒ Object (readonly)
Returns the value of attribute season_games_played.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def season_games_played @season_games_played end |
#season_games_won ⇒ Object (readonly)
Returns the value of attribute season_games_won.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def season_games_won @season_games_won end |
#team_rank ⇒ Object (readonly)
Returns the value of attribute team_rank.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def team_rank @team_rank end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
36 37 38 |
# File 'lib/wowr/classes.rb', line 36 def url @url end |