Class: Geocoder::Lookup::Test

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/lookups/test.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#cache, #handle, #initialize, #map_link_url, #query_url, #required_api_key_parts, #search, #supported_protocols

Constructor Details

This class inherits a constructor from Geocoder::Lookup::Base

Class Method Details

.add_stub(query_text, results) ⇒ Object



12
13
14
# File 'lib/geocoder/lookups/test.rb', line 12

def self.add_stub(query_text, results)
  stubs[query_text] = results
end

.read_stub(query_text) ⇒ Object



20
21
22
23
24
25
# File 'lib/geocoder/lookups/test.rb', line 20

def self.read_stub(query_text)
  stubs.fetch(query_text) {
    return @default_stub unless @default_stub.nil?
    raise ArgumentError, "unknown stub request #{query_text}"
  }
end

.resetObject



31
32
33
34
# File 'lib/geocoder/lookups/test.rb', line 31

def self.reset
  @stubs = {}
  @default_stub = nil
end

.set_default_stub(results) ⇒ Object



16
17
18
# File 'lib/geocoder/lookups/test.rb', line 16

def self.set_default_stub(results)
  @default_stub = results
end

.stubsObject



27
28
29
# File 'lib/geocoder/lookups/test.rb', line 27

def self.stubs
  @stubs ||= {}
end

Instance Method Details

#nameObject



8
9
10
# File 'lib/geocoder/lookups/test.rb', line 8

def name
  "Test"
end