Sha256: ebf5aa7bc7b6d6d6378bbc200c7b20921ee478efa5b7a5eb488aa91d19908fb7

Contents?: true

Size: 898 Bytes

Versions: 7

Compression:

Stored size: 898 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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
access-2.0.7 lib/access/location.rb
access-2.0.5 lib/access/location.rb
access-2.0.4 lib/access/location.rb
access-2.0.3 lib/access/location.rb
access-2.0.2 lib/access/location.rb
access-2.0.1 lib/access/location.rb
access-2.0.0 lib/access/location.rb