Class: MetaNexus::Wow::Character
- Inherits:
-
MetaNexus::Wow
- Object
- Api
- MetaNexus::Wow
- MetaNexus::Wow::Character
- Defined in:
- lib/meta_nexus/wow/character.rb
Constant Summary collapse
- FIELDS =
%i(achievements appearance feed guild hunter_pets items mounts pets pet_slots progression pvp quests reputation stats talents titles audit).freeze
Instance Attribute Summary collapse
-
#achievements ⇒ Object
Returns the value of attribute achievements.
-
#appearance ⇒ Object
Returns the value of attribute appearance.
-
#audit ⇒ Object
Returns the value of attribute audit.
-
#feed ⇒ Object
Returns the value of attribute feed.
-
#guild ⇒ Object
Returns the value of attribute guild.
-
#hunter_pets ⇒ Object
Returns the value of attribute hunter_pets.
-
#items ⇒ Object
Returns the value of attribute items.
-
#mounts ⇒ Object
Returns the value of attribute mounts.
-
#pet_slots ⇒ Object
Returns the value of attribute pet_slots.
-
#pets ⇒ Object
Returns the value of attribute pets.
-
#progression ⇒ Object
Returns the value of attribute progression.
-
#pvp ⇒ Object
Returns the value of attribute pvp.
-
#quests ⇒ Object
Returns the value of attribute quests.
-
#reputation ⇒ Object
Returns the value of attribute reputation.
-
#stats ⇒ Object
Returns the value of attribute stats.
-
#talents ⇒ Object
Returns the value of attribute talents.
-
#titles ⇒ Object
Returns the value of attribute titles.
Class Method Summary collapse
-
.find(args) ⇒ Object
Find Character in Battle.net WoW Api Required arguments: realm - character realm name - character name.
Methods inherited from MetaNexus::Wow
Methods inherited from Api
Instance Attribute Details
#achievements ⇒ Object
Returns the value of attribute achievements.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def achievements @achievements end |
#appearance ⇒ Object
Returns the value of attribute appearance.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def appearance @appearance end |
#audit ⇒ Object
Returns the value of attribute audit.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def audit @audit end |
#feed ⇒ Object
Returns the value of attribute feed.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def feed @feed end |
#guild ⇒ Object
Returns the value of attribute guild.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def guild @guild end |
#hunter_pets ⇒ Object
Returns the value of attribute hunter_pets.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def hunter_pets @hunter_pets end |
#items ⇒ Object
Returns the value of attribute items.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def items @items end |
#mounts ⇒ Object
Returns the value of attribute mounts.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def mounts @mounts end |
#pet_slots ⇒ Object
Returns the value of attribute pet_slots.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def pet_slots @pet_slots end |
#pets ⇒ Object
Returns the value of attribute pets.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def pets @pets end |
#progression ⇒ Object
Returns the value of attribute progression.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def progression @progression end |
#pvp ⇒ Object
Returns the value of attribute pvp.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def pvp @pvp end |
#quests ⇒ Object
Returns the value of attribute quests.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def quests @quests end |
#reputation ⇒ Object
Returns the value of attribute reputation.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def reputation @reputation end |
#stats ⇒ Object
Returns the value of attribute stats.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def stats @stats end |
#talents ⇒ Object
Returns the value of attribute talents.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def talents @talents end |
#titles ⇒ Object
Returns the value of attribute titles.
2 3 4 |
# File 'lib/meta_nexus/wow/character.rb', line 2 def titles @titles end |
Class Method Details
.find(args) ⇒ Object
Find Character in Battle.net WoW Api Required arguments: realm - character realm name - character name
Optional arguments:
achievements: true - character achievements info appearance: true - character appearance info feed: true - character feed info guild: true - character guild info hunter_pets: true - character hunter_pets info items: true - character items info mounts: true - character mounts info pets: true - character pets info pet_slots: true - character pet_slots info progression: true - character progression info pvp: true - character pvp info quests: true - character quests info reputation: true - character reputation info stats: true - character stats info talents: true - character talents info titles: true - character titles info audit: true - character audit info
Example:
character = MetaNexus::Wow::Character
character.find('shadowsong', 'Redstone')
Response in Hash:
{"lastModified"=>1435160620000, "name"=>"Redstone", "realm"=>"Shadowsong", "battlegroup"=>"Reckoning / Abrechnung", "class"=>8, "race"=>2, "gender"=>1, "level"=>90, "achievementPoints"=>8390, "thumbnail"=>"internal-record-3666/105/93238889-avatar.jpg", "calcClass"=>"e", "totalHonorableKills"=>4519}
If you want to get character info with any additional fields, such as achievements or character appearance, you should explicitly call it. Example:
character.find('shadowsong', 'Redstone', appearance: true)
This will return character info along with his appearance info.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/meta_nexus/wow/character.rb', line 45 def self.find(args) call_url = "#{client.url}/character/#{args[:realm]}/#{args[:name]}?" fields = FIELDS.map { |field| args[field] ? field : next }.join(',') call_url << '&fields=' + fields if fields call_url += "locale=#{MetaNexus.config.locale}&apikey=#{MetaNexus.config.api_key}" MetaNexus::Api.call_api(call_url) end |