Class: AddressStandardization::AbstractService

Inherits:
Object
  • Object
show all
Extended by:
ClassLevelInheritableAttributes
Defined in:
lib/address_standardization/abstract_service.rb

Direct Known Subclasses

GoogleMaps, MelissaData

Class Method Summary collapse

Methods included from ClassLevelInheritableAttributes

cattr_inheritable, inherited

Class Method Details

.standardize_address(address_info) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/address_standardization/abstract_service.rb', line 8

def standardize_address(address_info)
  if AddressStandardization.test_mode?
    get_canned_response(address_info)
  else
    get_live_response(address_info)
  end
end

.with_canned_response(response, &block) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/address_standardization/abstract_service.rb', line 16

def with_canned_response(response, &block)
  old_response = self.canned_response
  self.canned_response = response
  ret = yield
  self.canned_response = old_response
  ret
end