Class: SmartyStreets::USAutocompletePro::Lookup

Inherits:
JSONAble
  • Object
show all
Defined in:
lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb

Overview

In addition to holding all of the input data for this lookup, this class also will contain the result of the lookup after it comes back from the API.

See "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-request-input-fields"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from JSONAble

#from_json!, #to_json

Constructor Details

#initialize(search = nil, max_results = nil, city_filter = nil, state_filter = nil, zip_filter = nil, exclude_states = nil, prefer_cities = nil, prefer_states = nil, prefer_zips = nil, prefer_ratio = nil, prefer_geolocation = nil, selected = nil, source = nil, custom_param_hash = nil) ⇒ Lookup

Returns a new instance of Lookup.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 15

def initialize(search=nil, max_results=nil, city_filter=nil, state_filter=nil, zip_filter=nil,
               exclude_states=nil, prefer_cities=nil, prefer_states=nil, prefer_zips=nil, prefer_ratio=nil,
               prefer_geolocation=nil, selected=nil, source=nil, custom_param_hash=nil)
  @result = []
  @search = search
  @max_results = max_results
  @city_filter = city_filter ? city_filter : []
  @state_filter = state_filter ? state_filter : []
  @zip_filter = zip_filter ? zip_filter : []
  @exclude_states = exclude_states ? exclude_states : []
  @prefer_cities = prefer_cities ? prefer_cities : []
  @prefer_states = prefer_states ? prefer_states : []
  @prefer_zip_codes = prefer_zips ? prefer_zips : []
  @prefer_ratio = prefer_ratio
  @prefer_geolocation = prefer_geolocation
  @selected = selected
  @source = source
  @custom_param_hash = {}
end

Instance Attribute Details

#city_filter ⇒ Object

Returns the value of attribute city_filter.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def city_filter
  @city_filter
end

#custom_param_hash ⇒ Object

Returns the value of attribute custom_param_hash.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def custom_param_hash
  @custom_param_hash
end

#exclude_states ⇒ Object

Returns the value of attribute exclude_states.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def exclude_states
  @exclude_states
end

#max_results ⇒ Object

Returns the value of attribute max_results.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def max_results
  @max_results
end

#prefer_cities ⇒ Object

Returns the value of attribute prefer_cities.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def prefer_cities
  @prefer_cities
end

#prefer_geolocation ⇒ Object

Returns the value of attribute prefer_geolocation.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def prefer_geolocation
  @prefer_geolocation
end

#prefer_ratio ⇒ Object

Returns the value of attribute prefer_ratio.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def prefer_ratio
  @prefer_ratio
end

#prefer_states ⇒ Object

Returns the value of attribute prefer_states.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def prefer_states
  @prefer_states
end

#prefer_zip_codes ⇒ Object

Returns the value of attribute prefer_zip_codes.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def prefer_zip_codes
  @prefer_zip_codes
end

#result ⇒ Object

Returns the value of attribute result.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def result
  @result
end

#search ⇒ Object

Returns the value of attribute search.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def search
  @search
end

#selected ⇒ Object

Returns the value of attribute selected.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def selected
  @selected
end

#source ⇒ Object

Returns the value of attribute source.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def source
  @source
end

#state_filter ⇒ Object

Returns the value of attribute state_filter.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def state_filter
  @state_filter
end

#zip_filter ⇒ Object

Returns the value of attribute zip_filter.



11
12
13
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 11

def zip_filter
  @zip_filter
end

Instance Method Details

#add_city_filter(city) ⇒ Object



39
40
41
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 39

def add_city_filter(city)
  @city_filter.push(city)
end

#add_custom_parameter(parameter, value) ⇒ Object



35
36
37
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 35

def add_custom_parameter(parameter, value)
  @custom_param_hash[parameter] = value
end

#add_preferred_city(city) ⇒ Object



55
56
57
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 55

def add_preferred_city(city)
  @prefer_cities.push(city)
end

#add_preferred_state(state) ⇒ Object



59
60
61
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 59

def add_preferred_state(state)
  @prefer_states.push(state)
end

#add_preferred_zip(zip) ⇒ Object



63
64
65
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 63

def add_preferred_zip(zip)
  @prefer_zip_codes.push(zip)
end

#add_state_exclusion(state) ⇒ Object



51
52
53
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 51

def add_state_exclusion(state)
  @exclude_states.push(state)
end

#add_state_filter(state) ⇒ Object



43
44
45
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 43

def add_state_filter(state)
  @state_filter.push(state)
end

#add_zip_filter(zip) ⇒ Object



47
48
49
# File 'lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb', line 47

def add_zip_filter(zip)
  @zip_filter.push(zip)
end