Sha256: f1f440049d0c13f4942b5a67f43140ec70a69e6cd069593f4270e65bd820286e

Contents?: true

Size: 626 Bytes

Versions: 3

Compression:

Stored size: 626 Bytes

Contents

module Uatu
  module Configuration

    VALID_CONFIG_KEYS = [:base_url, :public_key, :private_key]

    BASE_URL        = "http://gateway.marvel.com"
    PUBLIC_KEY      = ENV["MARVEL_PUBLIC_KEY"]
    PRIVATE_KEY     = ENV["MARVEL_PRIVATE_KEY"]
    
    attr_accessor *VALID_CONFIG_KEYS

    def self.extended(base)
      base.reset
    end

    def configure
      yield self
    end

    def options
      Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
    end

    def reset
      self.base_url     = BASE_URL
      self.public_key   = PUBLIC_KEY
      self.private_key  = PRIVATE_KEY
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uatu-marvel-0.0.2 lib/uatu/configuration.rb
uatu-marvel-0.0.1.1 lib/uatu/configuration.rb
uatu-marvel-0.0.1 lib/uatu/configuration.rb