Class: SwissMatch::Directories::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/swissmatch/directories/service.rb

Overview

Common directory service API.

See Also:

Instance Method Summary collapse

Constructor Details

#initialize(back_end, config = nil) ⇒ Service

Returns a new instance of Service

Parameters:

  • back_end (Class, Symbol, #from_configuration)

    A valid back-end. Valid in vanilla swissmatch-directories:

    • :telsearch
    • SwissMatch::Directories::TelSearch (same as :telsearch)
  • config (Object) (defaults to: nil)

    A back-end specific configuration object.


24
25
26
# File 'lib/swissmatch/directories/service.rb', line 24

def initialize(back_end, config=nil)
  @service = SwissMatch::Directories.service(back_end).from_config(config)
end

Instance Method Details

#addresses(params, options = {}) ⇒ Object

Query for addresses matching a set of given search parameters

Note that not all back-ends will treat these parameters with the same strictness. The tel.search.ch back-end for example will search for a last name anywhere in the name.

Parameters:

  • params (Hash)

    The abstract API search parameters. Valid parameters:

    • :first_name
    • :family_name
    • :last_name
    • :maiden_name
    • :name
    • :phone
    • :street
    • :street_name
    • :street_number
    • :zip_code
    • :city

47
48
49
# File 'lib/swissmatch/directories/service.rb', line 47

def addresses(params, options={})
  @service.addresses(params, options)
end