lib/fastly/client.rb in fastly-1.4.0 vs lib/fastly/client.rb in fastly-1.4.1

- old
+ new

@@ -11,11 +11,11 @@ def initialize(opts) @api_key = opts.fetch(:api_key, nil) @user = opts.fetch(:user, nil) @password = opts.fetch(:password, nil) @customer = opts.fetch(:customer, nil) - @oldpurge = opts.fetch(:use_old_purge_method, false) + @oldpurge = opts.fetch(:use_old_purge_method, false) base = opts.fetch(:base_url, 'https://api.fastly.com') uri = URI.parse(base) options = if uri.is_a? URI::HTTPS { @@ -115,10 +115,10 @@ JSON.parse(resp.body) end def headers(extras={}) headers = fully_authed? ? { 'Cookie' => cookie } : { 'Fastly-Key' => api_key } - headers.merge('Content-Accept' => 'application/json').merge(extras.keep_if {|k,v| !v.nil? }) + headers.merge('Content-Accept' => 'application/json', 'User-Agent' => "fastly-ruby-v#{Fastly::VERSION}").merge(extras.keep_if {|k,v| !v.nil? }) end def make_params(params) param_ary = params.map do |key, value| next if value.nil?