Class: Recruitee::API::Candidates

Inherits:
Recruitee::APIResource show all
Defined in:
lib/recruitee/api/candidates.rb

Instance Attribute Summary

Attributes inherited from Recruitee::APIResource

#client, #resource_klass

Instance Method Summary collapse

Methods inherited from Recruitee::APIResource

#destroy, #find, #list, #resource_name, #resource_url, #update

Constructor Details

#initialize(client) ⇒ Candidates

Returns a new instance of Candidates.



6
7
8
# File 'lib/recruitee/api/candidates.rb', line 6

def initialize(client)
  super(client, Candidate)
end

Instance Method Details

#create(offers: [], **candidate) ⇒ Object



10
11
12
# File 'lib/recruitee/api/candidates.rb', line 10

def create(offers: [], **candidate)
  super({ offers: offers, candidate: candidate })
end

#find_by_email(email) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/recruitee/api/candidates.rb', line 14

def find_by_email(email)
  hits = search_for_email(email)
  # Recruitee's search is very fuzzy, so we need to find the real match
  match = hits.find { |hit| hit['emails'].include?(email) }

  match ? find(match['id']) : nil
end