Sha256: 12b67010c433857e65c277f222e09003da8f6d8b5c54a417201c6454c2e2af9a

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

# frozen_string_literal: true

module ExtraSpace
  # e.g. https://www.extraspace.com/storage/facilities/us/alabama/auburn/3264/
  class Geocode
    # @attribute [rw] latitude
    #   @return [Float]
    attr_accessor :latitude

    # @attribute [rw] longitude
    #   @return [Float]
    attr_accessor :longitude

    # @param latitude [Float]
    # @param longitude [Float]
    def initialize(latitude:, longitude:)
      @latitude = latitude
      @longitude = longitude
    end

    # @return [String]
    def inspect
      props = [
        "latitude=#{@latitude.inspect}",
        "longitude=#{@longitude.inspect}"
      ]
      "#<#{self.class.name} #{props.join(' ')}>"
    end

    # @param data [Hash]
    #
    # @return [Geocode]
    def self.parse(data:)
      new(
        latitude: data['latitude'],
        longitude: data['longitude']
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
extraspace-0.1.1 lib/extraspace/geocode.rb
extraspace-0.1.0 lib/extraspace/geocode.rb