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 “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) ⇒ 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
# 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)
  @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
end

Instance Attribute Details

#city_filterObject

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

#exclude_statesObject

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_resultsObject

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_citiesObject

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_geolocationObject

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_ratioObject

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_statesObject

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_codesObject

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

#resultObject

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

#searchObject

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

#selectedObject

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

#sourceObject

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_filterObject

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_filterObject

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



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

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

#add_preferred_city(city) ⇒ Object



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

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

#add_preferred_state(state) ⇒ Object



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

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

#add_preferred_zip(zip) ⇒ Object



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

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

#add_state_exclusion(state) ⇒ Object



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

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

#add_state_filter(state) ⇒ Object



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

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

#add_zip_filter(zip) ⇒ Object



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

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