Sha256: 490ebf2581cc08200876a2441bd095afc3c2f133e75176579e90f2b42b4d2498

Contents?: true

Size: 772 Bytes

Versions: 18

Compression:

Stored size: 772 Bytes

Contents

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

module Alephant
  module Broker
    module Request
      class Asset
        include Logger

        attr_accessor :component

        def initialize(component_factory, env = nil)
          return if env.nil?
          @component = component_factory.create(
            component_id(env.path),
            nil,
            env.options
          )
        rescue InvalidAssetId
          logger.metric "InvalidAssetId"
          logger.error "Broker.Request.Asset.initialize: Exception raised (InvalidAssetId)"
        end

        private

        def component_id(path)
          path.split('/')[2] || (raise InvalidAssetId.new 'No Asset ID specified')
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
alephant-broker-3.13.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.12.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.11.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.10.2 lib/alephant/broker/request/asset.rb
alephant-broker-3.10.1 lib/alephant/broker/request/asset.rb
alephant-broker-3.10.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.9.2 lib/alephant/broker/request/asset.rb
alephant-broker-3.9.1 lib/alephant/broker/request/asset.rb
alephant-broker-3.9.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.8.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.7.1 lib/alephant/broker/request/asset.rb
alephant-broker-3.7.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.6.1 lib/alephant/broker/request/asset.rb
alephant-broker-3.6.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.5.5 lib/alephant/broker/request/asset.rb
alephant-broker-3.5.4 lib/alephant/broker/request/asset.rb
alephant-broker-3.5.3 lib/alephant/broker/request/asset.rb
alephant-broker-3.5.2 lib/alephant/broker/request/asset.rb