Class: Heroku::Samorau::DeprovisionCheck

Inherits:
ApiCheck show all
Includes:
HTTP
Defined in:
lib/heroku/samorau.rb

Instance Attribute Summary

Attributes inherited from Check

#data, #screen

Instance Method Summary collapse

Methods included from HTTP

#delete, #get, #post, #request

Methods inherited from ApiCheck

#credentials, #url

Methods inherited from Check

#call, #check, #error, #initialize, #run, #test, #to_proc

Constructor Details

This class inherits a constructor from Heroku::Samorau::Check

Instance Method Details

#call!Object

Raises:

  • (ArgumentError)


428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/heroku/samorau.rb', line 428

def call!
  id = data[:id]
  raise ArgumentError, "No id specified" if id.nil?

  path = "/heroku/resources/#{id}"

  test "DELETE #{path}"
  check "response" do
    code, _ = delete(credentials, path, nil)
    if code == 200
      true
    elsif code == -1
      error("unable to connect to #{url}")
    else
      error("expected 200, got #{code}")
    end
  end

  check "authentication" do
    wrong_credentials = ['wrong', 'secret']
    code, _ = delete(wrong_credentials, path, nil)
    error("expected 401, got #{code}") if code != 401
    true
  end

end