Sha256: eed198863cdff35a21ff1843fa7d42841bc0583ab8121146412284b62c86af64

Contents?: true

Size: 800 Bytes

Versions: 3

Compression:

Stored size: 800 Bytes

Contents

require 'alephant/logger'
require 'alephant/broker/component'
require 'alephant/broker/errors/invalid_asset_id'

module Alephant
  module Broker
    module Request
      class Asset
        include Logger

        attr_reader :component

        def initialize(env)
          logger.info("Request::Asset#initialize(#{env.settings})")
          component_id = component_id_for env.path

          @component = Component.new(
            component_id,
            nil,
            env.options
          )

          logger.info("Request::Asset#initialize: id: #{component_id}")
          raise InvalidAssetId.new("No Asset ID specified") if component_id.nil?
        end

        private

        def component_id_for(path)
          path.split('/')[2] || nil
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alephant-broker-1.0.2 lib/alephant/broker/request/asset.rb
alephant-broker-1.0.1 lib/alephant/broker/request/asset.rb
alephant-broker-1.0.0 lib/alephant/broker/request/asset.rb