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,32 +0,0 @@
1
- module Cb::Models
2
- class Spot < ApiResponseModel
3
-
4
- attr_accessor :content_type, :start_date, :end_date, :sequence, :language, :experiment_weight_custom_column,
5
- :field_1, :field_2, :field_3, :field_4, :field_5, :field_6, :field_7, :field_8,
6
- :text_1, :text_2, :text_3, :text_4
7
-
8
- def initialize(response={})
9
- super(response)
10
- end
11
-
12
- private
13
-
14
- def required_fields
15
- %w(ContentType StartDate EndDate Sequence Language)
16
- end
17
-
18
- def set_model_properties
19
- @content_type = api_response['ContentType'] || String.new
20
- @start_date = api_response['StartDate'] || String.new
21
- @end_date = api_response['EndDate'] || String.new
22
- @sequence = api_response['Sequence'] || String.new
23
- @language = api_response['Language'] || String.new
24
- @experiment_weight_custom_value = api_response['ExperimentWeightCustomValue'] || String.new
25
-
26
- # meta programming the @field_# and @text_# variables => ruby swag
27
- (1..8).each { |num| instance_variable_set("@field_#{num.to_s}", api_response["Field#{num.to_s}"] || String.new) }
28
- (1..4).each { |num| instance_variable_set("@text_#{num.to_s}", api_response["Text#{num.to_s}"] || String.new) }
29
- end
30
-
31
- end
32
- end
@@ -1,155 +0,0 @@
1
- module Cb
2
- class TalentNetwork
3
- attr_accessor :join_form_questions
4
- def initialize(args={})
5
- @join_form_questions = Array.new
6
- if args.has_key?('JoinQuestions')
7
- args['JoinQuestions'].each do |question|
8
- @join_form_questions << TalentNetwork::Questions.new(question)
9
- end
10
- end
11
- end
12
- end
13
-
14
- class TalentNetwork::Member
15
- attr_accessor :dev_key, :tn_did, :preferred_language, :accept_privacy, :accept_terms, :resume_word_doc,
16
- :join_values
17
-
18
- def initialize(args={})
19
- @dev_key = args['DeveloperKey'] || Cb.configuration.dev_key
20
- @tn_did = args['TNDID'] || ''
21
- @preferred_language = args['PreferredLanguage'] || 'USEnglish'
22
- @accept_privacy = args['AcceptPrivacy'] || true
23
- @accept_terms = args['AcceptTerms'] || true
24
- @resume_word_doc = args['ResumeWordDoc'] || ''
25
- @join_values = args['JoinValues'] || Array.new
26
- end
27
-
28
- def to_xml
29
- ret = "<Request>"
30
- ret += "<DeveloperKey>#{@dev_key}</DeveloperKey>"
31
- ret += "<TalentNetworkDID>#{@tn_did}</TalentNetworkDID>"
32
- ret += "<PreferredLanguage>#{@preferred_language}</PreferredLanguage>"
33
- ret += "<AcceptPrivacy>#{@accept_privacy}</AcceptPrivacy>"
34
- ret += "<AcceptTerms>#{@accept_terms}</AcceptTerms>"
35
- ret += "<ResumeWordDoc>#{@resume_word_doc}</ResumeWordDoc>"
36
- ret += "<JoinValues>"
37
- @join_values.each { | k,v |
38
- ret += "<JoinValue>"
39
- ret += "<Key>#{k}</Key>"
40
- ret += "<Value>#{v}</Value>"
41
- ret += "</JoinValue>"
42
- }
43
- ret += "</JoinValues>"
44
- ret += "</Request>"
45
- end
46
- end
47
-
48
-
49
- class TalentNetwork::Questions
50
- attr_accessor :text, :form_value, :option_display_type, :order, :required, :options
51
-
52
- def initialize(args={})
53
- @text = args['Text'] || ''
54
- @form_value = args['FormValue'] || ''
55
- @option_display_type = args['OptionDisplayType'] || ''
56
- @order = args['Order'] || ''
57
- @required = args['Required'].to_s || ''
58
- @options = Array.new
59
- if args.has_key?('Options')
60
- args['Options'].each do |option_values|
61
- @options << TalentNetwork::Options.new(option_values)
62
- end
63
- end
64
- end
65
- end
66
-
67
- class TalentNetwork::Options
68
- attr_accessor :value, :order, :display_text
69
-
70
- def initialize(args={})
71
- @value = args['Value'] || ''
72
- @order = args['Order'] || ''
73
- @display_text = args['DisplayText'] || ''
74
- end
75
- end
76
-
77
- class TalentNetwork::JobInfo
78
- attr_accessor :join_form_url, :tn_did, :join_form_intercept_enabled
79
-
80
- def initialize(args={})
81
- @join_form_url = args['JoinFormUrl'] || ''
82
- @tn_did = args['sTNDID'] || ''
83
- @join_form_intercept_enabled = args['JoinFormInterceptEnabled'].to_s || ''
84
- end
85
- end
86
-
87
- class TalentNetwork::JoinFormGeo
88
- attr_accessor :countries, :states
89
-
90
- def initialize(args={})
91
- @countries = Hash.new
92
- @states = Hash.new
93
-
94
- if args.has_key?('Countries')
95
- @countries = TalentNetwork::JoinFormGeoLocation.new(args['Countries'])
96
- end
97
-
98
- if args.has_key?('States')
99
- @states = TalentNetwork::JoinFormGeoLocation.new(args['States'])
100
- end
101
-
102
- end
103
- end
104
-
105
- class TalentNetwork::JoinFormGeoLocation
106
- attr_accessor :geo_hash
107
-
108
- def initialize(args={})
109
- value = Array.new
110
- display_val = Array.new
111
- @geo_hash = Hash.new
112
-
113
- if args.has_key?('Value')
114
- args['Value'].each do |val|
115
- value << val
116
- end
117
- end
118
-
119
- if args.has_key?('Display')
120
- args['Display'].each do |display|
121
- display_val << display
122
- end
123
- end
124
-
125
- unless value.nil? || display_val.nil?
126
- @geo_hash = convert_to_hash(display_val,value)
127
- end
128
- end
129
-
130
- private
131
- def convert_to_hash(keys, values)
132
- geo_hash = Hash.new
133
- geo_hash = Hash[keys.zip(values)]
134
-
135
- return geo_hash
136
- end
137
- end
138
-
139
- class TalentNetwork::JoinFormBranding
140
- attr_accessor :stylesheet_url, :join_logo_image_url, :join_custom_msg_html, :button_color,
141
- :mobile_logo_image_url, :nav_color, :site_path
142
-
143
- def initialize(args={})
144
- @stylesheet_url = args['StylesheetURL'] || ''
145
- @join_logo_image_url = args['JoinLogoImageURL'] || ''
146
- @join_custom_msg_html = args['JoinCustomMsgHTML'] || ''
147
- @button_color = args['ButtonColor'] || ''
148
- @mobile_logo_image_url = args['MobileLogoImageURL'] || ''
149
- @nav_color = args['NavColor'] || ''
150
- @site_path = args['SitePath'] || ''
151
- end
152
- end
153
-
154
-
155
- end
@@ -1,56 +0,0 @@
1
- module Cb
2
- class CbUser
3
- attr_accessor :user_status, :password, :email, :address_1, :address_2, :city, :state,
4
- :province, :postal_code, :zip, :country_code, :first_name,
5
- :last_name, :phone, :fax, :last_login, :created, :allow_partner_emails,
6
- :allow_newsletter_emails, :allow_email_from_headhunter, :domain, :registration_path,
7
- :user_type, :gender, :birth_date, :cobrand_code, :resume_stats, :custom_values
8
-
9
- def initialize(args = {})
10
- return if args.nil?
11
-
12
- @user_status = args['UserStatus'] || ''
13
- @password = ''
14
- @email = args['Email'] || ''
15
- @address_1 = args['Address1'] || ''
16
- @address_2 = args['Address2'] || ''
17
- @city = args['City'] || ''
18
- @state = args['State'] || ''
19
- @province = args['Province'] || ''
20
- @postal_code = args['PostalCode'] || ''
21
- @zip = args['Zip'] || ''
22
- @country_code = args['CountryCode'] || ''
23
- @first_name = args['FirstName'] || ''
24
- @last_name = args['LastName'] || ''
25
- @phone = args['Phone'] || ''
26
- @fax = args['Fax'] || ''
27
- @last_login = args['LastLogin'] || ''
28
- @created = args['CreatedDT'] || ''
29
- @allow_partner_emails = args['AllowPartnerEmails'] || ''
30
- @allow_newsletter_emails = args['AllowNewsletterEmails'] || ''
31
- @allow_email_from_headhunter = args['AllowEmailFromHeadHunter'] || ''
32
- @domain = args['Domain'] || ''
33
- @registration_path = args['RegistrationPath'] || ''
34
- @user_type = args['UserType'] || ''
35
- @gender = args['Gender'] || ''
36
- @birth_date = args['BirthDate'] || ''
37
- @cobrand_code = args['CoBrandCode'] || ''
38
- @resume_stats = args['ResumeStats'] || ''
39
- @custom_values = args['CustomValues'] || ''
40
- end
41
-
42
- def custom_value custom_value_key
43
- custom_value = nil
44
-
45
- if @custom_values['CustomValue'].is_a? Array
46
- @custom_values['CustomValue'].each do |cv|
47
- custom_value = cv['Value'] if cv['Key'] == custom_value_key
48
- end
49
- elsif @custom_values['CustomValue'].is_a? Hash
50
- custom_value = @custom_values['CustomValue']['Value'] if @custom_values['CustomValue']['Key'] == custom_value_key
51
- end
52
-
53
- return custom_value
54
- end
55
- end
56
- end
@@ -1,34 +0,0 @@
1
- module Cb
2
- module Responses
3
- class RawApiResponse
4
-
5
- attr_accessor :raw_api_hash
6
-
7
- def initialize(raw_api_response={})
8
- @raw_api_hash = raw_api_response
9
- validate_raw_api_response
10
- end
11
-
12
- def validate_raw_api_response
13
- # call #required_response_field in here for each node that you know you'll need - stuff like the root node
14
- # or the node that contains the data from which your model is built.
15
- raise NotImplementedError.new(__method__)
16
- end
17
-
18
- def extract_models
19
- # your api hash is considered valid at this point - grab the data you need and turn it into model(s)
20
- raise NotImplementedError.new(__method__)
21
- end
22
-
23
- protected
24
-
25
- def required_response_field(field_name, parent_hash)
26
- [field_name, parent_hash].each do |arg|
27
- raise ArgumentError.new("No nils! field_name nil?: #{field_name.nil?} parent_hash nil?: #{parent_hash.nil?}") if arg.nil?
28
- end
29
- raise ExpectedResponseFieldMissing.new(field_name) unless parent_hash.has_key? field_name
30
- end
31
-
32
- end
33
- end
34
- end