Sha256: f0a8962bf0c783a9447991f2b77aaa6a092c10b008e31197bdfcad8c0b131b10

Contents?: true

Size: 365 Bytes

Versions: 5

Compression:

Stored size: 365 Bytes

Contents

module Tumbz
  module Middleware
    class ApiKey < Faraday::Middleware
      def initialize(app, options={})
        @app = app
        @options = options
      end

      def call(env)
        env[:url].query = env[:url].query ? "#{env[:url].query}&apikey=#{@options[:api_key]}" : "apikey=#{@options[:api_key]}"
        @app.call(env)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tumbz-0.0.5 lib/tumbz/middleware/api_key.rb
tumbz-0.0.4 lib/tumbz/middleware/api_key.rb
tumbz-0.0.3 lib/tumbz/middleware/api_key.rb
tumbz-0.0.2 lib/tumbz/middleware/api_key.rb
tumbz-0.0.1 lib/tumbz/middleware/api_key.rb