Commit dbe430bf authored by Francis's avatar Francis
Browse files

Merge branch 'CharacterStatus' into 'master'

Added character status endpoint

See merge request !12
parents b3a45742 4aa849f6
Pipeline #85886824 passed with stage
in 5 minutes and 5 seconds
Please view this file on the master branch, otherwise it may be outdated
**Version 0.2.8**
* Added the new character status endpoint
**Version 0.2.7**
* Changed CI process to use docker ruby images.
......
......@@ -223,6 +223,7 @@ Most **data** endpoints will have always 3 methods available `index`, `get` and
* BlizzardApi::Wow::CharacterProfile
- get_user_characters :user_token
- get :realm, :character, :fields
- status :realm, :character
- pvp_summmary :realm, :character, :user_token
- pvp_bracket :realm, :character, :bracket, :user_token
- achievements :realm, :character
......
......@@ -83,6 +83,21 @@ module BlizzardApi
api_request "#{base_url(:community)}/character/#{CGI.escape(realm)}/#{CGI.escape(character)}", opts
end
##
# Return character status
#
# @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-profile-api
# @see https://us.forums.blizzard.com/en/blizzard/t/data-protection-notice-and-faq/609
#
# @param realm [String] The character realm's slug
# @param character [String] The character name
# @!macro request_options
#
# @!macro response
def status(realm, character, options = {})
character_request realm, character, options, 'status'
end
##
# Return character achievements
#
......
......@@ -8,7 +8,7 @@ module BlizzardApi
def test_achievement_index
achievement = BlizzardApi::Wow::Achievement.new
achievement_data = achievement.index
assert_equal 5029, achievement_data[:achievements].count
assert_equal 5033, achievement_data[:achievements].count
end
def test_achievement_get
......
......@@ -11,10 +11,10 @@ module BlizzardApi
def test_mount_index
mount_data = @mount.index
assert_equal 770, mount_data[:mounts].count
assert_equal 777, mount_data[:mounts].count
mount_data = @mount.index use_community_endpoint: true
assert_equal 919, mount_data[:mounts].count
assert_equal 930, mount_data[:mounts].count
end
def test_mount_get
......
......@@ -27,7 +27,7 @@ module BlizzardApi
def test_mythic_keystone_periods
mythic_keystone_periods = @mythic_keystone_leaderboard.periods
assert_equal 73, mythic_keystone_periods[:periods].count
assert_equal 78, mythic_keystone_periods[:periods].count
end
def test_mythic_keystone_period
......
......@@ -6,39 +6,39 @@ module BlizzardApi
module Wow
class PetTest < Minitest::Test
def setup
@pvp = BlizzardApi::Wow::Pet.new
@pet = BlizzardApi::Wow::Pet.new
end
def test_pet_index
pet_data = @pvp.index
assert_equal 1238, pet_data[:pets].count
pet_data = @pet.index
assert_equal 1244, pet_data[:pets].count
pet_data = @pvp.index use_community_endpoint: true
assert_equal 1238, pet_data[:pets].count
pet_data = @pet.index use_community_endpoint: true
assert_equal 1244, pet_data[:pets].count
end
def test_pet_get
pet_data = @pvp.get 39
pet_data = @pet.get 39
assert_equal 'Mechanical Squirrel', pet_data[:name][:en_US]
end
def test_pet_ability
pet_data = @pvp.ability 640
pet_data = @pet.ability 640
assert_equal 'spell_shadow_plaguecloud', pet_data[:icon]
end
def test_pet_species
pet_data = @pvp.species 258
pet_data = @pet.species 258
assert_equal 42_078, pet_data[:creatureId]
end
def test_pet_stats
pet_data = @pvp.stats 258, 25, 5, 4
pet_data = @pet.stats 258, 25, 5, 4
assert_equal 1587, pet_data[:health]
end
def test_pet_types
pet_data = @pvp.types
pet_data = @pet.types
assert_equal 10, pet_data[:petTypes].count
end
end
......
......@@ -11,7 +11,7 @@ module BlizzardApi
def test_title_index
title_data = @title.index
assert_equal 366, title_data[:titles].count
assert_equal 368, title_data[:titles].count
end
def test_title_get
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment