module MetalArchives

Metal Archives Ruby API

Constants

VERSION

Public Class Methods

config() click to toggle source

API configuration

Instance of MetalArchives::Configuration

# File lib/metal_archives.rb, line 27
def config
  raise MetalArchives::Errors::InvalidConfigurationError, "Gem has not been configured" unless @config

  @config
end
configure() { |config| ... } click to toggle source

Configure API options.

A block must be specified, to which a MetalArchives::Configuration parameter will be passed.

Raises
  • InvalidConfigurationException

# File lib/metal_archives.rb, line 42
def configure
  raise MetalArchives::Errors::InvalidConfigurationError, "No configuration block given" unless block_given?

  @config = MetalArchives::Configuration.new
  yield @config

  raise MetalArchives::Errors::InvalidConfigurationError, "app_name has not been configured" unless MetalArchives.config.app_name && !MetalArchives.config.app_name.empty?
  raise MetalArchives::Errors::InvalidConfigurationError, "app_version has not been configured" unless MetalArchives.config.app_version && !MetalArchives.config.app_version.empty?

  return if MetalArchives.config.app_contact && !MetalArchives.config.app_contact.empty?

  raise MetalArchives::Errors::InvalidConfigurationError, "app_contact has not been configured"
end