lib/heroku/api.rb in heroku-api-0.3.9 vs lib/heroku/api.rb in heroku-api-0.3.10

- old
+ new

@@ -55,12 +55,14 @@ def initialize(options={}) options = OPTIONS.merge(options) @api_key = options.delete(:api_key) || ENV['HEROKU_API_KEY'] if !@api_key && options.has_key?(:username) && options.has_key?(:password) + username = options.delete(:username) + password = options.delete(:password) @connection = Excon.new("#{options[:scheme]}://#{options[:host]}", options.merge(:headers => HEADERS)) - @api_key = self.post_login(options[:username], options[:password]).body["api_key"] + @api_key = self.post_login(username, password).body["api_key"] end user_pass = ":#{@api_key}" options[:headers] = HEADERS.merge({ 'Authorization' => "Basic #{Base64.encode64(user_pass).gsub("\n", '')}", @@ -84,9 +86,10 @@ Heroku::API::Errors::NotFound end when 408 then Heroku::API::Errors::Timeout when 422 then Heroku::API::Errors::RequestFailed when 423 then Heroku::API::Errors::Locked + when 429 then Heroku::API::Errors::RateLimitExceeded when /50./ then Heroku::API::Errors::RequestFailed else Heroku::API::Errors::ErrorWithResponse end reerror = klass.new(error.message, error.response)