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 top_match api_version )
Constants included from Configurable
Pipl::Configurable::DEFAULT_API_VERSION, 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, #top_match, #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.
30 31 32 33 34 35 |
# File 'lib/pipl/client.rb', line 30 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
37 38 39 |
# File 'lib/pipl/client.rb', line 37 def (opts) opts.hash == .hash end |
#search(params = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pipl/client.rb', line 41 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] && block_given? do_send_async http, req, Proc.new else do_send http, req end end |