modified_crafting.rb 1.94 KB
Newer Older
Francis's avatar
Francis committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
# frozen_string_literal: true

module BlizzardApi
  module Wow
    ##
    # This class allows access to World of Warcraft professions
    #
    # @see https://develop.battle.net/documentation/api-reference/world-of-warcraft-game-data-api
    #
    # You can get an instance of this class using the default region as follows:
    #   api_instance = BlizzardApi::Wow.modified_crafting
    class ModifiedCrafting < Wow::GenericDataEndpoint
      def complete
        raise BlizzardApi::ApiException, 'This endpoint does not have a complete method.'
      end

      ##
      # Fetch modified crafting category index
      #
      # @!macro request_options
      def categories(options = {})
        api_request "#{base_url(:game_data)}/modified-crafting/category/index", default_options.merge(options)
      end

      ##
      # Fetch a modified crafting category
      #
      # @param id [Integer] Modified crafting category id
      #
      # @!macro request_options
      #
      # @!macro response
      def category(id, options = {})
        api_request "#{base_url(:game_data)}/modified-crafting/category/#{id}", default_options.merge(options)
      end

      ##
      # Fetch modified crafting slot type index
      #
      # @!macro request_options
      def slot_types(options = {})
        api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/index", default_options.merge(options)
      end

      ##
      # Fetch a modified crafting slot type
      #
      # @param id [Integer] Modified crafting slot type id
      #
      # @!macro request_options
      #
      # @!macro response
      def slot_type(id, options = {})
        api_request "#{base_url(:game_data)}/modified-crafting/reagent-slot-type/#{id}", default_options.merge(options)
      end

      protected

      def endpoint_setup
        @endpoint = 'modified-crafting'
        @namespace = :static
        @collection = 'professions'
        @ttl = CACHE_TRIMESTER
      end
    end
  end
end