Class: LibDiscord::Resource Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/lib_discord/resource.rb

Overview

This class is abstract.

Do not interact with or instantiate a Resource class. It is the parent class for discreet Discord resources.

Instance Method Summary collapse

Constructor Details

#initialize(auth_header, base_url, user_agent, logger) ⇒ Resource

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a Resource subclass.

Raises:

  • (Dry::Types::ConstraintError)

    if auth_header, base_url, or user_agent are not of type String.

  • (Dry::Types::ConstraintError)

    if the parameter for logger is not an instance of Logger, or an instance that inherits from Logger.



30
31
32
33
34
35
36
# File 'lib/lib_discord/resource.rb', line 30

def initialize(auth_header, base_url, user_agent, logger)
  @auth_header = Types::Strict::String[auth_header]
  @base_url = Types::Strict::String[base_url]

  @default_headers = {user_agent: Types::Strict::String[user_agent]}
  @logger = Types::Logger[logger]
end