Sha256: 3a7a2e57ae12fb146ea2e234bb1326a8a575316958dc9a067af596c12aab6e82

Contents?: true

Size: 901 Bytes

Versions: 2

Compression:

Stored size: 901 Bytes

Contents

require 'designer_news/version'
require 'designer_news/middleware/raise_error'

module DesignerNews
  module Default

    API_ENDPOINT = "https://api-news.layervault.com/api/v1/".freeze
    USER_AGENT   = "Designer News Ruby Gem #{DesignerNews::VERSION}".freeze

    MIDDLEWARE = Faraday::Builder.new do |builder|
      builder.use DesignerNews::Middleware::RaiseError
      builder.request :url_encoded
      builder.adapter Faraday.default_adapter
    end

    class << self
      def options
        Hash[DesignerNews::Configurable.keys.map{|key| [key, send(key)]}]
      end

      def access_token
        ENV['DESIGNER_NEWS_ACCESS_TOKEN']
      end

      def api_endpoint
        ENV['DESIGNER_NEWS_API_ENDPOINT'] || API_ENDPOINT
      end

      def user_agent
        ENV['DESIGNER_NEWS_USER_AGENT'] || USER_AGENT
      end

      def middleware
        MIDDLEWARE
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dn-0.1.0 lib/designer_news/default_options.rb
dn-0.0.1 lib/designer_news/default_options.rb