Sha256: 7e1647adc7863ecccf14bc50069c368821aaef226aec2de1bc0cf2f19b6d6be9

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 Bytes

Contents

module Aws
  module Plugins
    class UserAgent < Seahorse::Client::Plugin

      option(:user_agent_prefix)

      # @api private
      class Handler < Seahorse::Client::Handler

        def call(context)
          set_user_agent(context)
          @handler.call(context)
        end

        def set_user_agent(context)
          ua = "%s aws-sdk-ruby/#{VERSION} %s/%s %s Seahorse/%s" % [
            context.config.user_agent_prefix,
            (RUBY_ENGINE rescue nil or "ruby"),
            RUBY_VERSION,
            RUBY_PLATFORM,
            Seahorse::VERSION,
          ]
          context.http_request.headers['User-Agent'] = ua.strip
        end

      end

      handler(Handler)

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.0.rc2 lib/aws/plugins/user_agent.rb
aws-sdk-core-2.0.0.rc1 lib/aws/plugins/user_agent.rb