Sha256: ac7e11ae8f06ffb44d0e01d8ac13d5bddd5edc0fb58af8d9fe362fda3bc34e83

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

module Access
  class Geolocation
    attr_accessor :lat, :lon

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

    def self.find(options = {})
      Access::Api.new.geolocation_find options
    end

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

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

      @lat = @geolocation['lat']
      @lon = @geolocation['lon']
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
access-2.0.24 lib/access/geolocation.rb