Class: Cb::TalentNetworkApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cb/clients/talent_network_api.rb

Class Method Summary collapse

Class Method Details

.join_form_branding(tndid) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cb/clients/talent_network_api.rb', line 19

def self.join_form_branding(tndid)
	## Gets branding information (stylesheets, copytext, etc...) for the join form.
	my_api = Cb::Utils::Api.new

	json_hash = my_api.cb_get_secure("#{Cb.configuration.uri_tn_join_form_branding}/#{tndid}/json")

	tn_join_form_branding = TalentNetwork::JoinFormBranding.new(json_hash['Branding'])
	my_api.append_api_responses(tn_join_form_branding, json_hash)

	return tn_join_form_branding

end

.join_form_geography(tnlanguage = "USEnglish") ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/cb/clients/talent_network_api.rb', line 32

def self.join_form_geography(tnlanguage="USEnglish")
	## Gets locations needed to fill the Geography question from the Join Form Question API
	my_api = Cb::Utils::Api.new
	json_hash = my_api.cb_get_secure("#{Cb.configuration.uri_tn_join_form_geo}", :query=>{:TNLanguage=>"#{tnlanguage}"})

	geo_dropdown = TalentNetwork::JoinFormGeo.new(json_hash)
	my_api.append_api_responses(geo_dropdown, json_hash)

	return geo_dropdown
end

.join_form_questions(tndid) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/cb/clients/talent_network_api.rb', line 8

def self.join_form_questions(tndid)
	## Load the join form questions for a TalentNetworkDID
	my_api = Cb::Utils::Api.new()
	json_hash = my_api.cb_get_secure("#{Cb.configuration.uri_tn_join_questions}/#{tndid}/json")

	tn_questions_collection = TalentNetwork.new(json_hash)
	my_api.append_api_responses(tn_questions_collection, json_hash)

	return tn_questions_collection
end

.member_create(args = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cb/clients/talent_network_api.rb', line 43

def self.member_create(args={})
	## Creates a member based on the form built with the Join Form Questions API call
	my_api = Cb::Utils::Api.new
	tn_member = TalentNetwork::Member.new(args)
	cb_response = my_api.cb_post("#{Cb.configuration.uri_tn_member_create}/json", :body => tn_member.to_xml )
	json_hash = JSON.parse(cb_response.response.body)

    if json_hash['Errors'].first.nil?
      return json_hash['MemberDID']
    end

	return json_hash['Errors'].first
end

.tn_job_information(job_did, join_form_intercept = "true") ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/cb/clients/talent_network_api.rb', line 57

def self.tn_job_information(job_did, join_form_intercept="true")
	my_api = Cb::Utils::Api.new
	json_hash = my_api.cb_get_secure("#{Cb.configuration.uri_tn_job_info}/#{job_did}/json", :query=> {
		 :RequestJoinFormIntercept=>join_form_intercept})

	tn_job_info = TalentNetwork::JobInfo.new(json_hash['Response'])
	my_api.append_api_responses(tn_job_info, json_hash)
	
	return tn_job_info

end