Module: NNEClient

Extended by:
NNEClient
Includes:
ConfigNewton
Included in:
NNEClient
Defined in:
lib/nne_client.rb,
lib/nne_client/fetch.rb,
lib/nne_client/query.rb,
lib/nne_client/result.rb,
lib/nne_client/search.rb,
lib/nne_client/request.rb,
lib/nne_client/version.rb,
lib/nne_client/question.rb,
lib/nne_client/result_set.rb,
lib/nne_client/result_attributes.rb,
lib/nne_client/record_types/trade.rb,
lib/nne_client/record_types/finance.rb,
lib/nne_client/record_types/ownership.rb,
lib/nne_client/record_types/subsidiary.rb

Overview

Namespace for the library

Defined Under Namespace

Classes: CompanyMissing, Finance, Ownership, Result, ResultSet, Subsidiary, Trade

Constant Summary collapse

VERSION =
"0.0.11"

Instance Method Summary collapse

Instance Method Details

#retry_timeouts(count, &block) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/nne_client.rb', line 54

def retry_timeouts(count, &block)
  retries = 3
  begin
    yield
  rescue Timeout::Error => e
    retries -= 1
    retry if retries > 0
  end
end

#search(query) ⇒ ResultSet

Where users start the interaction with the library.

The query is hash with one or more of these keys:

  • :houseNo (string)

  • :name (string)

  • :nameStartsWith (boolean)

  • :street (string)

  • :zipCode (number)

  • :tdcId (number)

Returns:

  • (ResultSet)

    containing the results from the SOAP API



42
43
44
# File 'lib/nne_client.rb', line 42

def search(query)
  NNEClient::Search.new(query).result_set
end

#with_timeout(seconds, &block) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/nne_client.rb', line 46

def with_timeout(seconds, &block)
  old_timeout = NNEClient.config.http_read_timeout
  NNEClient.config.http_read_timeout = seconds
  yield
ensure
  NNEClient.config.http_read_timeout = old_timeout
end