Sha256: 9b725618c702b03ade048b5f44f04f307e9950ea719d0e6089b1c424668f6278

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

require_relative 'version'

module HN
  module Configuration

    VALID_CONFIGURATION_KEYS = [:api_url, :headers]

    attr_accessor *VALID_CONFIGURATION_KEYS

    DEFAULT_API_URL  = 'https://hacker-news.firebaseio.com/v0/'
    DEFAULT_HEADERS  = { accept:     'application/json',
                         user_agent: "hn_api gem #{HN::Version}" }

    def configure
      yield self
    end

    def reset
      self.api_url     = DEFAULT_API_URL
      self.headers     = DEFAULT_HEADERS
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hn_api-0.0.2 lib/hn/configuration.rb