Class: PeopleGraph::Client
- Inherits:
-
Object
- Object
- PeopleGraph::Client
- Defined in:
- lib/peoplegraph/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#initialize(api_key = ENV['PEOPLEGRAPH_API_KEY'], options = nil) ⇒ Client
constructor
A new instance of Client.
- #search(email = nil, url = nil, name = nil, company = nil, options = nil) ⇒ Object
Constructor Details
#initialize(api_key = ENV['PEOPLEGRAPH_API_KEY'], options = nil) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 18 |
# File 'lib/peoplegraph/client.rb', line 12 def initialize(api_key = ENV['PEOPLEGRAPH_API_KEY'], = nil) @api_key = api_key # /[email protected]&apiKey=hYxSdRmEif0GN7jwlmeQtVQbE3T1kBb1 url = ENV['PEOPLEGRAPH_API_URL'] || 'https://api.peoplegraph.io' block = block_given? ? Proc.new : nil @connection = Faraday.new(url, , &block) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/peoplegraph/client.rb', line 10 def api_key @api_key end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
10 11 12 |
# File 'lib/peoplegraph/client.rb', line 10 def connection @connection end |
Instance Method Details
#search(email = nil, url = nil, name = nil, company = nil, options = nil) ⇒ Object
20 21 22 23 24 |
# File 'lib/peoplegraph/client.rb', line 20 def search(email = nil, url = nil, name = nil, company = nil, = nil) profile = lookup(email, url, name, company, ) return nil if profile.nil? OpenStruct.new(profile) end |