Class: Jikanrb::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/jikanrb/configuration.rb

Overview

Configuration class for Jikanrb client. Allows customization of timeouts, retries, and other HTTP client settings.

Examples:

config = Jikanrb::Configuration.new
config.read_timeout = 15
config.max_retries = 5

Constant Summary collapse

DEFAULT_BASE_URL =

Base URL for Jikan v4 API

'https://api.jikan.moe/v4'
DEFAULT_OPEN_TIMEOUT =

Default timeouts (in seconds)

5
DEFAULT_READ_TIMEOUT =
10
DEFAULT_MAX_RETRIES =

Rate limit: Jikan allows 60 requests/minute

3
DEFAULT_RETRY_INTERVAL =
1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



31
32
33
34
35
36
37
38
39
# File 'lib/jikanrb/configuration.rb', line 31

def initialize
  @base_url = DEFAULT_BASE_URL
  @open_timeout = DEFAULT_OPEN_TIMEOUT
  @read_timeout = DEFAULT_READ_TIMEOUT
  @max_retries = DEFAULT_MAX_RETRIES
  @retry_interval = DEFAULT_RETRY_INTERVAL
  @user_agent = "Jikanrb Ruby Gem/#{Jikanrb::VERSION}"
  @logger = nil
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



23
24
25
# File 'lib/jikanrb/configuration.rb', line 23

def base_url
  @base_url
end

#loggerObject

Returns the value of attribute logger.



23
24
25
# File 'lib/jikanrb/configuration.rb', line 23

def logger
  @logger
end

#max_retriesObject

Returns the value of attribute max_retries.



23
24
25
# File 'lib/jikanrb/configuration.rb', line 23

def max_retries
  @max_retries
end

#open_timeoutObject

Returns the value of attribute open_timeout.



23
24
25
# File 'lib/jikanrb/configuration.rb', line 23

def open_timeout
  @open_timeout
end

#read_timeoutObject

Returns the value of attribute read_timeout.



23
24
25
# File 'lib/jikanrb/configuration.rb', line 23

def read_timeout
  @read_timeout
end

#retry_intervalObject

Returns the value of attribute retry_interval.



23
24
25
# File 'lib/jikanrb/configuration.rb', line 23

def retry_interval
  @retry_interval
end

#user_agentObject

Returns the value of attribute user_agent.



23
24
25
# File 'lib/jikanrb/configuration.rb', line 23

def user_agent
  @user_agent
end