Module: NetProspex::QueryMethods
- Included in:
- Client
- Defined in:
- lib/netprospex/query_methods.rb
Defined Under Namespace
Classes: UnexpectedResponseError
Instance Method Summary
collapse
Instance Method Details
#find_people(query) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/netprospex/query_methods.rb', line 23
def find_people(query)
[:calc_found_rows, :preview].each do |k|
query[k] = 1 if query[k]
end
response = get('/person/list.json', query)
store_balance(response)
if persons = fetch_key_from_response_hash(:person_list, response)[:persons]
return persons.map{|p| NetProspex::Api::Person.new(p)}
else
return []
end
end
|
#find_person(query) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/netprospex/query_methods.rb', line 5
def find_person(query)
response = get('/person/profile.json', query)
store_balance(response)
if p = fetch_key_from_response_hash(:person_profile, response)[:person]
return NetProspex::Api::Person.new(p)
else
return nil
end
end
|
#find_person_by_email(email) ⇒ Object
19
20
21
|
# File 'lib/netprospex/query_methods.rb', line 19
def find_person_by_email(email)
find_person(email: email)
end
|
#find_person_by_id(id) ⇒ Object
15
16
17
|
# File 'lib/netprospex/query_methods.rb', line 15
def find_person_by_id(id)
find_person(person_id: id)
end
|