Sha256: e5f36f2bf645231407951d8e2c045d412dc07b1ae4712a735f999fe30ac86d11

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

module Uatu
  module Configuration

    VALID_CONFIG_KEYS = [:public_key, :private_key]

    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 credentials
      Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
    end

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uatu-marvel-0.1.0 lib/uatu/configuration.rb