Class: Arkaan::Factories::Gateways
- Inherits:
-
Object
- Object
- Arkaan::Factories::Gateways
- Defined in:
- lib/arkaan/factories/gateways.rb
Overview
This class provides methods to create decorated services.
Class Method Summary collapse
-
.random(action) ⇒ Arkaan::Decorators::Gateway, NilClass
Searches for a gateway via its key and returns it decorated.
Class Method Details
.random(action) ⇒ Arkaan::Decorators::Gateway, NilClass
Searches for a gateway via its key and returns it decorated.
10 11 12 13 14 15 16 |
# File 'lib/arkaan/factories/gateways.rb', line 10 def self.random(action) gateway = Arkaan::Monitoring::Gateway.where(active: true, running: true).first if gateway.nil? raise Arkaan::Factories::Errors::GatewayNotFound.new(action) end return Arkaan::Decorators::Gateway.new(action, gateway) end |