cb-api 1.3.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,34 @@
1
+ module Cb
2
+ module Models
3
+ class JobBranding
4
+
5
+ attr_accessor :name, :media, :sections, :styles, :widgets, :id, :account_id, :type, :errors, :show_widgets, :company_description
6
+
7
+ def initialize args = {}
8
+ @name = args['Name'] || ''
9
+ @id = args['Id'] || ''
10
+ @account_id = args['AccountId'] || ''
11
+ @type = args['Type'] || ''
12
+ @media = Branding::Media.new args['Media']
13
+ @styles = Branding::Style.new args['Styles']
14
+ @errors = args['Errors'] || ''
15
+ @company_description = args['CompanyDescription'] || ''
16
+ @sections, @widgets = [], []
17
+
18
+ args['Sections'].each do |type, sections|
19
+ @sections << Branding::Section.new(type, sections) unless sections.nil?
20
+ end
21
+
22
+ args['Widgets'].each do |type, url|
23
+ if type == 'ShowWidgets'
24
+ @show_widgets = url == 'true'
25
+ else
26
+ @widgets << Branding::Widget.new(type, url) unless url.nil?
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,159 @@
1
+ module Cb
2
+ module Models
3
+ class SavedSearch
4
+ attr_accessor :host_site, :cobrand, :site_id, :search_name, :boolean_operator, :category, :education_code, :specific_education,
5
+ :emp_type, :exclude_company_names, :exclude_job_titles, :exclude_national, :industry_codes,
6
+ :keywords, :order_by, :order_direction, :radius, :pay_high, :pay_low, :posted_within,
7
+ :pay_info_only, :location, :job_category, :company, :city, :state, :is_daily_email, :external_id,
8
+ :external_user_id, :job_search_url, :jrdid, :errors, :browser_id, :session_id, :test, :email_address,
9
+ :saved_search_parameters, :country, :search_parameters
10
+
11
+ def initialize(args={})
12
+ @host_site = args['HostSite'] || String.new
13
+ @cobrand = args['Cobrand'] || String.new
14
+ @search_name = args['SearchName'] || String.new
15
+ @site_id = args['SiteId'] || String.new
16
+ @is_daily_email = args['IsDailyEmail'] || String.new
17
+ @email_delivery_day = args['EmailDeliveryDay'] || String.new
18
+ @external_id = args['ExternalID'] || String.new
19
+ @external_user_id = args['ExternalUserID'] || String.new
20
+ @browser_id = args['BrowserID'] || nil
21
+ @session_id = args['SessionID'] || String.new
22
+ @email_address = args['EmailAddress'] || String.new
23
+ @search_parameters = SearchParameters.new(args['SavedSearchParameters'] || {})
24
+ end
25
+
26
+ def create_to_xml
27
+ ret = "<Request>"
28
+ ret += "<HostSite>#{@hostsite}</HostSite>"
29
+ ret += "<Cobrand>#{@cobrand}</Cobrand>"
30
+ ret += "<SearchName>#{@search_name}</SearchName>"
31
+ ret += search_parameters.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)
32
+ ret += "<IsDailyEmail>#{@is_daily_email.to_s.upcase}</IsDailyEmail>"
33
+ ret += "<ExternalUserID>#{@external_user_id}</ExternalUserID>"
34
+ ret += "<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>"
35
+ ret + "</Request>"
36
+ end
37
+
38
+ def create_anon_to_xml
39
+ ret = "<Request>"
40
+ ret += "<HostSite>#{@hostsite}</HostSite>"
41
+ ret += "<Cobrand>#{@cobrand}</Cobrand>"
42
+ ret += "<BrowserID>#{@browser_id}</BrowserID>"
43
+ ret += "<SessionID>#{@session_id}</SessionID>"
44
+ ret += "<Test>#{false}</Test>"
45
+ ret += "<EmailAddress>#{@email_address}</EmailAddress>"
46
+ ret += "<SearchName>#{@search_name}</SearchName>"
47
+ ret += search_parameters.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)
48
+ ret += "<IsDailyEmail>#{@is_daily_email.to_s.upcase}</IsDailyEmail>"
49
+ ret += "<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>"
50
+ ret + "</Request>"
51
+ end
52
+
53
+ def update_to_xml
54
+ ret = "<Request>"
55
+ ret += "<HostSite>#{@hostsite}</HostSite>"
56
+ ret += "<Cobrand>#{@cobrand}</Cobrand>"
57
+ ret += "<SearchName>#{@search_name}</SearchName>"
58
+ ret += search_parameters.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)
59
+ ret += "<IsDailyEmail>#{@is_daily_email.to_s.upcase}</IsDailyEmail>"
60
+ ret += "<ExternalID>#{@external_id}</ExternalID>"
61
+ ret += "<ExternalUserID>#{@external_user_id}</ExternalUserID>"
62
+ ret += "<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>"
63
+ ret + "</Request>"
64
+ end
65
+
66
+ def delete_to_xml
67
+ Nokogiri::XML::Builder.new do
68
+ Request {
69
+ ExternalID external_id
70
+ ExternalUserID external_user_id
71
+ HostSite host_site
72
+ DeveloperKey Cb.configuration.dev_key
73
+ }
74
+ end.to_xml
75
+ end
76
+
77
+
78
+
79
+ def delete_anon_to_xml
80
+ Nokogiri::XML::Builder.new do
81
+ Request {
82
+ DeveloperKey Cb.configuration.dev_key
83
+ ExternalID external_id
84
+ Test false
85
+ }
86
+ end.to_xml
87
+ end
88
+
89
+ class Delete
90
+ attr_reader :status
91
+
92
+ def initialize(response)
93
+ @status = response['Status']
94
+ end
95
+ end
96
+
97
+ class SearchParameters
98
+ attr_accessor :boolean_operator, :category, :education_code, :emp_type, :exclude_company_names, :exclude_job_titles,
99
+ :exclude_keywords, :exclude_national, :industry_codes, :job_title, :keywords, :location, :order_by,
100
+ :order_direction, :pay_high, :pay_info_only, :pay_low, :posted_within, :radius, :specific_education,
101
+ :country
102
+
103
+ def initialize(args = {})
104
+ @boolean_operator = args['BooleanOperator'] || String.new
105
+ @category = args['Category'] || String.new
106
+ @job_category = args['JobCategory'] || String.new
107
+ @education_code = args['EducationCode'] || String.new
108
+ @emp_type = args['EmpType'] || String.new
109
+ @exclude_company_names = args['ExcludeCompanyNames'] || String.new
110
+ @exclude_job_titles = args['ExcludeJobTitles'] || String.new
111
+ @exclude_keywords = args['ExcludeKeywords'] || String.new
112
+ @country = args['Country'] || String.new
113
+ @industry_codes = args['IndustryCodes'] || String.new
114
+ @job_title = args['JobTitle'] || String.new
115
+ @keywords = args['Keywords'] || String.new
116
+ @location = args['Location'] || String.new
117
+ @order_by = args['OrderBy'] || String.new
118
+ @order_direction = args['OrderDirection'] || String.new
119
+ @pay_high = args['PayHigh'] || 0
120
+ @pay_low = args['PayLow'] || 0
121
+ @posted_within = args['PostedWithin'] || 30
122
+ @radius = args['Radius'] || 30
123
+ @specific_education = args['SpecificEducation'].nil? ? false : args['SpecificEducation']
124
+ @exclude_national = args['ExcludeNational'].nil? ? false : args['ExcludeNational']
125
+ @pay_info_only = args['PayInfoOnly'].nil? ? false : args['PayInfoOnly']
126
+ end
127
+
128
+ def to_xml(args = {})
129
+ Nokogiri::XML::Builder.new do
130
+ SearchParameters {
131
+ BooleanOperator boolean_operator
132
+ JobCategory category
133
+ EducationCode education_code
134
+ EmpType emp_type
135
+ ExcludeCompanyNames exclude_company_names
136
+ ExcludeJobTitles exclude_job_titles
137
+ ExcludeKeywords exclude_keywords
138
+ Country country
139
+ IndustryCodes industry_codes
140
+ JobTitle job_title
141
+ Keywords keywords
142
+ Location location
143
+ OrderBy order_by
144
+ OrderDirection order_direction
145
+ PayHigh pay_high
146
+ PayLow pay_low
147
+ PostedWithin posted_within
148
+ Radius radius
149
+ SpecificEducation specific_education
150
+ ExcludeNational exclude_national
151
+ PayInfoOnly pay_info_only
152
+ }
153
+ end.to_xml(args)
154
+ end
155
+ end
156
+ end
157
+
158
+ end
159
+ end
@@ -0,0 +1,30 @@
1
+ module Cb
2
+ module Models
3
+ class Spot < ApiResponseModel
4
+
5
+ attr_accessor :content_type, :start_date, :end_date, :sequence, :language, :experiment_weight_custom_column,
6
+ :field_1, :field_2, :field_3, :field_4, :field_5, :field_6, :field_7, :field_8,
7
+ :text_1, :text_2, :text_3, :text_4
8
+
9
+ protected
10
+
11
+ def required_fields
12
+ %w(ContentType StartDate EndDate Sequence Language)
13
+ end
14
+
15
+ def set_model_properties
16
+ @content_type = api_response['ContentType'] || String.new
17
+ @start_date = api_response['StartDate'] || String.new
18
+ @end_date = api_response['EndDate'] || String.new
19
+ @sequence = api_response['Sequence'] || String.new
20
+ @language = api_response['Language'] || String.new
21
+ @experiment_weight_custom_value = api_response['ExperimentWeightCustomValue'] || String.new
22
+
23
+ # meta programming the @field_# and @text_# variables => ruby swag
24
+ (1..8).each { |num| instance_variable_set("@field_#{num.to_s}", api_response["Field#{num.to_s}"] || String.new) }
25
+ (1..4).each { |num| instance_variable_set("@text_#{num.to_s}", api_response["Text#{num.to_s}"] || String.new) }
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,156 @@
1
+ module Cb
2
+ module Models
3
+ class TalentNetwork
4
+ attr_accessor :join_form_questions
5
+ def initialize(args={})
6
+ @join_form_questions = Array.new
7
+ if args.has_key?('JoinQuestions')
8
+ args['JoinQuestions'].each do |question|
9
+ @join_form_questions << TalentNetwork::Questions.new(question)
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ class TalentNetwork::Member
16
+ attr_accessor :dev_key, :tn_did, :preferred_language, :accept_privacy, :accept_terms, :resume_word_doc,
17
+ :join_values
18
+
19
+ def initialize(args={})
20
+ @dev_key = args['DeveloperKey'] || Cb.configuration.dev_key
21
+ @tn_did = args['TNDID'] || ''
22
+ @preferred_language = args['PreferredLanguage'] || 'USEnglish'
23
+ @accept_privacy = args['AcceptPrivacy'] || true
24
+ @accept_terms = args['AcceptTerms'] || true
25
+ @resume_word_doc = args['ResumeWordDoc'] || ''
26
+ @join_values = args['JoinValues'] || Array.new
27
+ end
28
+
29
+ def to_xml
30
+ ret = "<Request>"
31
+ ret += "<DeveloperKey>#{@dev_key}</DeveloperKey>"
32
+ ret += "<TalentNetworkDID>#{@tn_did}</TalentNetworkDID>"
33
+ ret += "<PreferredLanguage>#{@preferred_language}</PreferredLanguage>"
34
+ ret += "<AcceptPrivacy>#{@accept_privacy}</AcceptPrivacy>"
35
+ ret += "<AcceptTerms>#{@accept_terms}</AcceptTerms>"
36
+ ret += "<ResumeWordDoc>#{@resume_word_doc}</ResumeWordDoc>"
37
+ ret += "<JoinValues>"
38
+ @join_values.each { | k,v |
39
+ ret += "<JoinValue>"
40
+ ret += "<Key>#{k}</Key>"
41
+ ret += "<Value>#{v}</Value>"
42
+ ret += "</JoinValue>"
43
+ }
44
+ ret += "</JoinValues>"
45
+ ret += "</Request>"
46
+ end
47
+ end
48
+
49
+
50
+ class TalentNetwork::Questions
51
+ attr_accessor :text, :form_value, :option_display_type, :order, :required, :options
52
+
53
+ def initialize(args={})
54
+ @text = args['Text'] || ''
55
+ @form_value = args['FormValue'] || ''
56
+ @option_display_type = args['OptionDisplayType'] || ''
57
+ @order = args['Order'] || ''
58
+ @required = args['Required'].to_s || ''
59
+ @options = Array.new
60
+ if args.has_key?('Options')
61
+ args['Options'].each do |option_values|
62
+ @options << TalentNetwork::Options.new(option_values)
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ class TalentNetwork::Options
69
+ attr_accessor :value, :order, :display_text
70
+
71
+ def initialize(args={})
72
+ @value = args['Value'] || ''
73
+ @order = args['Order'] || ''
74
+ @display_text = args['DisplayText'] || ''
75
+ end
76
+ end
77
+
78
+ class TalentNetwork::JobInfo
79
+ attr_accessor :join_form_url, :tn_did, :join_form_intercept_enabled
80
+
81
+ def initialize(args={})
82
+ @join_form_url = args['JoinFormUrl'] || ''
83
+ @tn_did = args['sTNDID'] || ''
84
+ @join_form_intercept_enabled = args['JoinFormInterceptEnabled'].to_s || ''
85
+ end
86
+ end
87
+
88
+ class TalentNetwork::JoinFormGeo
89
+ attr_accessor :countries, :states
90
+
91
+ def initialize(args={})
92
+ @countries = Hash.new
93
+ @states = Hash.new
94
+
95
+ if args.has_key?('Countries')
96
+ @countries = TalentNetwork::JoinFormGeoLocation.new(args['Countries'])
97
+ end
98
+
99
+ if args.has_key?('States')
100
+ @states = TalentNetwork::JoinFormGeoLocation.new(args['States'])
101
+ end
102
+
103
+ end
104
+ end
105
+
106
+ class TalentNetwork::JoinFormGeoLocation
107
+ attr_accessor :geo_hash
108
+
109
+ def initialize(args={})
110
+ value = Array.new
111
+ display_val = Array.new
112
+ @geo_hash = Hash.new
113
+
114
+ if args.has_key?('Value')
115
+ args['Value'].each do |val|
116
+ value << val
117
+ end
118
+ end
119
+
120
+ if args.has_key?('Display')
121
+ args['Display'].each do |display|
122
+ display_val << display
123
+ end
124
+ end
125
+
126
+ unless value.nil? || display_val.nil?
127
+ @geo_hash = convert_to_hash(display_val,value)
128
+ end
129
+ end
130
+
131
+ private
132
+ def convert_to_hash(keys, values)
133
+ geo_hash = Hash.new
134
+ geo_hash = Hash[keys.zip(values)]
135
+
136
+ return geo_hash
137
+ end
138
+ end
139
+
140
+ class TalentNetwork::JoinFormBranding
141
+ attr_accessor :stylesheet_url, :join_logo_image_url, :join_custom_msg_html, :button_color,
142
+ :mobile_logo_image_url, :nav_color, :site_path
143
+
144
+ def initialize(args={})
145
+ @stylesheet_url = args['StylesheetURL'] || ''
146
+ @join_logo_image_url = args['JoinLogoImageURL'] || ''
147
+ @join_custom_msg_html = args['JoinCustomMsgHTML'] || ''
148
+ @button_color = args['ButtonColor'] || ''
149
+ @mobile_logo_image_url = args['MobileLogoImageURL'] || ''
150
+ @nav_color = args['NavColor'] || ''
151
+ @site_path = args['SitePath'] || ''
152
+ end
153
+ end
154
+
155
+ end
156
+ end
@@ -0,0 +1,58 @@
1
+ module Cb
2
+ module Models
3
+ class User
4
+ attr_accessor :user_status, :password, :email, :address_1, :address_2, :city, :state,
5
+ :province, :postal_code, :zip, :country_code, :first_name,
6
+ :last_name, :phone, :fax, :last_login, :created, :allow_partner_emails,
7
+ :allow_newsletter_emails, :allow_email_from_headhunter, :domain, :registration_path,
8
+ :user_type, :gender, :birth_date, :cobrand_code, :resume_stats, :custom_values
9
+
10
+ def initialize(args = {})
11
+ return if args.nil?
12
+
13
+ @user_status = args['UserStatus'] || ''
14
+ @password = ''
15
+ @email = args['Email'] || ''
16
+ @address_1 = args['Address1'] || ''
17
+ @address_2 = args['Address2'] || ''
18
+ @city = args['City'] || ''
19
+ @state = args['State'] || ''
20
+ @province = args['Province'] || ''
21
+ @postal_code = args['PostalCode'] || ''
22
+ @zip = args['Zip'] || ''
23
+ @country_code = args['CountryCode'] || ''
24
+ @first_name = args['FirstName'] || ''
25
+ @last_name = args['LastName'] || ''
26
+ @phone = args['Phone'] || ''
27
+ @fax = args['Fax'] || ''
28
+ @last_login = args['LastLogin'] || ''
29
+ @created = args['CreatedDT'] || ''
30
+ @allow_partner_emails = args['AllowPartnerEmails'] || ''
31
+ @allow_newsletter_emails = args['AllowNewsletterEmails'] || ''
32
+ @allow_email_from_headhunter = args['AllowEmailFromHeadHunter'] || ''
33
+ @domain = args['Domain'] || ''
34
+ @registration_path = args['RegistrationPath'] || ''
35
+ @user_type = args['UserType'] || ''
36
+ @gender = args['Gender'] || ''
37
+ @birth_date = args['BirthDate'] || ''
38
+ @cobrand_code = args['CoBrandCode'] || ''
39
+ @resume_stats = args['ResumeStats'] || ''
40
+ @custom_values = args['CustomValues'] || ''
41
+ end
42
+
43
+ def custom_value custom_value_key
44
+ custom_value = nil
45
+
46
+ if @custom_values['CustomValue'].is_a? Array
47
+ @custom_values['CustomValue'].each do |cv|
48
+ custom_value = cv['Value'] if cv['Key'] == custom_value_key
49
+ end
50
+ elsif @custom_values['CustomValue'].is_a? Hash
51
+ custom_value = @custom_values['CustomValue']['Value'] if @custom_values['CustomValue']['Key'] == custom_value_key
52
+ end
53
+
54
+ return custom_value
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,36 @@
1
+ module Cb
2
+ module Responses
3
+ module AnonymousSavedSearch
4
+
5
+ class Create < ApiResponse
6
+ protected
7
+
8
+ def hash_containing_metadata
9
+ response
10
+ end
11
+
12
+ def validate_api_hash
13
+ required_response_field(external_id_node, response)
14
+ required_response_field(model_node, response)
15
+ end
16
+
17
+ def extract_models
18
+ # external ID comes back outside of the model node so we need to do some rearranging
19
+ response[model_node][external_id_node] = response[external_id_node]
20
+ Models::SavedSearch.new(response[model_node])
21
+ end
22
+
23
+ private
24
+
25
+ def model_node
26
+ 'AnonymousSavedSearch'
27
+ end
28
+
29
+ def external_id_node
30
+ 'ExternalID'
31
+ end
32
+ end
33
+
34
+ end
35
+ end
36
+ end