Sha256: 75911b3eff81b8a0b383b3703a52237b0d857b120b3b64823f5cafd06fdd8d61

Contents?: true

Size: 966 Bytes

Versions: 39

Compression:

Stored size: 966 Bytes

Contents

module Access
  class Location

    def self.search(options = {})
      Access::Api.new.search_locations options
    end

    def self.find(location_key, options = {})
      Access::Api.new.find_location location_key, options
    end

    def self.process_batch(chunk)
      chunk.map { |location| new(location) }
    end

    def initialize(values)
      self.class.class_eval {attr_reader *values.keys } if values
      values.each do |attribute_name, attribute_value|
        self.instance_variable_set("@#{attribute_name}", attribute_value)
      end

      @links = Access::Link.new(@links) if @links
      @location_store = Access::Store.new(@location_store) if @location_store
      @location_categories = Access::Category.process_batch(@location_categories) if @location_categories
      @physical_location = Access::Location.new(@physical_location) if @physical_location
      @geolocation = Geolocation.new(@geolocation) if @geolocation
    end

  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
access-2.0.50 lib/access/location.rb
access-2.0.49 lib/access/location.rb
access-2.0.48 lib/access/location.rb
access-2.0.47 lib/access/location.rb
access-2.0.46 lib/access/location.rb
access-2.0.44 lib/access/location.rb
access-2.0.43 lib/access/location.rb
access-2.0.42 lib/access/location.rb
access-2.0.41 lib/access/location.rb
access-2.0.40 lib/access/location.rb
access-2.0.39 lib/access/location.rb
access-2.0.38 lib/access/location.rb
access-2.0.37 lib/access/location.rb
access-2.0.36 lib/access/location.rb
access-2.0.34 lib/access/location.rb
access-2.0.33 lib/access/location.rb
access-2.0.32 lib/access/location.rb
access-2.0.31 lib/access/location.rb
access-2.0.30 lib/access/location.rb
access-2.0.29 lib/access/location.rb