Class: PeopleGraph::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/peoplegraph/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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'], options = 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, options, &block)
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



10
11
12
# File 'lib/peoplegraph/client.rb', line 10

def api_key
  @api_key
end

#connectionObject (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, options = nil)
  profile = lookup(email, url, name, company, options)
  return nil if profile.nil?
  OpenStruct.new(profile)
end