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, SearchResponse
Constant Summary
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, #live_feeds, #minimum_match, #minimum_probability, #show_sources, #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.
17 18 19 20 21 22 |
# File 'lib/pipl/client.rb', line 17 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
24 25 26 |
# File 'lib/pipl/client.rb', line 24 def (opts) opts.hash == .hash end |
#search(params = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pipl/client.rb', line 28 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 |