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/v1/base.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,
lib/addressfinder/v1/email/verification.rb,
lib/addressfinder/v1/phone/verification.rb,
lib/addressfinder/v1/nz/batch_verification.rb,
lib/addressfinder/v2/au/batch_verification.rb,
lib/addressfinder/v1/email/batch_verification.rb

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"1.13.0"

Class Method Summary collapse

Class Method Details

.address_autocomplete(args = {}) ⇒ Object



79
80
81
# File 'lib/addressfinder.rb', line 79

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

.address_info(args = {}) ⇒ Object



83
84
85
# File 'lib/addressfinder.rb', line 83

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

.address_search(args = {}) ⇒ Object



75
76
77
# File 'lib/addressfinder.rb', line 75

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

.address_verification(args = {}) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/addressfinder.rb', line 43

def address_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

.address_verification_au_batch(args = {}) ⇒ Object



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

def address_verification_au_batch(args = {})
  AddressFinder::V2::Au::BatchVerification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.results
end

.address_verification_nz_batch(args = {}) ⇒ Object



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

def address_verification_nz_batch(args = {})
  AddressFinder::V1::Nz::BatchVerification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.results
end

.bulk(&block) ⇒ Object



99
100
101
102
103
# File 'lib/addressfinder.rb', line 99

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



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

def cleanse(args = {}) # We are keeping this method for backward compatibility
  address_verification(args)
end

.configurationObject



39
40
41
# File 'lib/addressfinder.rb', line 39

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

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

Yields:



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/addressfinder.rb', line 25

def configure(config_hash = nil)
  config_hash&.each do |k, v|
    next unless configuration.respond_to?(:"#{k}=")

    begin
      configuration.send(:"#{k}=", v)
    rescue
      nil
    end
  end

  yield(configuration) if block_given?
end

.email_verification(args = {}) ⇒ Object



87
88
89
# File 'lib/addressfinder.rb', line 87

def email_verification(args = {})
  AddressFinder::V1::Email::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
end

.email_verification_batch(args = {}) ⇒ Object



91
92
93
# File 'lib/addressfinder.rb', line 91

def email_verification_batch(args = {})
  AddressFinder::V1::Email::BatchVerification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.results
end

.location_info(args = {}) ⇒ Object



71
72
73
# File 'lib/addressfinder.rb', line 71

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

.location_search(args = {}) ⇒ Object



67
68
69
# File 'lib/addressfinder.rb', line 67

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

.phone_verification(args = {}) ⇒ Object



95
96
97
# File 'lib/addressfinder.rb', line 95

def phone_verification(args = {})
  AddressFinder::V1::Phone::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
end

.verification(args = {}) ⇒ Object

We are keeping this method for backward compatibility



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

def verification(args = {}) # We are keeping this method for backward compatibility
  address_verification(args)
end