Class: VWorkApp::Location

Inherits:
Base
  • Object
show all
Defined in:
lib/vworkapp_ruby/location.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#attributes, #attributes=, #attributes_eql?, hattr_accessor, hattr_reader, hattr_writer, hattrs, #hattrs, #initialize, #read_attributes, #read_attributes=, read_hattrs, #read_hattrs, #validate_and_raise, #write_attributes, #write_attributes=, #write_hattrs, write_hattrs

Constructor Details

This class inherits a constructor from VWorkApp::Base

Class Method Details

.from_address(address, region = :us) ⇒ Object



6
7
8
9
# File 'lib/vworkapp_ruby/location.rb', line 6

def self.from_address(address, region = :us)
  loc = Location.geocode(address, region).first.geometry.location
  self.new(:formmated_address => address, :lat => loc.lat, :lng => loc.lng)
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
# File 'lib/vworkapp_ruby/location.rb', line 11

def ==(other)
  attributes_eql?(other, :lat, :lng)
end