lib/alephant/lookup/lookup_location.rb in alephant-lookup-0.1.2 vs lib/alephant/lookup/lookup_location.rb in alephant-lookup-0.1.3

- old
+ new

@@ -1,23 +1,29 @@ +require 'crimp' + module Alephant module Lookup class LookupLocation - S3_LOCATION_FIELD = 'location' + attr_reader :component_id, :component_key, :opts, :opts_hash, :batch_version + attr_accessor :location - attr_reader :component_id, :opts, :location - - def initialize(component_id, opts, location) + def initialize(component_id, batch_version, opts, location = nil) @component_id = component_id + @batch_version = batch_version @opts = opts + @opts_hash = hash_for(opts) @location = location end - def to_h - { - :component_id => @component_id, - :opts => opts, - S3_LOCATION_FIELD => @location - } + def component_key + "#{component_id}/#{opts_hash}" end + + private + + def hash_for(opts) + Crimp.signature opts + end + end end end