module PostcodeAnywhere::CapturePlus::Interactive

Constants

API_VERSION
FIND_ADDRESSES_ENDPOINT
RETRIEVE_ADDRESS_ENDPOINT

Public Instance Methods

query(search_term, options = {}) click to toggle source
# File lib/postcode_anywhere/capture_plus/interactive.rb, line 17
def query(search_term, options = {})
  options.merge!(
    'SearchTerm' => search_term
  )
  options['LastId'] = ParentIdExtractor.new(options.delete(:parent_query)).extract
  options['SearchFor'] = options.delete(:search_for) || EVERYTHING
  options['Country']   = options.delete(:country) || 'GBR'
  options['LanguagePreference'] = options.delete(:language) || 'EN'
  perform_with_objects(
    :get,
    FIND_ADDRESSES_ENDPOINT,
    options,
    PostcodeAnywhere::CapturePlus::SearchResult
  )
end
query_companies(search_term, options = {}) click to toggle source
# File lib/postcode_anywhere/capture_plus/interactive.rb, line 43
def query_companies(search_term, options = {})
  options.merge!(search_for: COMPANY)
  query search_term, options
end
query_places(search_term, options = {}) click to toggle source
# File lib/postcode_anywhere/capture_plus/interactive.rb, line 38
def query_places(search_term, options = {})
  options.merge!(search_for: PLACE)
  query search_term, options
end
query_postcodes(search_term, options = {}) click to toggle source
# File lib/postcode_anywhere/capture_plus/interactive.rb, line 48
def query_postcodes(search_term, options = {})
  options.merge!(search_for: POSTCODE)
  query search_term, options
end
retrieve(search_result) click to toggle source
# File lib/postcode_anywhere/capture_plus/interactive.rb, line 53
def retrieve(search_result)
  options = {}
  options.merge!(
    'Id' => ParentIdExtractor.new(search_result).extract
  )
  perform_with_object(
    :get,
    RETRIEVE_ADDRESS_ENDPOINT,
    options,
    PostcodeAnywhere::CapturePlus::RetrieveResult
  )
end
sub_query(search_term, parent_query, options = {}) click to toggle source
# File lib/postcode_anywhere/capture_plus/interactive.rb, line 33
def sub_query(search_term, parent_query, options = {})
  options.merge!(parent_query: parent_query)
  query(search_term, options)
end