Module: AddressFinder

Defined in:
lib/addressfinder.rb,
lib/addressfinder/bulk.rb,
lib/addressfinder/http.rb,
lib/addressfinder/util.rb,
lib/addressfinder/errors.rb,
lib/addressfinder/version.rb,
lib/addressfinder/address_info.rb,
lib/addressfinder/verification.rb,
lib/addressfinder/configuration.rb,
lib/addressfinder/location_info.rb,
lib/addressfinder/address_search.rb,
lib/addressfinder/location_search.rb,
lib/addressfinder/v2/au/verification.rb,
lib/addressfinder/address_autocomplete.rb

Defined Under Namespace

Modules: V2 Classes: AddressAutocomplete, AddressInfo, AddressSearch, Bulk, Configuration, HTTP, LocationInfo, LocationSearch, NotFoundError, RequestRejectedError, Util, Verification

Constant Summary collapse

VERSION =
'1.8.1'

Class Method Summary collapse

Class Method Details

.address_autocomplete(args = {}) ⇒ Object


56
57
58
# File 'lib/addressfinder.rb', line 56

def address_autocomplete(args={})
  AddressFinder::AddressAutocomplete.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
end

.address_info(args = {}) ⇒ Object


60
61
62
# File 'lib/addressfinder.rb', line 60

def address_info(args={})
  AddressFinder::AddressInfo.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.result
end

.address_search(args = {}) ⇒ Object


52
53
54
# File 'lib/addressfinder.rb', line 52

def address_search(args={})
  AddressFinder::AddressSearch.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
end

.bulk(&block) ⇒ Object


64
65
66
# File 'lib/addressfinder.rb', line 64

def bulk(&block)
  AddressFinder::Bulk.new(http: AddressFinder::HTTP.new(configuration), verification_version: configuration.verification_version, default_country: configuration.default_country, &block).perform
end

.cleanse(args = {}) ⇒ Object

We are keeping this method for backward compatibility


32
33
34
# File 'lib/addressfinder.rb', line 32

def cleanse(args={}) # We are keeping this method for backward compatibility
  AddressFinder::Verification.new(args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
end

.configurationObject


28
29
30
# File 'lib/addressfinder.rb', line 28

def configuration
  @configuration ||= AddressFinder::Configuration.new
end

.configure(config_hash = nil) {|configuration| ... } ⇒ Object

Yields:


18
19
20
21
22
23
24
25
26
# File 'lib/addressfinder.rb', line 18

def configure(config_hash=nil)
  if config_hash
    config_hash.each do |k,v|
      configuration.send("#{k}=", v) rescue nil if configuration.respond_to?("#{k}=")
    end
  end

  yield(configuration) if block_given?
end

.location_info(args = {}) ⇒ Object


48
49
50
# File 'lib/addressfinder.rb', line 48

def location_info(args={})
  AddressFinder::LocationInfo.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.result
end

.location_search(args = {}) ⇒ Object


44
45
46
# File 'lib/addressfinder.rb', line 44

def location_search(args={})
  AddressFinder::LocationSearch.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
end

.verification(args = {}) ⇒ Object


36
37
38
39
40
41
42
# File 'lib/addressfinder.rb', line 36

def verification(args={})
  if (args[:country] || configuration.default_country) == 'au' && configuration.verification_version&.downcase == "v2"
    AddressFinder::V2::Au::Verification.new(args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
  else
    AddressFinder::Verification.new(args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
  end
end