Class: AddressFinder::Cleanse

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

Defined Under Namespace

Classes: Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Cleanse.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/addressfinder/cleanse.rb', line 8

def initialize(q:, country: nil, delivered: nil, post_box: nil, rural: nil, region_code: nil, state_codes: nil, census: nil, domain: nil, key: nil, secret: nil, http:)
  @params = {}
  @params['q'] = q
  @params['delivered'] = delivered if delivered
  @params['post_box'] = post_box if post_box
  @params['rural'] = rural if rural
  @params['region_code'] = region_code if region_code
  @params['state_codes'] = state_codes if state_codes
  @params['census'] = census if census
  @params['domain'] = domain || config.domain if (domain || config.domain)
  @params['format'] = 'json'
  @params['key'] = key || config.api_key
  @params['secret'] = secret || config.api_secret
  @country = country || config.default_country
  @http = http
end

Instance Attribute Details

#resultObject

Returns the value of attribute result.



6
7
8
# File 'lib/addressfinder/cleanse.rb', line 6

def result
  @result
end

Instance Method Details

#performObject



25
26
27
28
29
30
31
# File 'lib/addressfinder/cleanse.rb', line 25

def perform
  build_request
  execute_request
  build_result

  self
end