blizzard_api 0.5.0 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +21 -0
  3. data/CHANGELOG.md +22 -0
  4. data/Gemfile.lock +9 -9
  5. data/README.md +58 -218
  6. data/blizzard_api.gemspec +6 -4
  7. data/lib/blizzard_api/diablo/community/act.rb +2 -2
  8. data/lib/blizzard_api/diablo/community/artisan.rb +2 -2
  9. data/lib/blizzard_api/diablo/community/character.rb +2 -2
  10. data/lib/blizzard_api/diablo/community/follower.rb +1 -1
  11. data/lib/blizzard_api/diablo/community/item.rb +1 -1
  12. data/lib/blizzard_api/diablo/community/item_type.rb +2 -2
  13. data/lib/blizzard_api/diablo/community/profile.rb +4 -4
  14. data/lib/blizzard_api/diablo/game_data/generic_data_endpoint.rb +3 -3
  15. data/lib/blizzard_api/hearthstone/game_data/back.rb +1 -1
  16. data/lib/blizzard_api/hearthstone/game_data/card.rb +2 -2
  17. data/lib/blizzard_api/hearthstone/game_data/generic_data_endpoint.rb +2 -2
  18. data/lib/blizzard_api/request.rb +3 -3
  19. data/lib/blizzard_api/starcraft.rb +7 -0
  20. data/lib/blizzard_api/starcraft/community/account.rb +1 -1
  21. data/lib/blizzard_api/starcraft/community/ladder.rb +2 -2
  22. data/lib/blizzard_api/starcraft/community/legacy.rb +88 -0
  23. data/lib/blizzard_api/starcraft/community/profile.rb +5 -5
  24. data/lib/blizzard_api/starcraft/game_data/league.rb +1 -1
  25. data/lib/blizzard_api/version.rb +1 -1
  26. data/lib/blizzard_api/wow.rb +24 -7
  27. data/lib/blizzard_api/wow/game_data/achievement.rb +3 -3
  28. data/lib/blizzard_api/wow/game_data/auction.rb +1 -1
  29. data/lib/blizzard_api/wow/game_data/azerite_essence.rb +1 -1
  30. data/lib/blizzard_api/wow/game_data/covenant.rb +79 -0
  31. data/lib/blizzard_api/wow/game_data/creature.rb +6 -6
  32. data/lib/blizzard_api/wow/game_data/generic_data_endpoint.rb +3 -3
  33. data/lib/blizzard_api/wow/game_data/guild_crest.rb +2 -2
  34. data/lib/blizzard_api/wow/game_data/item.rb +6 -6
  35. data/lib/blizzard_api/wow/game_data/journal.rb +8 -8
  36. data/lib/blizzard_api/wow/game_data/modified_crafting.rb +67 -0
  37. data/lib/blizzard_api/wow/game_data/mythic_keystone.rb +6 -6
  38. data/lib/blizzard_api/wow/game_data/mythic_keystone_affix.rb +1 -1
  39. data/lib/blizzard_api/wow/game_data/mythic_keystone_leaderboard.rb +2 -2
  40. data/lib/blizzard_api/wow/game_data/mythic_raid_leaderboard.rb +1 -1
  41. data/lib/blizzard_api/wow/game_data/pet.rb +4 -4
  42. data/lib/blizzard_api/wow/game_data/playable_class.rb +4 -4
  43. data/lib/blizzard_api/wow/game_data/playable_specialization.rb +2 -2
  44. data/lib/blizzard_api/wow/game_data/profession.rb +4 -4
  45. data/lib/blizzard_api/wow/game_data/pvp_season.rb +3 -3
  46. data/lib/blizzard_api/wow/game_data/pvp_tier.rb +1 -1
  47. data/lib/blizzard_api/wow/game_data/quest.rb +6 -6
  48. data/lib/blizzard_api/wow/game_data/reputation.rb +4 -4
  49. data/lib/blizzard_api/wow/game_data/spell.rb +1 -1
  50. data/lib/blizzard_api/wow/game_data/talent.rb +2 -2
  51. data/lib/blizzard_api/wow/game_data/tech_talent.rb +57 -0
  52. data/lib/blizzard_api/wow/game_data/wow_token.rb +1 -1
  53. data/lib/blizzard_api/wow/profile/character_profile.rb +63 -49
  54. data/lib/blizzard_api/wow/profile/guild.rb +8 -8
  55. data/lib/blizzard_api/wow/profile/profile.rb +5 -5
  56. data/lib/blizzard_api/wow/search/search_request.rb +1 -1
  57. metadata +14 -8
  58. data/.gitlab-ci.yml +0 -12
@@ -24,7 +24,7 @@ module BlizzardApi
24
24
  # @!macro request_options
25
25
  #
26
26
  # @!macro response
27
- def categories(options = {})
27
+ def categories(**options)
28
28
  api_request "#{endpoint_uri('category')}/index", default_options.merge(options)
29
29
  end
30
30
 
@@ -34,7 +34,7 @@ module BlizzardApi
34
34
  # @!macro request_options
35
35
  #
36
36
  # @!macro response
37
- def category(id, options = {})
37
+ def category(id, **options)
38
38
  api_request "#{endpoint_uri('category')}/#{id}", default_options.merge(options)
39
39
  end
40
40
 
@@ -44,7 +44,7 @@ module BlizzardApi
44
44
  # @!macro request_options
45
45
  #
46
46
  # @!macro response
47
- def media(id, options = {})
47
+ def media(id, **options)
48
48
  api_request "#{base_url(:media)}/achievement/#{id}", default_options.merge(options)
49
49
  end
50
50
 
@@ -17,7 +17,7 @@ module BlizzardApi
17
17
  # @!macro request_options
18
18
  #
19
19
  # @!macro response
20
- def get(connected_realm_id, options = {})
20
+ def get(connected_realm_id, **options)
21
21
  opts = { ttl: CACHE_HOUR, namespace: :dynamic }.merge(options)
22
22
  api_request "#{base_url(:game_data)}/connected-realm/#{connected_realm_id}/auctions", opts
23
23
  end
@@ -20,7 +20,7 @@ module BlizzardApi
20
20
  # @!macro request_options
21
21
  #
22
22
  # @!macro response
23
- def media(id, options = {})
23
+ def media(id, **options)
24
24
  api_request "#{base_url(:media)}/azerite-essence/#{id}", default_options.merge(options)
25
25
  end
26
26
 
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module Wow
5
+ ##
6
+ # This class allows access to World of Warcraft azerite essences
7
+ #
8
+ # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::Wow.azerite_essence
12
+ class Covenant < Wow::GenericDataEndpoint
13
+ ##
14
+ # Fetch media for one of the covenants listed by the {#index} using its *id*
15
+ #
16
+ # @param id [Integer] Covenant id
17
+ #
18
+ # @!macro request_options
19
+ #
20
+ # @!macro response
21
+ def media(id, **options)
22
+ api_request "#{base_url(:media)}/covenant/#{id}", default_options.merge(options)
23
+ end
24
+
25
+ ##
26
+ # Fetch all soulbinds
27
+ #
28
+ # @!macro request_options
29
+ #
30
+ # @!macro response
31
+ def soulbinds(**options)
32
+ api_request "#{base_url(:game_data)}/covenant/soulbind/index", default_options.merge(options)
33
+ end
34
+
35
+ ##
36
+ # Fetch a soulbind by its id
37
+ #
38
+ # @param id Soulbind id
39
+ #
40
+ # @!macro request_options
41
+ #
42
+ # @!macro response
43
+ def soulbind(id, **options)
44
+ api_request "#{base_url(:game_data)}/covenant/soulbind/#{id}", default_options.merge(options)
45
+ end
46
+
47
+ ##
48
+ # Fetch all conduits
49
+ #
50
+ # @!macro request_options
51
+ #
52
+ # @!macro response
53
+ def conduits(**options)
54
+ api_request "#{base_url(:game_data)}/covenant/conduit/index", default_options.merge(options)
55
+ end
56
+
57
+ ##
58
+ # Fetch a conduit by its id
59
+ #
60
+ # @param id Conduit id
61
+ #
62
+ # @!macro request_options
63
+ #
64
+ # @!macro response
65
+ def conduit(id, **options)
66
+ api_request "#{base_url(:game_data)}/covenant/conduit/#{id}", default_options.merge(options)
67
+ end
68
+
69
+ protected
70
+
71
+ def endpoint_setup
72
+ @endpoint = 'covenant'
73
+ @namespace = :static
74
+ @collection = 'covenants'
75
+ @ttl = CACHE_TRIMESTER
76
+ end
77
+ end
78
+ end
79
+ end
@@ -27,7 +27,7 @@ module BlizzardApi
27
27
  # @option options [Boolean] :classic If set to true, this method will call the classic version
28
28
  #
29
29
  # @!macro response
30
- def families(options = {})
30
+ def families(**options)
31
31
  api_request "#{endpoint_uri('family')}/index", default_options.merge(options)
32
32
  end
33
33
 
@@ -40,7 +40,7 @@ module BlizzardApi
40
40
  # @option options [Boolean] :classic If set to true, this method will call the classic version
41
41
  #
42
42
  # @!macro response
43
- def family(id, options = {})
43
+ def family(id, **options)
44
44
  api_request "#{endpoint_uri('family')}/#{id}", default_options.merge(options)
45
45
  end
46
46
 
@@ -53,7 +53,7 @@ module BlizzardApi
53
53
  # @option options [Boolean] :classic If set to true, this method will call the classic version
54
54
  #
55
55
  # @!macro response
56
- def family_media(id, options = {})
56
+ def family_media(id, **options)
57
57
  api_request "#{base_url(:media)}/creature-family/#{id}", default_options.merge(options)
58
58
  end
59
59
 
@@ -64,7 +64,7 @@ module BlizzardApi
64
64
  # @option options [Boolean] :classic If set to true, this method will call the classic version
65
65
  #
66
66
  # @!macro response
67
- def types(options = {})
67
+ def types(**options)
68
68
  api_request "#{endpoint_uri('type')}/index", default_options.merge(options)
69
69
  end
70
70
 
@@ -77,7 +77,7 @@ module BlizzardApi
77
77
  # @option options [Boolean] :classic If set to true, this method will call the classic version
78
78
  #
79
79
  # @!macro response
80
- def type(id, options = {})
80
+ def type(id, **options)
81
81
  api_request "#{endpoint_uri('type')}/#{id}", default_options.merge(options)
82
82
  end
83
83
 
@@ -90,7 +90,7 @@ module BlizzardApi
90
90
  # @option options [Boolean] :classic If set to true, this method will call the classic version
91
91
  #
92
92
  # @!macro response
93
- def display_media(id, options = {})
93
+ def display_media(id, **options)
94
94
  api_request "#{base_url(:media)}/creature-display/#{id}", default_options.merge(options)
95
95
  end
96
96
 
@@ -18,7 +18,7 @@ module BlizzardApi
18
18
  #
19
19
  # @!macro request_options
20
20
  # @!macro response
21
- def index(options = {})
21
+ def index(**options)
22
22
  api_request "#{endpoint_uri}/index", default_options.merge(options)
23
23
  end
24
24
 
@@ -29,13 +29,13 @@ module BlizzardApi
29
29
  # @!macro request_options
30
30
  #
31
31
  # @!macro response
32
- def get(id, options = {})
32
+ def get(id, **options)
33
33
  api_request "#{endpoint_uri}/#{id}", default_options.merge(options)
34
34
  end
35
35
 
36
36
  ##
37
37
  # @!macro complete
38
- def complete(options = {})
38
+ def complete(**options)
39
39
  [].tap do |complete_data|
40
40
  index_data = index options
41
41
  index_data[@collection.to_sym].each do |item|
@@ -23,7 +23,7 @@ module BlizzardApi
23
23
  # @option options [Boolean] :classic If set to true, this method will call the classic version
24
24
  #
25
25
  # @!macro response
26
- def border_media(id, options = {})
26
+ def border_media(id, **options)
27
27
  api_request "#{base_url(:media)}/#{@endpoint}/border/#{id}", default_options.merge(options)
28
28
  end
29
29
 
@@ -36,7 +36,7 @@ module BlizzardApi
36
36
  # @!macro request_options
37
37
  #
38
38
  # @!macro response
39
- def emblem_media(id, options = {})
39
+ def emblem_media(id, **options)
40
40
  api_request "#{base_url(:media)}/#{@endpoint}/emblem/#{id}", default_options.merge(options)
41
41
  end
42
42
 
@@ -35,7 +35,7 @@ module BlizzardApi
35
35
  # @option options [Boolean] :classic If set to true, this method will call the classic version
36
36
  #
37
37
  # @!macro response
38
- def classes(options = {})
38
+ def classes(**options)
39
39
  api_request "#{endpoint_uri('class')}/index", default_options.merge(options)
40
40
  end
41
41
 
@@ -47,7 +47,7 @@ module BlizzardApi
47
47
  # @option options [Boolean] :classic If set to true, this method will call the classic version
48
48
  #
49
49
  # @!macro response
50
- def class(id, options = {})
50
+ def class(id, **options)
51
51
  api_request "#{endpoint_uri('class')}/#{id}", default_options.merge(options)
52
52
  end
53
53
 
@@ -60,7 +60,7 @@ module BlizzardApi
60
60
  # @option options [Boolean] :classic If set to true, this method will call the classic version
61
61
  #
62
62
  # @!macro response
63
- def subclass(id, subclass_id, options = {})
63
+ def subclass(id, subclass_id, **options)
64
64
  api_request "#{endpoint_uri('class')}/#{id}/item-subclass/#{subclass_id}", default_options.merge(options)
65
65
  end
66
66
 
@@ -73,7 +73,7 @@ module BlizzardApi
73
73
  # @option options [Boolean] :classic If set to true, this method will call the classic version
74
74
  #
75
75
  # @!macro response
76
- def media(id, options = {})
76
+ def media(id, **options)
77
77
  api_request "#{base_url(:media)}/item/#{id}", default_options.merge(options)
78
78
  end
79
79
 
@@ -83,7 +83,7 @@ module BlizzardApi
83
83
  # @!macro request_options
84
84
  #
85
85
  # @!macro response
86
- def sets(options = {})
86
+ def sets(**options)
87
87
  api_request "#{endpoint_uri('set')}/index", default_options.merge(options)
88
88
  end
89
89
 
@@ -94,7 +94,7 @@ module BlizzardApi
94
94
  # @!macro request_options
95
95
  #
96
96
  # @!macro response
97
- def set(id, options = {})
97
+ def set(id, **options)
98
98
  api_request "#{endpoint_uri('set')}/#{id}", default_options.merge(options)
99
99
  end
100
100
 
@@ -30,7 +30,7 @@ module BlizzardApi
30
30
  # This method overrides the inherited default behavior to prevent high server load and fetch time
31
31
  #
32
32
  # @!macro response
33
- def get(_id, _options = {})
33
+ def get(_id, **options)
34
34
  raise BlizzardApi::ApiException, 'This endpoint does not have a get method'
35
35
  end
36
36
 
@@ -40,7 +40,7 @@ module BlizzardApi
40
40
  # @!macro request_options
41
41
  #
42
42
  # @!macro response
43
- def expansions(options = {})
43
+ def expansions(**options)
44
44
  api_request "#{endpoint_uri('expansion')}/index", default_options.merge(options)
45
45
  end
46
46
 
@@ -51,7 +51,7 @@ module BlizzardApi
51
51
  # @!macro request_options
52
52
  #
53
53
  # @!macro response
54
- def expansion(id, options = {})
54
+ def expansion(id, **options)
55
55
  api_request "#{endpoint_uri('expansion')}/#{id}", default_options.merge(options)
56
56
  end
57
57
 
@@ -61,7 +61,7 @@ module BlizzardApi
61
61
  # @!macro request_options
62
62
  #
63
63
  # @!macro response
64
- def instances(options = {})
64
+ def instances(**options)
65
65
  api_request "#{endpoint_uri('instance')}/index", default_options.merge(options)
66
66
  end
67
67
 
@@ -72,7 +72,7 @@ module BlizzardApi
72
72
  # @!macro request_options
73
73
  #
74
74
  # @!macro response
75
- def instance(id, options = {})
75
+ def instance(id, **options)
76
76
  api_request "#{endpoint_uri('instance')}/#{id}", default_options.merge(options)
77
77
  end
78
78
 
@@ -82,7 +82,7 @@ module BlizzardApi
82
82
  # @!macro request_options
83
83
  #
84
84
  # @!macro response
85
- def encounters(options = {})
85
+ def encounters(**options)
86
86
  api_request "#{endpoint_uri('encounter')}/index", default_options.merge(options)
87
87
  end
88
88
 
@@ -93,7 +93,7 @@ module BlizzardApi
93
93
  # @!macro request_options
94
94
  #
95
95
  # @!macro response
96
- def encounter(id, options = {})
96
+ def encounter(id, **options)
97
97
  api_request "#{endpoint_uri('encounter')}/#{id}", default_options.merge(options)
98
98
  end
99
99
 
@@ -105,7 +105,7 @@ module BlizzardApi
105
105
  #
106
106
  # @!macro request_options
107
107
  # @!macro response
108
- def encounter_search(page = 1, page_size = 100, options = {})
108
+ def encounter_search(page = 1, page_size = 100, **options)
109
109
  search_options = SearchComposer.new(page, page_size)
110
110
  yield search_options if block_given?
111
111
 
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlizzardApi
4
+ module Wow
5
+ ##
6
+ # This class allows access to World of Warcraft professions
7
+ #
8
+ # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
9
+ #
10
+ # You can get an instance of this class using the default region as follows:
11
+ # api_instance = BlizzardApi::Wow.modified_crafting
12
+ class ModifiedCrafting < Wow::GenericDataEndpoint
13
+ def complete
14
+ raise BlizzardApi::ApiException, 'This endpoint does not have a complete method.'
15
+ end
16
+
17
+ ##
18
+ # Fetch modified crafting category index
19
+ #
20
+ # @!macro request_options
21
+ def categories(**options)
22
+ api_request "#{base_url(:game_data)}/modified-crafting/category/index", default_options.merge(options)
23
+ end
24
+
25
+ ##
26
+ # Fetch a modified crafting category
27
+ #
28
+ # @param id [Integer] Modified crafting category id
29
+ #
30
+ # @!macro request_options
31
+ #
32
+ # @!macro response
33
+ def category(id, **options)
34
+ api_request "#{base_url(:game_data)}/modified-crafting/category/#{id}", default_options.merge(options)
35
+ end
36
+
37
+ ##
38
+ # Fetch modified crafting slot type index
39
+ #
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)
43
+ end
44
+
45
+ ##
46
+ # Fetch a modified crafting slot type
47
+ #
48
+ # @param id [Integer] Modified crafting slot type id
49
+ #
50
+ # @!macro request_options
51
+ #
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)
55
+ end
56
+
57
+ protected
58
+
59
+ def endpoint_setup
60
+ @endpoint = 'modified-crafting'
61
+ @namespace = :static
62
+ @collection = 'professions'
63
+ @ttl = CACHE_TRIMESTER
64
+ end
65
+ end
66
+ end
67
+ end
@@ -24,7 +24,7 @@ module BlizzardApi
24
24
  # @!macro request_options
25
25
  #
26
26
  # @!macro response
27
- def dungeons(options = {})
27
+ def dungeons(**options)
28
28
  api_request "#{endpoint_uri}/dungeon/index", default_options.merge(options)
29
29
  end
30
30
 
@@ -36,7 +36,7 @@ module BlizzardApi
36
36
  # @!macro request_options
37
37
  #
38
38
  # @!macro response
39
- def dungeon(id, options = {})
39
+ def dungeon(id, **options)
40
40
  api_request "#{endpoint_uri}/dungeon/#{id}", default_options.merge(options)
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ module BlizzardApi
46
46
  # @!macro request_options
47
47
  #
48
48
  # @!macro response
49
- def periods(options = {})
49
+ def periods(**options)
50
50
  api_request "#{endpoint_uri}/period/index", default_options.merge(options)
51
51
  end
52
52
 
@@ -58,7 +58,7 @@ module BlizzardApi
58
58
  # @!macro request_options
59
59
  #
60
60
  # @!macro response
61
- def period(id, options = {})
61
+ def period(id, **options)
62
62
  api_request "#{endpoint_uri}/period/#{id}", default_options.merge(options)
63
63
  end
64
64
 
@@ -68,7 +68,7 @@ module BlizzardApi
68
68
  # @!macro request_options
69
69
  #
70
70
  # @!macro response
71
- def seasons(options = {})
71
+ def seasons(**options)
72
72
  api_request "#{endpoint_uri}/season/index", default_options.merge(options)
73
73
  end
74
74
 
@@ -80,7 +80,7 @@ module BlizzardApi
80
80
  # @!macro request_options
81
81
  #
82
82
  # @!macro response
83
- def season(id, options = {})
83
+ def season(id, **options)
84
84
  api_request "#{endpoint_uri}/season/#{id}", default_options.merge(options)
85
85
  end
86
86