Class: Heroku::Kensa::PlanChangeCheck
- Includes:
- HTTP
- Defined in:
- lib/heroku/kensa/check.rb
Instance Attribute Summary
Attributes inherited from Check
Instance Method Summary collapse
Methods included from HTTP
#delete, #get, #post, #put, #request
Methods inherited from ApiCheck
#base_path, #callback, #create_provision_payload, #credentials, #heroku_id
Methods inherited from Check
#api_requires?, #call, #check, #env, #error, #initialize, #run, #test, #to_proc, #url
Constructor Details
This class inherits a constructor from Heroku::Kensa::Check
Instance Method Details
#call! ⇒ Object
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/heroku/kensa/check.rb', line 455 def call! id = data[:id] raise ArgumentError, "No id specified" if id.nil? new_plan = data[:plan] raise ArgumentError, "No plan specified" if new_plan.nil? path = "#{base_path}/#{CGI::escape(id.to_s)}" payload = {:plan => new_plan, :heroku_id => heroku_id} test "PUT #{path}" check "response" do code, _ = put(credentials, path, payload) 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, _ = put(wrong_credentials, path, payload) error("expected 401, got #{code}") if code != 401 true end end |