Class: Arkaan::Utils::Plugins::Heroku
- Inherits:
-
Object
- Object
- Arkaan::Utils::Plugins::Heroku
- Defined in:
- lib/virtuaservices/utils/loaders/heroku.rb
Class Method Summary collapse
-
.load!(instance) ⇒ Object
Loads the heroku informations inside the data of the instance.
Class Method Details
.load!(instance) ⇒ Object
Loads the heroku informations inside the data of the instance.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/virtuaservices/utils/loaders/heroku.rb', line 7 def self.load!(instance) if !ENV['OAUTH_TOKEN'].nil? && instance != false && instance.persisted? heroku = PlatformAPI.connect_oauth(ENV['OAUTH_TOKEN']) regex = /\Ahttps?:\/\/([a-z\-]+).herokuapp.com\/?\z/ if instance.url.match(regex) app_name = instance.url.scan(regex).first.first instance.update_attribute(:data, heroku.app.info(app_name)) end end end |