Class: Bullhorn::Candidates

Inherits:
Object
  • Object
show all
Defined in:
lib/bullhorn/candidates.rb

Class Method Summary collapse

Class Method Details

.credentialsObject

————–So I can set credentials from console



9
10
11
12
13
# File 'lib/bullhorn/candidates.rb', line 9

def credentials
     Bullhorn::Client.username = '525.resumes'
     Bullhorn::Client.password = 'scrub04k'
     Bullhorn::Client.apiKey   = '943C63E3-FB1A-4089-A3813849B9626393'  
end

.default_candidateObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/bullhorn/candidates.rb', line 72

def default_candidate  
{
  :address => {
    :address1 => "",
    :address2 => "",
    :city => "",
    :state => "",
    :countryID => 1,
    :zip => ""
    },
  :category_id => 45,                            #integer
  :comments => "",   
  :email => "",                         
  :employee_type => "",
  :first_name => "",
  :is_deleted => 0,                               #boolean
  :is_editable => 1,         #boolean
  :last_name => "",
  :name => "",
  :owner_id => 43832,               #integer
  :password => "hireminds123",
  :preferred_contact => "",
  :status => "",
  :username => "",
  :user_type_id => 35,  
  :is_day_light_savings => true,
  :mass_mail_opt_out => false,
  :time_zone_offset_est => 0,
  :day_rate => 0,
  :day_rate_low => 0,
  :degree_list => "",
  :salary => 0,
  :travel_limit => 0,
  :will_relocate => false,
  :work_authorized => true,
}  
end

.find_by(id) ⇒ Object

—————- Find a Candidate by Id



16
17
18
# File 'lib/bullhorn/candidates.rb', line 16

def find_by id
  (select_fields results(Bullhorn::Client.findMultiple find_multiple_request([id]))).first  
end

.find_multiple_by(ids) ⇒ Object

—————- Find an array of Candidates by an array of Ids



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bullhorn/candidates.rb', line 22

def find_multiple_by ids
  candidates = []
  index = 1
  while ids.page(index) != nil
    candidate_detail_response = Bullhorn::Client.findMultiple candidate_detail_request(ids.page(index))
    details = get_candidate_details_from(candidate_detail_response)
    
    details = [details] if !(details.class == Array)
    select_fields resultsdetails
    index += 1
  end
  candidates
end

.get_id_response(qty) ⇒ Object

—————– Gets first qty of Ids, for testing purposes



59
60
61
62
63
64
# File 'lib/bullhorn/candidates.rb', line 59

def get_id_response qty
  request = candidate_query_request
  request[:query][:maxResults] = qty if qty
  response = (Bullhorn::Client.query request).body[:query_response][:return][:ids]
  response
end

.get_ids(qty) ⇒ Object

—————– Gets first qty of Ids, for testing purposes



54
55
56
# File 'lib/bullhorn/candidates.rb', line 54

def get_ids qty
  get_id_response qty
end

.query_by(email) ⇒ Object

—————– Find a Candidate by Email

returns Candidate dto, or nil if not found


38
39
40
41
42
43
# File 'lib/bullhorn/candidates.rb', line 38

def query_by email
  request = candidate_query_request
  request[:query][:where] = "email='" + email + "'"
  response=(Bullhorn::Client.query request).body[:query_response][:return]
  find_by response[:ids] if response.has_key?(:ids)
end

.query_where(conditions) ⇒ Object

—————– Find a Candidate using a query string



46
47
48
49
50
# File 'lib/bullhorn/candidates.rb', line 46

def query_where conditions
  candidate_query_request[:query][:where] = conditions
  response=(Bullhorn::Client.query candidate_query_request).body[:query_response][:return]
  find_by response[:ids] if response.has_key?(:ids)
end

.save(candidate) ⇒ Object

——————- Save Candidate



67
68
69
70
# File 'lib/bullhorn/candidates.rb', line 67

def save candidate
  request = save_request(candidate)
  (Bullhorn::Client.save request).body[:save_response]
end