Class: Heroku::Kensa::ApiCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/heroku/kensa/check.rb

Instance Attribute Summary

Attributes inherited from Check

#data, #screen

Instance Method Summary collapse

Methods inherited from Check

#api_requires?, #call, #check, #env, #error, #initialize, #run, #test, #to_proc, #url, #warning

Constructor Details

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

Instance Method Details

#base_pathObject



263
264
265
266
267
268
269
# File 'lib/heroku/kensa/check.rb', line 263

def base_path
  if data['api'][env].is_a? Hash
    URI.parse(data['api'][env]['base_url']).path
  else
    '/heroku/resources'
  end
end

#callbackObject



279
280
281
# File 'lib/heroku/kensa/check.rb', line 279

def callback
  "http://localhost:7779/callback/999"
end

#create_provision_payloadObject



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/heroku/kensa/check.rb', line 283

def create_provision_payload
  payload = {
    :heroku_id => heroku_id,
    :plan => data[:plan] || 'test',
    :callback_url => callback,
    :logplex_token => nil,
    :region => "amazon-web-services::us-east-1",
    :options => data[:options] || {},
    :uuid => SecureRandom.uuid
  }

  if api_requires?("syslog_drain")
    payload[:log_drain_token] = SecureRandom.hex
  end
  payload
end

#credentialsObject



275
276
277
# File 'lib/heroku/kensa/check.rb', line 275

def credentials
  [ data['id'], data['api']['password'] ]
end

#heroku_idObject



271
272
273
# File 'lib/heroku/kensa/check.rb', line 271

def heroku_id
  "app#{rand(10000)}@kensa.heroku.com"
end