cb-api 1.3.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. data/lib/cb.rb +7 -99
  2. data/lib/cb/clients/anon_saved_search.rb +42 -0
  3. data/lib/cb/clients/application.rb +53 -0
  4. data/lib/cb/clients/application_external.rb +24 -0
  5. data/lib/cb/clients/category.rb +49 -0
  6. data/lib/cb/clients/company.rb +34 -0
  7. data/lib/cb/clients/education.rb +28 -0
  8. data/lib/cb/clients/email_subscription.rb +55 -0
  9. data/lib/cb/clients/employee_types.rb +31 -0
  10. data/lib/cb/clients/job.rb +57 -0
  11. data/lib/cb/clients/job_branding.rb +21 -0
  12. data/lib/cb/clients/recommendation.rb +76 -0
  13. data/lib/cb/clients/saved_search.rb +66 -0
  14. data/lib/cb/clients/spot.rb +27 -0
  15. data/lib/cb/clients/talent_network.rb +51 -0
  16. data/lib/cb/clients/user.rb +94 -0
  17. data/lib/cb/convenience.rb +83 -0
  18. data/lib/cb/criteria/job/details.rb +11 -0
  19. data/lib/cb/criteria/job/search.rb +25 -0
  20. data/lib/cb/criteria/spot/retrieve.rb +12 -0
  21. data/lib/cb/exceptions.rb +2 -1
  22. data/lib/cb/models/implementations/application.rb +92 -0
  23. data/lib/cb/models/implementations/application_external.rb +28 -0
  24. data/lib/cb/models/implementations/application_schema.rb +75 -0
  25. data/lib/cb/models/implementations/branding/media.rb +14 -14
  26. data/lib/cb/models/implementations/branding/section.rb +14 -15
  27. data/lib/cb/models/implementations/branding/style.rb +10 -10
  28. data/lib/cb/models/implementations/branding/styles/base.rb +12 -10
  29. data/lib/cb/models/implementations/branding/styles/buttons.rb +7 -6
  30. data/lib/cb/models/implementations/branding/styles/company_info.rb +14 -12
  31. data/lib/cb/models/implementations/branding/styles/container.rb +7 -6
  32. data/lib/cb/models/implementations/branding/styles/content.rb +7 -5
  33. data/lib/cb/models/implementations/branding/styles/css_adapter.rb +39 -41
  34. data/lib/cb/models/implementations/branding/styles/headings.rb +7 -5
  35. data/lib/cb/models/implementations/branding/styles/job_details.rb +12 -11
  36. data/lib/cb/models/implementations/branding/styles/page.rb +7 -5
  37. data/lib/cb/models/implementations/branding/widget.rb +9 -7
  38. data/lib/cb/models/implementations/category.rb +24 -0
  39. data/lib/cb/models/implementations/company.rb +135 -0
  40. data/lib/cb/models/implementations/education.rb +17 -0
  41. data/lib/cb/models/implementations/email_subscription.rb +17 -0
  42. data/lib/cb/models/implementations/employee_type.rb +13 -0
  43. data/lib/cb/models/implementations/job.rb +167 -0
  44. data/lib/cb/models/implementations/job_branding.rb +34 -0
  45. data/lib/cb/models/implementations/saved_search.rb +159 -0
  46. data/lib/cb/models/implementations/spot.rb +30 -0
  47. data/lib/cb/models/implementations/talent_network.rb +156 -0
  48. data/lib/cb/models/implementations/user.rb +58 -0
  49. data/lib/cb/responses/anonymous_saved_search/create.rb +36 -0
  50. data/lib/cb/responses/anonymous_saved_search/delete.rb +23 -0
  51. data/lib/cb/responses/api_response.rb +64 -0
  52. data/lib/cb/responses/employee_types/search.rb +48 -0
  53. data/lib/cb/responses/errors.rb +47 -0
  54. data/lib/cb/responses/metadata.rb +27 -0
  55. data/lib/cb/responses/saved_search/delete.rb +28 -0
  56. data/lib/cb/responses/saved_search/list.rb +43 -0
  57. data/lib/cb/responses/saved_search/singular.rb +50 -0
  58. data/lib/cb/responses/spot/retrieve_response.rb +31 -20
  59. data/lib/cb/responses/timing.rb +37 -0
  60. data/lib/cb/utils/api.rb +2 -2
  61. data/lib/cb/utils/response_array_extractor.rb +14 -4
  62. data/lib/cb/version.rb +1 -1
  63. metadata +114 -69
  64. data/lib/cb/clients/anon_saved_search_api.rb +0 -41
  65. data/lib/cb/clients/application_api.rb +0 -78
  66. data/lib/cb/clients/application_external_api.rb +0 -30
  67. data/lib/cb/clients/category_api.rb +0 -51
  68. data/lib/cb/clients/company_api.rb +0 -39
  69. data/lib/cb/clients/education_api.rb +0 -37
  70. data/lib/cb/clients/email_subscription_api.rb +0 -68
  71. data/lib/cb/clients/employee_types_api.rb +0 -48
  72. data/lib/cb/clients/job_api.rb +0 -70
  73. data/lib/cb/clients/job_branding_api.rb +0 -24
  74. data/lib/cb/clients/recommendation_api.rb +0 -98
  75. data/lib/cb/clients/resume_api.rb +0 -185
  76. data/lib/cb/clients/saved_search_api.rb +0 -139
  77. data/lib/cb/clients/spot_api.rb +0 -25
  78. data/lib/cb/clients/talent_network_api.rb +0 -70
  79. data/lib/cb/clients/user_api.rb +0 -118
  80. data/lib/cb/criteria/job_details_criteria.rb +0 -11
  81. data/lib/cb/criteria/job_search_criteria.rb +0 -29
  82. data/lib/cb/criteria/spot_retrieve_criteria.rb +0 -12
  83. data/lib/cb/models/implementations/cb_application.rb +0 -91
  84. data/lib/cb/models/implementations/cb_application_external.rb +0 -31
  85. data/lib/cb/models/implementations/cb_application_schema.rb +0 -78
  86. data/lib/cb/models/implementations/cb_category.rb +0 -22
  87. data/lib/cb/models/implementations/cb_company.rb +0 -133
  88. data/lib/cb/models/implementations/cb_education.rb +0 -25
  89. data/lib/cb/models/implementations/cb_email_subscription.rb +0 -19
  90. data/lib/cb/models/implementations/cb_employee_type.rb +0 -12
  91. data/lib/cb/models/implementations/cb_job.rb +0 -175
  92. data/lib/cb/models/implementations/cb_job_branding.rb +0 -33
  93. data/lib/cb/models/implementations/cb_resume.rb +0 -221
  94. data/lib/cb/models/implementations/cb_saved_search.rb +0 -228
  95. data/lib/cb/models/implementations/cb_spot.rb +0 -32
  96. data/lib/cb/models/implementations/cb_talent_network.rb +0 -155
  97. data/lib/cb/models/implementations/cb_user.rb +0 -56
  98. data/lib/cb/responses/raw_api_response.rb +0 -34
@@ -1,139 +0,0 @@
1
- require 'json'
2
-
3
- module Cb
4
- class SavedSearchApi
5
-
6
- #############################################################
7
- ## Create a Saved Search
8
- ##
9
- ## For detailed information around this API please visit:
10
- ## http://api.careerbuilder.com/savedsearchinfo.aspx
11
- #############################################################
12
- def self.create *args
13
- args = args[0] if args.is_a?(Array) && args.count == 1
14
- my_api = Cb::Utils::Api.new
15
- json_hash = my_api.cb_post Cb.configuration.uri_saved_search_create, :body => CbSavedSearch.new(args).create_to_xml
16
-
17
- if json_hash.has_key? 'SavedJobSearch'
18
- if json_hash['SavedJobSearch'].has_key? 'SavedSearch'
19
- saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch']
20
- else
21
- saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
22
- end
23
- my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
24
- end
25
-
26
- my_api.append_api_responses saved_search, json_hash
27
-
28
- return saved_search
29
- end
30
-
31
- #############################################################
32
- ## Update a Saved Search
33
- ##
34
- ## For detailed information around this API please visit:
35
- ## http://api.careerbuilder.com/savedsearchinfo.aspx
36
- #############################################################
37
- def self.update *args
38
- args = args[0] if args.is_a?(Array) && args.count == 1
39
- my_api = Cb::Utils::Api.new
40
- json_hash = my_api.cb_post Cb.configuration.uri_saved_search_update, :body => CbSavedSearch.new(args).update_to_xml
41
-
42
- if json_hash.has_key?('SavedJobSearch')
43
- saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
44
- my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
45
- end
46
-
47
- my_api.append_api_responses saved_search, json_hash
48
-
49
- return saved_search
50
- end
51
-
52
- #############################################################
53
- ## Delete a Saved Search
54
- ##
55
- ## For detailed information around this API please visit:
56
- ## http://api.careerbuilder.com/savedsearchinfo.aspx
57
- #############################################################
58
-
59
- def self.delete *args
60
- args = args[0] if args.is_a?(Array) && args.count == 1
61
- my_api = Cb::Utils::Api.new
62
- json_hash = my_api.cb_post Cb.configuration.uri_saved_search_delete, :body=>CbSavedSearch.new(args).delete_to_xml
63
-
64
- if json_hash.has_key?('Request')
65
- saved_search = CbSavedSearch.new json_hash['Request']
66
- my_api.append_api_responses(saved_search, json_hash['Request'])
67
- end
68
-
69
- my_api.append_api_responses(saved_search, json_hash)
70
-
71
- return saved_search
72
- end
73
-
74
- #############################################################
75
- ## Retrieve a Saved Search
76
- ##
77
- ## external_id is the unique ID for the specific Saved Search
78
- ## that is being requested from the API. This External_id is
79
- ## found from running a SavedSearchApi.all call. This is a
80
- ## 64 character long ID.
81
- ##
82
- ## HostSite (From Saved Search List) Required*
83
- ## Developer Key of the owning site for the User is Required*
84
- ##
85
- ## For detailed information around this API please visit:
86
- ## http://api.careerbuilder.com/savedsearchinfo.aspx
87
- #############################################################
88
- def self.retrieve developer_key, external_user_id, external_id, host_site
89
- my_api = Cb::Utils::Api.new
90
- json_hash = my_api.cb_get Cb.configuration.uri_saved_search_retrieve, :query => {:developerkey=> developer_key, :externaluserid=> external_user_id, :externalid=> external_id, :hostsite=> host_site}
91
-
92
- if json_hash.has_key?('SavedJobSearch')
93
-
94
- if json_hash['SavedJobSearch'].has_key?('SavedSearch')
95
- saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch']
96
- my_api.append_api_responses saved_search, json_hash['SavedJobSearch']['SavedSearch']
97
- end
98
-
99
- my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
100
- end
101
-
102
- my_api.append_api_responses saved_search, json_hash
103
-
104
- return saved_search
105
- end
106
-
107
- #############################################################
108
- ## List of Saved Search's
109
- ##
110
- ## For detailed information around this API please visit:
111
- ## http://api.careerbuilder.com/savedsearchinfo.aspx
112
- #############################################################
113
- def self.list developer_key, external_user_id, host_site
114
- my_api = Cb::Utils::Api.new
115
- json_hash = my_api.cb_get Cb.configuration.uri_saved_search_list, :query => {:developerkey=>developer_key, :ExternalUserId=>external_user_id, :hostsite=> host_site}
116
- saved_searches = []
117
- if json_hash.has_key?('SavedJobSearches') && json_hash['SavedJobSearches'].has_key?('SavedSearches')
118
- saved_search_hash = json_hash['SavedJobSearches']['SavedSearches']
119
-
120
- unless saved_search_hash.nil?
121
- if saved_search_hash['SavedSearch'].is_a?(Array)
122
- saved_search_hash['SavedSearch'].each do |saved_search|
123
- saved_searches << CbSavedSearch.new(saved_search)
124
- end
125
- elsif saved_search_hash['SavedSearch'].is_a?(Hash) && json_hash.length < 2
126
- saved_searches << CbSavedSearch.new(saved_search_hash['SavedSearch'])
127
- end
128
- end
129
-
130
- my_api.append_api_responses saved_searches, json_hash['SavedJobSearches']
131
- end
132
-
133
- my_api.append_api_responses(saved_searches, json_hash)
134
-
135
- return saved_searches
136
- end
137
-
138
- end
139
- end
@@ -1,25 +0,0 @@
1
- require 'json'
2
-
3
- module Cb::ApiClients
4
- class Spot
5
- class << self
6
-
7
- def retrieve(criteria)
8
- response = retrieve_api_response criteria
9
- Cb::Responses::Spot::Retrieve.extract_models response
10
- end
11
-
12
- private
13
-
14
- def retrieve_api_response(criteria)
15
- params = api_client.class.criteria_to_hash criteria
16
- api_client.cb_get(Cb.configuration.uri_spot_retrieve, :query => params)
17
- end
18
-
19
- def api_client
20
- @api ||= Cb::Utils::Api.new
21
- end
22
-
23
- end
24
- end
25
- end
@@ -1,70 +0,0 @@
1
- module Cb
2
- class TalentNetworkApi
3
- ####################################################
4
- ## Documentation:
5
- ## http://api.careerbuilder.com/TalentNetwork.aspx
6
- ####################################################
7
-
8
- def self.join_form_questions(tndid)
9
- ## Load the join form questions for a TalentNetworkDID
10
- my_api = Cb::Utils::Api.new()
11
- json_hash = my_api.cb_get("#{Cb.configuration.uri_tn_join_questions}/#{tndid}/json")
12
-
13
- tn_questions_collection = TalentNetwork.new(json_hash)
14
- my_api.append_api_responses(tn_questions_collection, json_hash)
15
-
16
- return tn_questions_collection
17
- end
18
-
19
- def self.join_form_branding(tndid)
20
- ## Gets branding information (stylesheets, copytext, etc...) for the join form.
21
- my_api = Cb::Utils::Api.new
22
-
23
- json_hash = my_api.cb_get("#{Cb.configuration.uri_tn_join_form_branding}/#{tndid}/json")
24
-
25
- if json_hash.has_key? 'Branding'
26
- tn_join_form_branding = TalentNetwork::JoinFormBranding.new(json_hash['Branding'])
27
- end
28
-
29
- my_api.append_api_responses(tn_join_form_branding, json_hash)
30
-
31
- return tn_join_form_branding
32
-
33
- end
34
-
35
- def self.join_form_geography(tnlanguage="USEnglish")
36
- ## Gets locations needed to fill the Geography question from the Join Form Question API
37
- my_api = Cb::Utils::Api.new
38
- json_hash = my_api.cb_get("#{Cb.configuration.uri_tn_join_form_geo}", :query=>{:TNLanguage=>"#{tnlanguage}"})
39
-
40
- geo_dropdown = TalentNetwork::JoinFormGeo.new(json_hash)
41
- my_api.append_api_responses(geo_dropdown, json_hash)
42
-
43
- return geo_dropdown
44
- end
45
-
46
- def self.member_create(args={})
47
- ## Creates a member based on the form built with the Join Form Questions API call
48
- my_api = Cb::Utils::Api.new
49
- tn_member = TalentNetwork::Member.new(args)
50
- json_hash = my_api.cb_post("#{Cb.configuration.uri_tn_member_create}/json", :body => tn_member.to_xml )
51
- my_api.append_api_responses(json_hash, json_hash)
52
-
53
- return json_hash
54
- end
55
-
56
- def self.tn_job_information(job_did, join_form_intercept="true")
57
- my_api = Cb::Utils::Api.new
58
- json_hash = my_api.cb_get("#{Cb.configuration.uri_tn_job_info}/#{job_did}/json", :query=> {
59
- :RequestJoinFormIntercept=>join_form_intercept})
60
-
61
- if json_hash.has_key? 'Response'
62
- tn_job_info = TalentNetwork::JobInfo.new(json_hash['Response'])
63
- end
64
-
65
- my_api.append_api_responses(tn_job_info, json_hash)
66
-
67
- return tn_job_info
68
- end
69
- end #TalentNetworkJoinQuestions
70
- end #module
@@ -1,118 +0,0 @@
1
- require 'json'
2
- require 'nokogiri'
3
-
4
- module Cb
5
- class UserApi
6
- #############################################################
7
- ## Retrieve a user
8
- ##
9
- ## For detailed information around this API please visit:
10
- ## http://www.careerbuilder.com/api/UserInfo.aspx
11
- #############################################################
12
- def self.retrieve external_id, test_mode = false
13
- my_api = Cb::Utils::Api.new
14
-
15
- json_hash = my_api.cb_post Cb.configuration.uri_user_retrieve, :body => build_retrieve_request(external_id, true)
16
-
17
- if json_hash.has_key? 'ResponseUserInfo'
18
- if json_hash['ResponseUserInfo'].has_key? 'UserInfo'
19
- user = CbUser.new json_hash['ResponseUserInfo']['UserInfo']
20
- end
21
- my_api.append_api_responses user, json_hash['ResponseUserInfo']
22
- end
23
-
24
- my_api.append_api_responses user, json_hash
25
-
26
- return user
27
- end
28
-
29
- #############################################################
30
- ## Change a user's password
31
- ##
32
- ## For detailed information around this API please visit:
33
- ## http://www.careerbuilder.com/api/UserInfo.aspx
34
- #############################################################
35
- def self.change_password external_id, old_password, new_password, test_mode = false
36
- result = false
37
-
38
- my_api = Cb::Utils::Api.new
39
- json_hash = my_api.cb_post Cb.configuration.uri_user_change_password, :body => build_change_password_request(external_id, old_password, new_password, test_mode)
40
-
41
- if json_hash.has_key? 'ResponseUserChangePW'
42
- if json_hash['ResponseUserChangePW'].has_key?('Status') && json_hash['ResponseUserChangePW']['Status'].include?('Success')
43
- result = true
44
- end
45
- my_api.append_api_responses result, json_hash['ResponseUserChangePW']
46
- end
47
-
48
- my_api.append_api_responses result, json_hash
49
-
50
- result
51
- end
52
-
53
- #############################################################
54
- ## De-activate a user
55
- ##
56
- ## For detailed information around this API please visit:
57
- ## http://www.careerbuilder.com/api/UserInfo.aspx
58
- #############################################################
59
- def self.delete external_id, password, test_mode = false
60
- result = false
61
-
62
- my_api = Cb::Utils::Api.new
63
- json_hash = my_api.cb_post Cb.configuration.uri_user_delete, :body => build_delete_request(external_id, password, test_mode)
64
-
65
- if json_hash.has_key? 'ResponseUserDelete'
66
- if json_hash['ResponseUserDelete'].has_key?('Status') && json_hash['ResponseUserDelete']['Status'].include?('Success')
67
- result = true
68
- end
69
- my_api.append_api_responses result, json_hash['ResponseUserDelete']
70
- end
71
-
72
- my_api.append_api_responses result, json_hash
73
-
74
- result
75
- end
76
-
77
- private
78
- def self.build_retrieve_request external_id, test_mode
79
- builder = Nokogiri::XML::Builder.new do
80
- Request {
81
- ExternalID_ external_id
82
- Test_ test_mode.to_s
83
- DeveloperKey_ Cb.configuration.dev_key
84
- }
85
- end
86
-
87
- builder.to_xml
88
- end
89
-
90
- def self.build_change_password_request external_id, old_password, new_password, test_mode
91
- builder = Nokogiri::XML::Builder.new do
92
- Request {
93
- ExternalID_ external_id
94
- OldPassword_ old_password
95
- NewPassword_ new_password
96
- Test_ test_mode.to_s
97
- DeveloperKey_ Cb.configuration.dev_key
98
- }
99
- end
100
-
101
- builder.to_xml
102
- end
103
-
104
- def self.build_delete_request external_id, password, test_mode
105
- builder = Nokogiri::XML::Builder.new do
106
- Request {
107
- ExternalID_ external_id
108
- Password_ password
109
- Test_ test_mode.to_s
110
- DeveloperKey_ Cb.configuration.dev_key
111
- }
112
- end
113
-
114
- builder.to_xml
115
- end
116
-
117
- end
118
- end
@@ -1,11 +0,0 @@
1
- module Cb
2
- class JobDetailsCriteria
3
- extend Cb::Utils::FluidAttributes
4
-
5
- fluid_attr_accessor :did, :show_job_skin, :site_id, :lhs, :cobrand, :show_apply_requirements
6
-
7
- def find
8
- Cb.job.find_by_criteria(self)
9
- end
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- module Cb
2
- # Trying to simplify the large number of inputs our job search api accepts
3
- # For indepth information around all of the different inputs, please visit:
4
- # http://api.careerbuilder.com/JobSearchInfo.aspx
5
- ####################################################################################
6
- class JobSearchCriteria
7
- extend Cb::Utils::FluidAttributes
8
-
9
- fluid_attr_accessor :advanced_grouping_mode, :boolean_operator, :category, :co_brand, :company_did,
10
- :company_did_csv, :company_name, :company_name_boost_params, :country_code,
11
- :education_code, :emp_type, :enable_company_collapse, :exclude_company_names,
12
- :exclude_job_titles, :exclude_keywords, :exclude_national, :exclude_non_traditional_jobs,
13
- :exclude_product_id, :facet_category, :facet_company, :facet_city, :facet_state,
14
- :facet_city_state, :facet_pay, :facet_normalized_company_did, :host_site,
15
- :include_company_children, :industry_codes, :job_title, :keywords, :location,
16
- :normalized_company_did, :normalized_company_did_boost_params,
17
- :normalized_company_name, :onet_code, :order_by, :order_direction, :page_number,
18
- :partner_id, :pay_high, :pay_info_only, :pay_low, :per_page, :posted_within,
19
- :product_id, :radius, :records_per_group, :relocate_jobs, :soc_code, :school_site_id,
20
- :search_all_countries, :search_view, :show_categories, :show_apply_requirements,
21
- :apply_requirements, :exclude_apply_requirements, :single_onet_search, :site_entity, :site_id, :skills, :specific_education,
22
- :spoken_language, :tags, :talent_network_did, :url_compression_service, :use_facets,
23
- :str_crit
24
-
25
- def search
26
- Cb::JobApi.search(Cb::Utils::Api.criteria_to_hash(self))
27
- end
28
- end
29
- end
@@ -1,12 +0,0 @@
1
- module Cb::Criteria
2
- class SpotRetrieve
3
- extend Cb::Utils::FluidAttributes
4
-
5
- fluid_attr_accessor :contenttype, :language, :sortfield, :sortdirection, :maxitems
6
- (1..8).each { |num| fluid_attr_accessor "field#{num.to_s}".to_sym }
7
-
8
- def retrieve
9
- Cb::ApiClients::Spot.retrieve self
10
- end
11
- end
12
- end
@@ -1,91 +0,0 @@
1
- module Cb
2
- class CbApplication
3
- #request params
4
- attr_accessor :job_did, :site_id, :ipath, :co_brand, :test,
5
- :resume_file_name, :resume,
6
- :user_external_id, :user_external_resume_id,
7
- :answers
8
-
9
- #response params
10
- #redirect_url is returned from the api for shared apply applications.
11
- attr_accessor :redirect_url
12
-
13
- def initialize(args = {})
14
- @job_did = args[:job_did]
15
- @site_id = args[:site_id] || 'cbnsv'
16
- @ipath = args[:ipath] || ''
17
- @co_brand = args[:co_brand] || ''
18
- @test = args[:test] || 'false'
19
- @resume_file_name = args[:resume_file_name] || ''
20
- @resume = args[:resume] || ''
21
- @user_external_id = args[:user_external_id] || ''
22
- @user_external_resume_id = args[:user_external_resume_id] || ''
23
- @answers = []
24
- @redirect_url = ''
25
- end
26
-
27
- def submit
28
- if is_registered?
29
- Cb.application.submit_registered_app(self)
30
- else
31
- Cb.application.submit_app(self)
32
- end
33
- end
34
-
35
- def is_registered?
36
- !@user_external_id.blank? && @resume.blank?
37
- end
38
-
39
- def is_unregistered?
40
- !is_registered?
41
- end
42
-
43
- def complete?
44
- cb_response.application_status == 'Complete' || cb_response.application_status == 'Complete (Test)'
45
- end
46
-
47
- def add_answer(id, text)
48
- @answers << CbApplication::CbAnswer.new(id, text)
49
- end
50
-
51
- def to_xml
52
- ret = '<RequestApplication>'
53
-
54
- ret = "#{ret}<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>"
55
- ret = "#{ret}<JobDID>#{@job_did}</JobDID>"
56
- ret = "#{ret}<Test>#{@test}</Test>" unless @test.blank?
57
- ret = "#{ret}<SiteID>#{@site_id}</SiteID>" unless @site_id.blank?
58
- #ret = "#{ret}<IPath>#{@ipath}</IPath>" unless @ipath.blank? #this has to be passed by query string because the api is lame.
59
- ret = "#{ret}<CoBrand>#{@co_brand}</CoBrand>" unless @co_brand.blank?
60
- ret = "#{ret}<HostSite>#{Cb.configuration.host_site}</HostSite>"
61
- ret = "#{ret}<Resume><ResumeFileName>#{@resume_file_name}</ResumeFileName><ResumeData>#{@resume}</ResumeData></Resume>" if is_unregistered?
62
-
63
- unless @answers.count == 0
64
- ret = "#{ret}<Responses>"
65
- @answers.each do | ans |
66
- ret = "#{ret}#{ans.to_xml}"
67
- end
68
- ret = "#{ret}</Responses>"
69
- end
70
-
71
- ret = "#{ret}<ExternalUserID>#{@user_external_id}</ExternalUserID>" if is_registered?
72
- ret = "#{ret}<ExternalResumeID>#{@user_external_resume_id}</ExternalResumeID>" if is_registered?
73
-
74
- "#{ret}</RequestApplication>"
75
- end # to_xml
76
- end # CbApplication
77
-
78
- ############################################################
79
- class CbApplication::CbAnswer
80
- attr_accessor :id, :text
81
-
82
- def initialize(id, text)
83
- @id = id
84
- @text = text
85
- end
86
-
87
- def to_xml
88
- "<Response><QuestionID>#{@id}</QuestionID><ResponseText>#{@text}</ResponseText></Response>"
89
- end
90
- end # CbAnswer
91
- end # Cb