Module: Geoloco::Adapters::Fake

Defined in:
lib/geoloco/adapters/fake.rb

Overview

Fake geocoding adapter

Constant Summary collapse

DEFAULT_GEO =
Geoloco::Geometry.new(lat: -19.9191248, lng: -43.9386291)

Class Method Summary collapse

Class Method Details

.geocode(address, **_options) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/geoloco/adapters/fake.rb', line 10

def geocode(address, **_options)
  location = @stub || Geoloco::Location.new(
    geometry: DEFAULT_GEO,
    full_address: address
  )
  [location]
end

.stubbing(location) ⇒ Object



18
19
20
21
22
# File 'lib/geoloco/adapters/fake.rb', line 18

def stubbing(location)
  @stub = location
  yield
  @stub = nil
end