blizzard_api 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +21 -0
  3. data/CHANGELOG.md +24 -0
  4. data/Gemfile.lock +21 -17
  5. data/README.md +58 -218
  6. data/blizzard_api.gemspec +8 -5
  7. data/lib/blizzard_api/configuration.rb +10 -34
  8. data/lib/blizzard_api/diablo/community/act.rb +4 -4
  9. data/lib/blizzard_api/diablo/community/artisan.rb +4 -4
  10. data/lib/blizzard_api/diablo/community/character.rb +4 -4
  11. data/lib/blizzard_api/diablo/community/follower.rb +2 -2
  12. data/lib/blizzard_api/diablo/community/item.rb +2 -2
  13. data/lib/blizzard_api/diablo/community/item_type.rb +4 -4
  14. data/lib/blizzard_api/diablo/community/profile.rb +4 -4
  15. data/lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb +6 -6
  16. data/lib/blizzard_api/hearthstone/game_data/back.rb +2 -2
  17. data/lib/blizzard_api/hearthstone/game_data/card.rb +4 -4
  18. data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +4 -4
  19. data/lib/blizzard_api/request.rb +8 -7
  20. data/lib/blizzard_api/starcraft.rb +7 -0
  21. data/lib/blizzard_api/starcraft/community/account.rb +1 -1
  22. data/lib/blizzard_api/starcraft/community/ladder.rb +4 -4
  23. data/lib/blizzard_api/starcraft/community/legacy.rb +88 -0
  24. data/lib/blizzard_api/starcraft/community/profile.rb +10 -10
  25. data/lib/blizzard_api/starcraft/game_data/league.rb +2 -2
  26. data/lib/blizzard_api/version.rb +1 -1
  27. data/lib/blizzard_api/wow.rb +0 -7
  28. data/lib/blizzard_api/wow/game_data/achievement.rb +6 -6
  29. data/lib/blizzard_api/wow/game_data/auction.rb +2 -2
  30. data/lib/blizzard_api/wow/game_data/azerite_essence.rb +2 -2
  31. data/lib/blizzard_api/wow/game_data/covenant.rb +10 -10
  32. data/lib/blizzard_api/wow/game_data/creature.rb +12 -12
  33. data/lib/blizzard_api/wow/game_data/generic_data_endpoint.rb +23 -11
  34. data/lib/blizzard_api/wow/game_data/guild_crest.rb +4 -4
  35. data/lib/blizzard_api/wow/game_data/item.rb +12 -12
  36. data/lib/blizzard_api/wow/game_data/journal.rb +15 -15
  37. data/lib/blizzard_api/wow/game_data/modified_crafting.rb +8 -8
  38. data/lib/blizzard_api/wow/game_data/mythic_keystone.rb +12 -12
  39. data/lib/blizzard_api/wow/game_data/mythic_keystone_affix.rb +2 -2
  40. data/lib/blizzard_api/wow/game_data/mythic_keystone_leaderboard.rb +4 -4
  41. data/lib/blizzard_api/wow/game_data/mythic_raid_leaderboard.rb +2 -2
  42. data/lib/blizzard_api/wow/game_data/pet.rb +8 -8
  43. data/lib/blizzard_api/wow/game_data/playable_class.rb +12 -12
  44. data/lib/blizzard_api/wow/game_data/playable_specialization.rb +10 -10
  45. data/lib/blizzard_api/wow/game_data/profession.rb +8 -8
  46. data/lib/blizzard_api/wow/game_data/pvp_season.rb +6 -6
  47. data/lib/blizzard_api/wow/game_data/pvp_tier.rb +2 -2
  48. data/lib/blizzard_api/wow/game_data/quest.rb +12 -12
  49. data/lib/blizzard_api/wow/game_data/reputation.rb +8 -8
  50. data/lib/blizzard_api/wow/game_data/spell.rb +2 -2
  51. data/lib/blizzard_api/wow/game_data/talent.rb +4 -4
  52. data/lib/blizzard_api/wow/game_data/tech_talent.rb +6 -6
  53. data/lib/blizzard_api/wow/game_data/wow_token.rb +2 -2
  54. data/lib/blizzard_api/wow/profile/character_profile.rb +53 -53
  55. data/lib/blizzard_api/wow/profile/guild.rb +10 -10
  56. data/lib/blizzard_api/wow/profile/profile.rb +10 -10
  57. data/lib/blizzard_api/wow/search/search_request.rb +2 -2
  58. metadata +27 -10
  59. data/.gitlab-ci.yml +0 -12
@@ -18,8 +18,8 @@ module BlizzardApi
18
18
  # Fetch modified crafting category index
19
19
  #
20
20
  # @!macro request_options
21
- def categories(options = {})
22
- api_request "#{base_url(:game_data)}/modified-crafting/category/index", default_options.merge(options)
21
+ def categories(**options)
22
+ api_request "#{base_url(:game_data)}/modified-crafting/category/index", **default_options.merge(options)
23
23
  end
24
24
 
25
25
  ##
@@ -30,16 +30,16 @@ module BlizzardApi
30
30
  # @!macro request_options
31
31
  #
32
32
  # @!macro response
33
- def category(id, options = {})
34
- api_request "#{base_url(:game_data)}/modified-crafting/category/#{id}", default_options.merge(options)
33
+ def category(id, **options)
34
+ api_request "#{base_url(:game_data)}/modified-crafting/category/#{id}", **default_options.merge(options)
35
35
  end
36
36
 
37
37
  ##
38
38
  # Fetch modified crafting slot type index
39
39
  #
40
40
  # @!macro request_options
41
- def slot_types(options = {})
42
- api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/index", default_options.merge(options)
41
+ def slot_types(**options)
42
+ api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/index", **default_options.merge(options)
43
43
  end
44
44
 
45
45
  ##
@@ -50,8 +50,8 @@ module BlizzardApi
50
50
  # @!macro request_options
51
51
  #
52
52
  # @!macro response
53
- def slot_type(id, options = {})
54
- api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/#{id}", default_options.merge(options)
53
+ def slot_type(id, **options)
54
+ api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/#{id}", **default_options.merge(options)
55
55
  end
56
56
 
57
57
  protected
@@ -24,8 +24,8 @@ module BlizzardApi
24
24
  # @!macro request_options
25
25
  #
26
26
  # @!macro response
27
- def dungeons(options = {})
28
- api_request "#{endpoint_uri}/dungeon/index", default_options.merge(options)
27
+ def dungeons(**options)
28
+ api_request "#{endpoint_uri}/dungeon/index", **default_options.merge(options)
29
29
  end
30
30
 
31
31
  ##
@@ -36,8 +36,8 @@ module BlizzardApi
36
36
  # @!macro request_options
37
37
  #
38
38
  # @!macro response
39
- def dungeon(id, options = {})
40
- api_request "#{endpoint_uri}/dungeon/#{id}", default_options.merge(options)
39
+ def dungeon(id, **options)
40
+ api_request "#{endpoint_uri}/dungeon/#{id}", **default_options.merge(options)
41
41
  end
42
42
 
43
43
  ##
@@ -46,8 +46,8 @@ module BlizzardApi
46
46
  # @!macro request_options
47
47
  #
48
48
  # @!macro response
49
- def periods(options = {})
50
- api_request "#{endpoint_uri}/period/index", default_options.merge(options)
49
+ def periods(**options)
50
+ api_request "#{endpoint_uri}/period/index", **default_options.merge(options)
51
51
  end
52
52
 
53
53
  ##
@@ -58,8 +58,8 @@ module BlizzardApi
58
58
  # @!macro request_options
59
59
  #
60
60
  # @!macro response
61
- def period(id, options = {})
62
- api_request "#{endpoint_uri}/period/#{id}", default_options.merge(options)
61
+ def period(id, **options)
62
+ api_request "#{endpoint_uri}/period/#{id}", **default_options.merge(options)
63
63
  end
64
64
 
65
65
  ##
@@ -68,8 +68,8 @@ module BlizzardApi
68
68
  # @!macro request_options
69
69
  #
70
70
  # @!macro response
71
- def seasons(options = {})
72
- api_request "#{endpoint_uri}/season/index", default_options.merge(options)
71
+ def seasons(**options)
72
+ api_request "#{endpoint_uri}/season/index", **default_options.merge(options)
73
73
  end
74
74
 
75
75
  ##
@@ -80,8 +80,8 @@ module BlizzardApi
80
80
  # @!macro request_options
81
81
  #
82
82
  # @!macro response
83
- def season(id, options = {})
84
- api_request "#{endpoint_uri}/season/#{id}", default_options.merge(options)
83
+ def season(id, **options)
84
+ api_request "#{endpoint_uri}/season/#{id}", **default_options.merge(options)
85
85
  end
86
86
 
87
87
  protected
@@ -18,8 +18,8 @@ module BlizzardApi
18
18
  # @!macro request_options
19
19
  #
20
20
  # @!macro response
21
- def media(id, options = {})
22
- api_request "#{base_url(:media)}/keystone-affix/#{id}", default_options.merge(options)
21
+ def media(id, **options)
22
+ api_request "#{base_url(:media)}/keystone-affix/#{id}", **default_options.merge(options)
23
23
  end
24
24
 
25
25
  protected
@@ -18,8 +18,8 @@ module BlizzardApi
18
18
  # @!macro request_options
19
19
  #
20
20
  # @!macro response
21
- def index(connected_realm_id, options = {})
22
- api_request "#{endpoint_uri(connected_realm_id)}/index", default_options(options)
21
+ def index(connected_realm_id, **options)
22
+ api_request "#{endpoint_uri(connected_realm_id)}/index", **default_options(options)
23
23
  end
24
24
 
25
25
  ##
@@ -30,8 +30,8 @@ module BlizzardApi
30
30
  # @!macro request_options
31
31
  #
32
32
  # @!macro response
33
- def get(connected_realm_id, dungeon_id, period, options = {})
34
- api_request "#{endpoint_uri(connected_realm_id)}/#{dungeon_id}/period/#{period}", default_options(options)
33
+ def get(connected_realm_id, dungeon_id, period, **options)
34
+ api_request "#{endpoint_uri(connected_realm_id)}/#{dungeon_id}/period/#{period}", **default_options(options)
35
35
  end
36
36
 
37
37
  private
@@ -19,9 +19,9 @@ module BlizzardApi
19
19
  # @!macro request_options
20
20
  #
21
21
  # @!macro response
22
- def get(raid, faction, options = {})
22
+ def get(raid, faction, **options)
23
23
  opts = options.merge(namespace: :dynamic, ttl: CACHE_DAY)
24
- api_request "#{base_url(:game_data)}/leaderboard/hall-of-fame/#{raid}/#{faction}", opts
24
+ api_request "#{base_url(:game_data)}/leaderboard/hall-of-fame/#{raid}/#{faction}", **opts
25
25
  end
26
26
  end
27
27
  end
@@ -18,8 +18,8 @@ module BlizzardApi
18
18
  # @!macro request_options
19
19
  #
20
20
  # @!macro response
21
- def media(id, options = {})
22
- api_request "#{base_url(:media)}/pet/#{id}", default_options.merge(options)
21
+ def media(id, **options)
22
+ api_request "#{base_url(:media)}/pet/#{id}", **default_options.merge(options)
23
23
  end
24
24
 
25
25
  ##
@@ -28,8 +28,8 @@ module BlizzardApi
28
28
  # @!macro request_options
29
29
  #
30
30
  # @!macro response
31
- def abilities(options = {})
32
- api_request "#{endpoint_uri('ability')}/index", default_options.merge(options)
31
+ def abilities(**options)
32
+ api_request "#{endpoint_uri('ability')}/index", **default_options.merge(options)
33
33
  end
34
34
 
35
35
  ##
@@ -40,8 +40,8 @@ module BlizzardApi
40
40
  # @!macro request_options
41
41
  #
42
42
  # @!macro response
43
- def ability(id, options = {})
44
- api_request "#{endpoint_uri('ability')}/#{id}", default_options.merge(options)
43
+ def ability(id, **options)
44
+ api_request "#{endpoint_uri('ability')}/#{id}", **default_options.merge(options)
45
45
  end
46
46
 
47
47
  ##
@@ -52,8 +52,8 @@ module BlizzardApi
52
52
  # @!macro request_options
53
53
  #
54
54
  # @!macro response
55
- def ability_media(id, options = {})
56
- api_request "#{base_url(:media)}/pet-ability/#{id}", default_options.merge(options)
55
+ def ability_media(id, **options)
56
+ api_request "#{base_url(:media)}/pet-ability/#{id}", **default_options.merge(options)
57
57
  end
58
58
 
59
59
  protected
@@ -17,20 +17,20 @@ module BlizzardApi
17
17
  # @!macro request_options
18
18
  #
19
19
  # @!macro response
20
- def talent_slots(id, options = {})
21
- api_request "#{endpoint_uri}/#{id}/pvp-talent-slots", default_options.merge(options)
20
+ def talent_slots(id, **options)
21
+ api_request "#{endpoint_uri}/#{id}/pvp-talent-slots", **default_options.merge(options)
22
22
  end
23
23
 
24
24
  ##
25
25
  # @!macro complete
26
26
  #
27
27
  # @option options [Boolean] :classic If set to true, this method will call the classic version
28
- def complete(options = {})
29
- index_data = index options
28
+ def complete(**options)
29
+ index_data = index(**options)
30
30
  [].tap do |classes|
31
31
  index_data[:classes].each do |pclass|
32
32
  class_id = %r{playable-class/([0-9]+)}.match(pclass[:key].to_s)[1]
33
- class_data = get class_id, options
33
+ class_data = get class_id, **options
34
34
  classes.push class_data
35
35
  end
36
36
  end
@@ -45,9 +45,9 @@ module BlizzardApi
45
45
  # @option options [Boolean] :classic If set to true, this method will call the classic version
46
46
  #
47
47
  # @!macro response
48
- def get(id, options = {})
49
- data = api_request "#{endpoint_uri}/#{id}", default_options.merge(options)
50
- data[:icon] = get_class_icon data[:media], options
48
+ def get(id, **options)
49
+ data = api_request "#{endpoint_uri}/#{id}", **default_options.merge(options)
50
+ data[:icon] = get_class_icon data[:media], **options
51
51
  data
52
52
  end
53
53
 
@@ -59,8 +59,8 @@ module BlizzardApi
59
59
  # @!macro request_options
60
60
  #
61
61
  # @!macro response
62
- def media(id, options = {})
63
- api_request "#{base_url(:media)}/playable-class/#{id}", default_options.merge(options)
62
+ def media(id, **options)
63
+ api_request "#{base_url(:media)}/playable-class/#{id}", **default_options.merge(options)
64
64
  end
65
65
 
66
66
  protected
@@ -72,10 +72,10 @@ module BlizzardApi
72
72
  @ttl = CACHE_TRIMESTER
73
73
  end
74
74
 
75
- def get_class_icon(media_url, options)
75
+ def get_class_icon(media_url, **options)
76
76
  return if options.include? :classic
77
77
 
78
- media_data = request media_url[:key][:href], options
78
+ media_data = request media_url[:key][:href], **options
79
79
  %r{56/([a-z_]+).jpg}.match(media_data[:assets][0][:value].to_s)[1]
80
80
  end
81
81
  end
@@ -12,12 +12,12 @@ module BlizzardApi
12
12
  class PlayableSpecialization < Wow::GenericDataEndpoint
13
13
  ##
14
14
  # @!macro complete
15
- def complete(options = {})
16
- index_data = index options
17
- response_data = OpenStruct.new
18
- response_data.character_specializations = character_data(index_data, options)
19
- response_data.pet_specializations = pet_data(index_data, options)
20
- response_data
15
+ def complete(**options)
16
+ index_data = index(**options)
17
+ {}.tap do |response_data|
18
+ response_data[:character_specializations] = character_data(index_data, options)
19
+ response_data[:pet_specializations] = pet_data(index_data, options)
20
+ end
21
21
  end
22
22
 
23
23
  ##
@@ -28,8 +28,8 @@ module BlizzardApi
28
28
  # @!macro request_options
29
29
  #
30
30
  # @!macro response
31
- def media(id, options = {})
32
- api_request "#{base_url(:media)}/playable-specialization/#{id}", default_options.merge(options)
31
+ def media(id, **options)
32
+ api_request "#{base_url(:media)}/playable-specialization/#{id}", **default_options.merge(options)
33
33
  end
34
34
 
35
35
  protected
@@ -47,7 +47,7 @@ module BlizzardApi
47
47
  [].tap do |specs|
48
48
  index_data[:character_specializations].each do |spec|
49
49
  spec_id = %r{playable-specialization/([0-9]+)}.match(spec[:key].to_s)[1]
50
- spec_data = get spec_id, options
50
+ spec_data = get spec_id, **options
51
51
  spec_data[:icon] = resolve_icon(spec_data[:media][:key][:href])
52
52
  cleanup spec_data
53
53
  specs.push spec_data
@@ -59,7 +59,7 @@ module BlizzardApi
59
59
  [].tap do |specs|
60
60
  index_data[:pet_specializations].each do |spec|
61
61
  spec_id = %r{playable-specialization/([0-9]+)}.match(spec[:key].to_s)[1]
62
- spec_data = get spec_id, options
62
+ spec_data = get spec_id, **options
63
63
  spec_data[:icon] = resolve_icon(spec_data[:media][:key][:href])
64
64
  cleanup spec_data
65
65
  specs.push spec_data
@@ -18,8 +18,8 @@ module BlizzardApi
18
18
  # @!macro request_options
19
19
  #
20
20
  # @!macro response
21
- def media(id, options = {})
22
- api_request "#{base_url(:media)}/profession/#{id}", default_options.merge(options)
21
+ def media(id, **options)
22
+ api_request "#{base_url(:media)}/profession/#{id}", **default_options.merge(options)
23
23
  end
24
24
 
25
25
  ##
@@ -31,8 +31,8 @@ module BlizzardApi
31
31
  # @!macro request_options
32
32
  #
33
33
  # @!macro response
34
- def skill_tier(id, tier_id, options = {})
35
- api_request "#{base_url(:game_data)}/profession/#{id}/skill-tier/#{tier_id}", default_options.merge(options)
34
+ def skill_tier(id, tier_id, **options)
35
+ api_request "#{base_url(:game_data)}/profession/#{id}/skill-tier/#{tier_id}", **default_options.merge(options)
36
36
  end
37
37
 
38
38
  ##
@@ -43,8 +43,8 @@ module BlizzardApi
43
43
  # @!macro request_options
44
44
  #
45
45
  # @!macro response
46
- def recipe(id, options = {})
47
- api_request "#{base_url(:game_data)}/recipe/#{id}", default_options.merge(options)
46
+ def recipe(id, **options)
47
+ api_request "#{base_url(:game_data)}/recipe/#{id}", **default_options.merge(options)
48
48
  end
49
49
 
50
50
  ##
@@ -55,8 +55,8 @@ module BlizzardApi
55
55
  # @!macro request_options
56
56
  #
57
57
  # @!macro response
58
- def recipe_media(id, options = {})
59
- api_request "#{base_url(:media)}/recipe/#{id}", default_options.merge(options)
58
+ def recipe_media(id, **options)
59
+ api_request "#{base_url(:media)}/recipe/#{id}", **default_options.merge(options)
60
60
  end
61
61
 
62
62
  protected
@@ -16,8 +16,8 @@ module BlizzardApi
16
16
  # @!macro request_options
17
17
  #
18
18
  # @!macro response
19
- def leaderboards(season_id, options = {})
20
- api_request "#{endpoint_uri}/#{season_id}/pvp-leaderboard/index", default_options.merge(options)
19
+ def leaderboards(season_id, **options)
20
+ api_request "#{endpoint_uri}/#{season_id}/pvp-leaderboard/index", **default_options.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -26,8 +26,8 @@ module BlizzardApi
26
26
  # @!macro request_options
27
27
  #
28
28
  # @!macro response
29
- def leaderboard(season_id, brackets, options = {})
30
- api_request "#{endpoint_uri}/#{season_id}/pvp-leaderboard/#{brackets}", default_options.merge(options)
29
+ def leaderboard(season_id, brackets, **options)
30
+ api_request "#{endpoint_uri}/#{season_id}/pvp-leaderboard/#{brackets}", **default_options.merge(options)
31
31
  end
32
32
 
33
33
  ##
@@ -36,8 +36,8 @@ module BlizzardApi
36
36
  # @!macro request_options
37
37
  #
38
38
  # @!macro response
39
- def rewards(season_id, options = {})
40
- api_request "#{endpoint_uri}/#{season_id}/pvp-reward/index", default_options.merge(options)
39
+ def rewards(season_id, **options)
40
+ api_request "#{endpoint_uri}/#{season_id}/pvp-reward/index", **default_options.merge(options)
41
41
  end
42
42
 
43
43
  protected
@@ -16,8 +16,8 @@ module BlizzardApi
16
16
  # @!macro request_options
17
17
  #
18
18
  # @!macro response
19
- def tier_media(id, options = {})
20
- api_request "#{base_url(:media)}/#{@endpoint}/#{id}", default_options.merge(options)
19
+ def tier_media(id, **options)
20
+ api_request "#{base_url(:media)}/#{@endpoint}/#{id}", **default_options.merge(options)
21
21
  end
22
22
 
23
23
  protected
@@ -16,8 +16,8 @@ module BlizzardApi
16
16
  # @!macro request_options
17
17
  #
18
18
  # @!macro response
19
- def categories(options = {})
20
- api_request "#{endpoint_uri}/category/index", default_options.merge(options)
19
+ def categories(**options)
20
+ api_request "#{endpoint_uri}/category/index", **default_options.merge(options)
21
21
  end
22
22
 
23
23
  ##
@@ -27,8 +27,8 @@ module BlizzardApi
27
27
  # @!macro request_options
28
28
  #
29
29
  # @!macro response
30
- def category(id, options = {})
31
- api_request "#{endpoint_uri}/category/#{id}", default_options.merge(options)
30
+ def category(id, **options)
31
+ api_request "#{endpoint_uri}/category/#{id}", **default_options.merge(options)
32
32
  end
33
33
 
34
34
  ##
@@ -37,8 +37,8 @@ module BlizzardApi
37
37
  # @!macro request_options
38
38
  #
39
39
  # @!macro response
40
- def areas(options = {})
41
- api_request "#{endpoint_uri}/area/index", default_options.merge(options)
40
+ def areas(**options)
41
+ api_request "#{endpoint_uri}/area/index", **default_options.merge(options)
42
42
  end
43
43
 
44
44
  ##
@@ -48,8 +48,8 @@ module BlizzardApi
48
48
  # @!macro request_options
49
49
  #
50
50
  # @!macro response
51
- def area(id, options = {})
52
- api_request "#{endpoint_uri}/area/#{id}", default_options.merge(options)
51
+ def area(id, **options)
52
+ api_request "#{endpoint_uri}/area/#{id}", **default_options.merge(options)
53
53
  end
54
54
 
55
55
  ##
@@ -58,8 +58,8 @@ module BlizzardApi
58
58
  # @!macro request_options
59
59
  #
60
60
  # @!macro response
61
- def types(options = {})
62
- api_request "#{endpoint_uri}/type/index", default_options.merge(options)
61
+ def types(**options)
62
+ api_request "#{endpoint_uri}/type/index", **default_options.merge(options)
63
63
  end
64
64
 
65
65
  ##
@@ -69,8 +69,8 @@ module BlizzardApi
69
69
  # @!macro request_options
70
70
  #
71
71
  # @!macro response
72
- def type(id, options = {})
73
- api_request "#{endpoint_uri}/type/#{id}", default_options.merge(options)
72
+ def type(id, **options)
73
+ api_request "#{endpoint_uri}/type/#{id}", **default_options.merge(options)
74
74
  end
75
75
 
76
76
  protected