class Virtuaservices::Factories::Gateways
This class provides methods to create decorated services. @author Vincent Courtois <courtois.vincent@outlook.com>
Public Class Methods
random(action)
click to toggle source
Searches for a gateway via its key and returns it decorated. @param key [String] the key of the server you want to find. @return [Virtuaservices::Decorators::Gateway, NilClass] nil if the gateway is not found, or the decorated gateway.
# File lib/virtuaservices/factories/gateways.rb, line 10 def self.random(action) gateway = Virtuaservices::Monitoring::Gateway.where(active: true, running: true).first if gateway.nil? raise Virtuaservices::Factories::Errors::GatewayNotFound.new(action: action) end return Virtuaservices::Decorators::Gateway.new(action, gateway) end