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.28 lib/access/location.rb
access-2.0.27 lib/access/location.rb
access-2.0.26 lib/access/location.rb
access-2.0.25 lib/access/location.rb
access-2.0.24 lib/access/location.rb
access-2.0.23 lib/access/location.rb
access-2.0.22 lib/access/location.rb
access-2.0.21 lib/access/location.rb
access-2.0.20 lib/access/location.rb
access-2.0.19 lib/access/location.rb
access-2.0.18 lib/access/location.rb
access-2.0.17 lib/access/location.rb
access-2.0.15 lib/access/location.rb
access-2.0.14 lib/access/location.rb
access-2.0.13 lib/access/location.rb
access-2.0.11 lib/access/location.rb
access-2.0.10 lib/access/location.rb
access-2.0.9 lib/access/location.rb
access-2.0.8 lib/access/location.rb