Class: Pipl::Client
- Inherits:
-
Object
- Object
- Pipl::Client
- Includes:
- Configurable
- Defined in:
- lib/pipl/client.rb,
lib/pipl/errors.rb,
lib/pipl/response.rb
Defined Under Namespace
Classes: APIError, AvailableData, FieldCount, SearchResponse
Constant Summary collapse
- QUERY_PARAMS =
%w(minimum_probability minimum_match hide_sponsored live_feeds show_sources match_requirements source_category_requirements infer_persons)
Constants included from Configurable
Pipl::Configurable::SHOW_SOURCES_ALL, Pipl::Configurable::SHOW_SOURCES_MATCHING, Pipl::Configurable::SHOW_SOURCES_NONE
Instance Attribute Summary
Attributes included from Configurable
#api_endpoint, #api_key, #hide_sponsored, #infer_persons, #live_feeds, #match_requirements, #minimum_match, #minimum_probability, #show_sources, #source_category_requirements, #strict_validation, #user_agent
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #same_options?(opts) ⇒ Boolean
- #search(params = {}) ⇒ Object
Methods included from Configurable
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
20 21 22 23 24 25 |
# File 'lib/pipl/client.rb', line 20 def initialize( = {}) Pipl::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", [key] || Pipl.instance_variable_get(:"@#{key}")) end end |
Instance Method Details
#same_options?(opts) ⇒ Boolean
27 28 29 |
# File 'lib/pipl/client.rb', line 27 def (opts) opts.hash == .hash end |
#search(params = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/pipl/client.rb', line 31 def search(params={}) opts = .merge params create_search_person(opts) validate_search_params(opts) http, req = create_http_request(opts) if opts.key? :callback do_send_async http, req, opts[:callback] elsif opts[:async] and block_given? do_send_async http, req, Proc.new else do_send http, req end end |