Class: Alephant::Broker::Request::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/alephant/broker/request/factory.rb

Class Method Summary collapse

Class Method Details

.request_for(load_strategy, env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/alephant/broker/request/factory.rb', line 12

def self.request_for(load_strategy, env)
  component_factory = ComponentFactory.new load_strategy

  case request_type_from(env)
  when "component"
    Asset.new(component_factory, env)
  when "components"
    Batch.new(component_factory, env)
  when "status"
    Status.new
  else
    NotFound.new
  end
end

.request_type_from(env) ⇒ Object



8
9
10
# File 'lib/alephant/broker/request/factory.rb', line 8

def self.request_type_from(env)
  env.path.split("/")[1]
end