Class: AddressFinder::Verification

Inherits:
Object
  • Object
show all
Defined in:
lib/addressfinder/verification.rb

Defined Under Namespace

Classes: Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(q:, http:, post_box: nil, census: nil, domain: nil, key: nil, secret: nil, state_codes: nil, delivered: nil, rural: nil, region_code: nil, country: nil) ⇒ Verification

Combined attributes params –> the address query, params –> used for reporting does not affect query results params –> unique AddressFinder public key params –> unique AddressFinder secret key



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/addressfinder/verification.rb', line 23

def initialize(q:, http:, post_box: nil, census: nil, domain: nil, key: nil, secret: nil, state_codes: nil,
  delivered: nil, rural: nil, region_code: nil, country: nil)
  @params = {}
  # Common to AU and NZ
  @params["q"] = q
  @params["post_box"] = post_box if post_box
  @params["census"] = census if census
  @params["domain"] = domain || config.domain if domain || config.domain
  @params["key"] = key || config.api_key
  @params["secret"] = secret || config.api_secret
  # AU params
  @params["state_codes"] = state_codes if state_codes
  # NZ params
  @params["delivered"] = delivered if delivered
  @params["rural"] = rural if rural
  @params["region_code"] = region_code if region_code
  @country = country || config.default_country

  @params["format"] = "json"
  @http = http
end

Instance Attribute Details

#resultObject

Returns the value of attribute result.



5
6
7
# File 'lib/addressfinder/verification.rb', line 5

def result
  @result
end

Instance Method Details

#performObject



45
46
47
48
49
50
51
# File 'lib/addressfinder/verification.rb', line 45

def perform
  build_request
  execute_request
  build_result

  self
end