Sha256: 96cda4606dbc2e87715fac72938b72c323c54544906dfe9fd41db6af0f29edda

Contents?: true

Size: 771 Bytes

Versions: 9

Compression:

Stored size: 771 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

9 entries across 9 versions & 1 rubygems

Version Path
alephant-broker-3.18.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.17.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.16.2 lib/alephant/broker/request/asset.rb
alephant-broker-3.16.1 lib/alephant/broker/request/asset.rb
alephant-broker-3.16.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.15.2 lib/alephant/broker/request/asset.rb
alephant-broker-3.15.1 lib/alephant/broker/request/asset.rb
alephant-broker-3.15.0 lib/alephant/broker/request/asset.rb
alephant-broker-3.14.0 lib/alephant/broker/request/asset.rb