class PixivApi::Configuration
Constants
- OPTIONAL_KEYS
- REQUIRED_KEYS
Public Instance Methods
[]=(key, value)
click to toggle source
Calls superclass method
# File lib/pixiv_api/configuration.rb, line 26 def []=(key, value) if allowed_keys.include?(key) super else raise InvalidKeyError, "#{key} is not configuration key." end end
cache_dir()
click to toggle source
# File lib/pixiv_api/configuration.rb, line 22 def cache_dir self[:cache_dir] || Dir.mktmpdir('pixiv-api') end
require_keys!()
click to toggle source
# File lib/pixiv_api/configuration.rb, line 34 def require_keys! REQUIRED_KEYS.each do |key| raise MissingConfigurationError, "configuration requires '#{key}'" unless self[key] end self end
Private Instance Methods
allowed_keys()
click to toggle source
# File lib/pixiv_api/configuration.rb, line 44 def allowed_keys REQUIRED_KEYS + OPTIONAL_KEYS end