Sha256: a192548c36e90e3a2c8a45e5b1e52ebf51f02872e75494818c3f7a08e7ac70f1
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
require 'alephant/broker/errors/invalid_asset_id' require 'alephant/broker/models/request' module Alephant module Broker class GetRequest < Request attr_reader :type, :component_id, :extension, :options, :content_type def initialize env = RequestStore.store[:env] parse requested_components(env.path, env.query) super(:asset) end def requested_components(path, query_string) request_parts = path.split('/') { :type => get_type_from(request_parts), :component_id => get_component_id_from(request_parts), :extension => get_extension_for(path), :options => options_from(query_string) } end def parse(request) @component_id = request[:component_id] @extension = request[:extension] @options = request[:options] @content_type = @@extension_mapping[@extension.to_sym] || @@extension_mapping[DEFAULT_EXTENSION] logger.info("Broker.request: Type: #{@type}, Asset ID: #{@component_id}, Options: #{@options.inspect}") raise InvalidAssetId.new("No Asset ID specified") if @component_id.nil? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alephant-broker-0.1.1 | lib/alephant/broker/models/request/get_request.rb |
alephant-broker-0.1.0 | lib/alephant/broker/models/request/get_request.rb |