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,12 +1,13 @@
1
1
  module Cb
2
- module Branding
3
- module Styles
2
+ module Models
3
+ module Branding
4
+ module Styles
4
5
 
5
- class Container < Base
6
- include CssAdapter
6
+ class Container < Base
7
+ include CssAdapter
8
+ end
7
9
 
8
10
  end
9
-
10
11
  end
11
12
  end
12
- end
13
+ end
@@ -1,11 +1,13 @@
1
1
  module Cb
2
- module Branding
3
- module Styles
2
+ module Models
3
+ module Branding
4
+ module Styles
4
5
 
5
- class Content < Base
6
- include CssAdapter
6
+ class Content < Base
7
+ include CssAdapter
8
+ end
7
9
 
8
10
  end
9
11
  end
10
12
  end
11
- end
13
+ end
@@ -1,49 +1,47 @@
1
1
  module Cb
2
- module Branding
3
-
4
- module Styles
5
-
6
- module CssAdapter
7
-
8
- def to_css
9
- css = ''
10
-
11
- @styles.each do |style, value|
12
- css += generate_style style, value
2
+ module Models
3
+ module Branding
4
+ module Styles
5
+
6
+ module CssAdapter
7
+ def to_css
8
+ css = ''
9
+ @styles.each do |style, value|
10
+ css += generate_style style, value
11
+ end
12
+ css
13
13
  end
14
14
 
15
- css
16
- end
17
-
18
- private
19
- def generate_style style, value
20
- {
21
- 'BackgroundColor' => "background-color: #{value};",
22
- 'BackgroundImage' => "background-image: url(#{value});",
23
- 'BackgroundGradient' => "background: #{value['Color1']};
24
- background: -moz-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%, #{value['Color2']} 100%);
25
- background: -webkit-gradient(linear, left top, #{value['Orientation'] == 'Vertical' ? 'left bottom' : 'right top'}, color-stop(0%,#{value['Color1']}), color-stop(100%,#{value['Color2']}));
26
- background: -webkit-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
27
- background: -o-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
28
- background: -ms-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
29
- background: linear-gradient(to #{value['Orientation'] == 'Vertical' ? 'bottom' : 'right'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
30
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{value['Color1']}', endColorstr='#{value['Color2']}',GradientType=#{value['Orientation'] == 'Vertical' ? '0' : '1'} );",
31
- 'BorderSize' => "border-width: #{value};",
32
- 'BorderColor' => "border-color: #{value};",
33
- 'BorderRadius' => "-webkit-border-radius: #{value};
34
- -moz-border-radius: #{value};
35
- border-radius: #{value};",
36
- 'BoxShadow' => "-webkit-box-shadow: #{value};
37
- -moz-box-shadow: #{value};
38
- box-shadow: #{value};",
39
- 'FontColor' => "color: #{value};",
40
- 'FontSize' => "font-size: #{value};",
41
- 'FontStyle' => "font-family: #{value};"
42
- }[style].gsub(/\s+/, '')
15
+ private
16
+
17
+ def generate_style(style, value)
18
+ {
19
+ 'BackgroundColor' => "background-color: #{value};",
20
+ 'BackgroundImage' => "background-image: url(#{value});",
21
+ 'BackgroundGradient' => "background: #{value['Color1']};
22
+ background: -moz-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%, #{value['Color2']} 100%);
23
+ background: -webkit-gradient(linear, left top, #{value['Orientation'] == 'Vertical' ? 'left bottom' : 'right top'}, color-stop(0%,#{value['Color1']}), color-stop(100%,#{value['Color2']}));
24
+ background: -webkit-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
25
+ background: -o-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
26
+ background: -ms-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
27
+ background: linear-gradient(to #{value['Orientation'] == 'Vertical' ? 'bottom' : 'right'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
28
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{value['Color1']}', endColorstr='#{value['Color2']}',GradientType=#{value['Orientation'] == 'Vertical' ? '0' : '1'} );",
29
+ 'BorderSize' => "border-width: #{value};",
30
+ 'BorderColor' => "border-color: #{value};",
31
+ 'BorderRadius' => "-webkit-border-radius: #{value};
32
+ -moz-border-radius: #{value};
33
+ border-radius: #{value};",
34
+ 'BoxShadow' => "-webkit-box-shadow: #{value};
35
+ -moz-box-shadow: #{value};
36
+ box-shadow: #{value};",
37
+ 'FontColor' => "color: #{value};",
38
+ 'FontSize' => "font-size: #{value};",
39
+ 'FontStyle' => "font-family: #{value};"
40
+ }[style].gsub(/\s+/, '')
41
+ end
43
42
  end
44
43
 
45
44
  end
46
-
47
45
  end
48
46
  end
49
- end
47
+ end
@@ -1,11 +1,13 @@
1
1
  module Cb
2
- module Branding
3
- module Styles
2
+ module Models
3
+ module Branding
4
+ module Styles
4
5
 
5
- class Headings < Base
6
- include CssAdapter
6
+ class Headings < Base
7
+ include CssAdapter
8
+ end
7
9
 
8
10
  end
9
11
  end
10
12
  end
11
- end
13
+ end
@@ -1,19 +1,20 @@
1
1
  module Cb
2
- module Branding
3
- module Styles
2
+ module Models
3
+ module Branding
4
+ module Styles
4
5
 
5
- class JobDetails < Base
6
- attr_accessor :container, :content, :headings
6
+ class JobDetails < Base
7
+ attr_accessor :container, :content, :headings
7
8
 
8
- def initialize args = {}
9
- super
10
-
11
- @container = Container.new args['Container']
12
- @content = Content.new args['Content']
13
- @headings = Headings.new args['Headings']
9
+ def initialize(args = {})
10
+ super
11
+ @container = Container.new args['Container']
12
+ @content = Content.new args['Content']
13
+ @headings = Headings.new args['Headings']
14
+ end
14
15
  end
15
16
 
16
17
  end
17
18
  end
18
19
  end
19
- end
20
+ end
@@ -1,11 +1,13 @@
1
1
  module Cb
2
- module Branding
3
- module Styles
2
+ module Models
3
+ module Branding
4
+ module Styles
4
5
 
5
- class Page < Base
6
- include CssAdapter
6
+ class Page < Base
7
+ include CssAdapter
8
+ end
7
9
 
8
10
  end
9
11
  end
10
12
  end
11
- end
13
+ end
@@ -1,14 +1,16 @@
1
1
  module Cb
2
- module Branding
2
+ module Models
3
+ module Branding
3
4
 
4
- class Widget
5
- attr_accessor :type, :url
5
+ class Widget
6
+ attr_accessor :type, :url
6
7
 
7
- def initialize type, url
8
- @type = type
9
- @url = url
8
+ def initialize(type, url)
9
+ @type = type
10
+ @url = url
11
+ end
10
12
  end
11
13
 
12
14
  end
13
15
  end
14
- end
16
+ end
@@ -0,0 +1,24 @@
1
+ module Cb
2
+ module Models
3
+ class Category
4
+ attr_accessor :code, :name, :language
5
+ def initialize(args={})
6
+ @code = args["Code"] || String.new
7
+ @name = args["Name"]["#text"] || String.new
8
+ @language = args["Name"]["@language"] || String.new
9
+ end
10
+
11
+ def CategoryName()
12
+ @name unless @name.nil?
13
+ end
14
+
15
+ def CategoryCode()
16
+ @code unless @code.nil?
17
+ end
18
+
19
+ def CategoryLanguage()
20
+ @language unless @language.nil?
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,135 @@
1
+ module Cb
2
+ module Models
3
+ class Company
4
+ attr_accessor :did, :name, :hh_name, :url, :size, :type, :year_founded,
5
+ :news_feed, :overview, :total_jobs, :headquarters, :host_sites, :s_drive,
6
+ :industry,
7
+
8
+ :image_file, :header_image, :footer_image, :logo, :photos, :my_photos,
9
+ :bright_cove_video,
10
+
11
+ :twitter_url, :linked_in_url, :facebook_url, :facebook_widget,
12
+ :linked_in_widget, :twitter_widget,
13
+
14
+ :benefits, :benefits_label, :history, :contact, :contact_label, :links,
15
+ :vision, :vision_label, :products, :products_label, :career_opps, :career_opps_label,
16
+ :culture, :culture_label, :addresses, :bulletin_board, :testimonials,
17
+ :college, :college_label, :diversity, :diversity_label, :people, :people_label,
18
+
19
+ :extra_custom_tab, :tab_header_bg_color, :tab_header_text_color, :tab_header_hover_color,
20
+ :side_bar_header_color, :button_color, :button_text_color, :gutter_bg_color,
21
+ :my_content_tabs, :info_tabs, :is_enhance, :is_military, :is_premium
22
+
23
+ def initialize(args = {})
24
+ return if args.nil?
25
+
26
+ # General
27
+ ################################################################
28
+ @did = args['CompanyDID'] || ''
29
+ @name = args['CompanyName'] || ''
30
+ @hh_name = args['HHName'] || ''
31
+ @url = args['URL'] || ''
32
+ @size = args['CompanySize'] || ''
33
+ @type = args['CompanyType'] || ''
34
+ @year_founded = args['YearFounded'] || ''
35
+ @news_feed = args['NewsFeed'] || ''
36
+ @overview = args['Overview'] || ''
37
+ @total_jobs = args['TotalNumberJobs'] || ''
38
+ @headquarters = args['Headquarter'] || ''
39
+ @host_sites = args['HostSites'] || ''
40
+ @s_drive = args['SDrive'] || ''
41
+ @industry = args['IndustryType'] || ''
42
+
43
+ # Images
44
+ ################################################################
45
+ @logo = args['CompanyLogo'] || ''
46
+ @header_image = args['HeaderImage'] || ''
47
+ @footer_image = args['FooterImage'] || ''
48
+ @image_file = args['ImageFile'] || ''
49
+
50
+ @photos = args['CompanyPhotos']['PhotoList'] || ''
51
+ @my_photos = args['MyPhotos'] || ''
52
+
53
+ # Videos
54
+ ################################################################
55
+ @bright_cove_video = args['BrightcoveVideo'] || ''
56
+
57
+ # Social sites
58
+ ################################################################
59
+ @facebook_url = args['FBPageURL'] || args['FacebookURL'] || ''
60
+ @facebook_widget = args['FacebookWidget'] || ''
61
+ @twitter_url = args['TwitterURL'] || ''
62
+ @twitter_widget = args['TwitterWidget'] || ''
63
+ @linked_in_url = args['LinkedURL'] || ''
64
+ @linked_in_widget = args['LinkedInWidget'] || ''
65
+
66
+ # Detailed information (blobs)
67
+ ################################################################
68
+ @history = args['HistoryBody'] || ''
69
+ @people = args['PeopleBody'] || ''
70
+ @people_label = args['PeopleLabel'] || ''
71
+ @contact = args['ContactBody'] || ''
72
+ @contact_label = args['ContactLabel'] || ''
73
+ @benefits = args['BenefitsBody'] || ''
74
+ @benefits_label = args['BenefitsLabel'] || ''
75
+ @vision = args['VisionBody'] || ''
76
+ @vision_label = args['VisionLabel'] || ''
77
+ @products = args['ProductsBody'] || ''
78
+ @products_label = args['ProductsLabel'] || ''
79
+ @career_opps = args['CareerOpportunitiesBody'] || ''
80
+ @career_opps_label = args['CareerOpportunitiesLabel'] || ''
81
+ @culture = args['CultureBody'] || ''
82
+ @culture_label = args['CultureLabel'] || ''
83
+ @bulletin_board = args['CompanyBulletinBoard']['bulletinboards'] || ''
84
+ @testimonials = args['Testimonials']['Testimonials'] || ''
85
+ @addresses = []
86
+ if args.has_key?('CompanyAddress')
87
+ unless args['CompanyAddress'].empty? || args['CompanyAddress']['AddressList'].nil?
88
+ args['CompanyAddress']['AddressList']['Address'].each do |cur_addr|
89
+ @addresses << Company::Address.new(cur_addr)
90
+ end
91
+ end
92
+ end
93
+ @college = args['CollegeBody'] || ''
94
+ @college_label = args['CollegeLabel'] || ''
95
+ @diversity = args['DiversityBody'] || ''
96
+ @diversity_label = args['DiversityLabel'] || ''
97
+ @links = args['CompanyLinksCollection']['companylinks'] || ''
98
+
99
+ # tabs, colors, buttons, headers, etc
100
+ ################################################################
101
+ @extra_custom_tab = args['ExtraCustomTab'] || ''
102
+ @tab_header_bg_color = args['TabHeaderBGColor'] || ''
103
+ @tab_header_text_color = args['TabHeaderTextColor'] || ''
104
+ @tab_header_hover_color = args['TabHeaderHoverColor'] || ''
105
+ @side_bar_header_color = args['SidebarHeaderColor'] || ''
106
+ @button_color = args['ButtonColor'] || ''
107
+ @button_text_color = args['ButtonTextColor'] || ''
108
+ @gutter_bg_color = args['GutterBGColor'] || ''
109
+ @my_content_tabs = args['MyContent']['MyContentTabs'] || ''
110
+ @info_tabs = args['InfoTabs']['InfoTabs'] || ''
111
+ @is_enhance = args['isEnhance'] || ''
112
+ @is_military = args['MilitaryIcon'] || ''
113
+ @is_premium = args['PremiumProfile'] || ''
114
+ end
115
+
116
+ # CbAddress # CbCompany has a collection of these
117
+ ################################################################
118
+ class Address
119
+ attr_accessor :street, :city, :state, :country, :zip
120
+
121
+ def initialize(args = {})
122
+ begin
123
+ @street = args['Street'] || ''
124
+ @city = args['City'] || ''
125
+ @state = args['State'] || ''
126
+ @country = args['Country'] || ''
127
+ @zip = args['ZIPCode'] || ''
128
+ rescue
129
+ # failed to load address
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,17 @@
1
+ module Cb
2
+ module Models
3
+ class Education
4
+ attr_accessor :code, :text, :language
5
+
6
+ def initialize(args = {})
7
+ return if args.nil?
8
+
9
+ @code = args['Code'] || ''
10
+ @language = args['Name']['@language'] unless args['Name'].nil?
11
+ @text = args['Name']['#text'] unless args['Name'].nil?
12
+ @language ||= ''
13
+ @text ||= ''
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Cb
2
+ module Models
3
+ class EmailSubscription
4
+ attr_accessor :career_resources, :product_sponsor_info, :applicant_survey_invites,
5
+ :job_recs, :unsubscribe_all
6
+
7
+ def initialize(args = {})
8
+ return if args.nil?
9
+
10
+ @career_resources = args['CareerResources'].to_s || ''
11
+ @product_sponsor_info = args['ProductSponsorInfo'].to_s || ''
12
+ @applicant_survey_invites = args['ApplicantSurveyInvites'].to_s || ''
13
+ @job_recs = args['JobRecs'].to_s || ''
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module Cb
2
+ module Models
3
+ class EmployeeType
4
+ attr_accessor :code, :name, :language
5
+
6
+ def initialize(args={})
7
+ @code = args['Code'] || String.new
8
+ @name = args['Name']["#text"] rescue String.new
9
+ @language = args['Name']["@language"] rescue String.new
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,167 @@
1
+ module Cb
2
+ module Models
3
+ class Job
4
+ attr_accessor :did, :title, :job_skin, :job_skin_did, :job_branding, :pay, :pay_per, :commission, :bonus, :pay_other,
5
+ :categories, :category_codes, :degree_required, :experience_required, :travel_required,
6
+ :industry_codes, :manages_others_code,
7
+ :contact_email_url, :contact_fax, :contact_name, :contact_phone,
8
+ :company_name, :company_did, :company_details_url, :company_image_url, :company,
9
+ :description_teaser, :external_apply_url, :job_tracking_url, :location, :distance, :latitude, :longitude, :location_formatted,
10
+ :description, :requirements, :employment_type,
11
+ :details_url, :service_url, :similar_jobs_url, :apply_url,
12
+ :begin_date, :end_date, :posted_date,
13
+ :relevancy, :state, :city, :zip,
14
+ :can_be_quick_applied, :apply_requirements,
15
+ :divison, :industry, :location_street_1, :relocation_options, :location_street_2, :display_job_id,
16
+ :manages_others_string,
17
+ :degree_required_code, :travel_required_code, :employment_type_code
18
+
19
+ attr_writer :external_application, :is_screener_apply,
20
+ :is_shared_job,
21
+ :relocation_covered, :manages_others
22
+
23
+ def initialize(args = {})
24
+ return if args.nil?
25
+
26
+ # General
27
+ @did = args['DID'] || args['JobDID'] || ''
28
+ @title = args['JobTitle'] || args['Title'] || ''
29
+ @employment_type = args['EmploymentType'] || ''
30
+ @employment_type_code = args['EmploymentTypeCode'] || ''
31
+ @latitude = args['LocationLatitude'] || ''
32
+ @longitude = args['LocationLongitude'] || ''
33
+ @location_street_1 = args['LocationStreet1'] || ''
34
+ @location_street_2 = args['LocationStreet2'] || ''
35
+ @location_formatted = args['LocationFormatted'] || ''
36
+
37
+ # Job Skin Related
38
+ @job_skin = args.has_key?("JobSkin") && !args["JobSkin"].nil? ? args['JobSkin']['#cdata-section'] : ''
39
+ @job_skin_did = args['JobSkinDID'] || ''
40
+ @job_branding = @job_skin_did.blank? ? '' : Cb.job_branding.find_by_id(job_skin_did)
41
+ @job_tracking_url = args['JobTrackingURL'] || ''
42
+ @display_job_id = args['DisplayJobID'] || ''
43
+
44
+ # Compensation
45
+ @pay = args['PayHighLowFormatted'] || ''
46
+ @pay_per = args['PayPer'] || ''
47
+ @commission = args.has_key?("PayCommission") && !args["PayCommission"].nil? ? args['PayCommission']['Money']['FormattedAmount'] : ''
48
+ @bonus = args.has_key?("PayBonus") && !args["PayBonus"].nil? ? args['PayBonus']['Money']['FormattedAmount'] : ''
49
+ @pay_other = args.has_key?("PayOther") && !args["PayOther"].nil? ? args['PayOther'] : ''
50
+
51
+ # Job Search related
52
+ @description_teaser = args['DescriptionTeaser'] || ''
53
+ @posted_date = args['PostedDate'] || ''
54
+ @distance = args['Distance'] || ''
55
+ @details_url = args['JobDetailsURL'] || ''
56
+ @service_url = args['JobServiceURL'] || ''
57
+ @location = args['Location'] || ''
58
+ @similar_jobs_url = args['SimilarJobsURL'] || ''
59
+
60
+ # Summary
61
+ @categories = args['Categories'] || ''
62
+ @category_codes = args['CategoriesCodes'] || ''
63
+ @degree_required = args['DegreeRequired'] || ''
64
+ @degree_required_code = args['DegreeRequiredCode'] || ''
65
+ @experience_required = args['ExperienceRequired'] || ''
66
+ @experience_required_code = args['ExperienceRequiredCode'] || ''
67
+ @travel_required = args['TravelRequired'] || ''
68
+ @travel_required_code = args['TravelRequiredCode'] || ''
69
+ @relocation_covered = args['RelocationCovered'] || ''
70
+ @relocation_options = args['RelocationOptions'] || ''
71
+ @division = args['Division'] || ''
72
+ @industry = args['Industry'] || ''
73
+ @industry_codes = args['IndustryCodes'] || ''
74
+ @manages_others = args['ManagesOthers'] || ''
75
+ @manages_others_code = args['ManagesOthersCode'] || ''
76
+ @manages_others_string = args['ManagesOthersString'] || ''
77
+
78
+ # Contact Info
79
+ @contact_email_url = args['ContactInfoEmailURL'] || ''
80
+ @contact_fax = args['ContactInfoFax'] || ''
81
+ @contact_name = args['ContactInfoName'] || ''
82
+ @contact_phone = args['ContactInfoPhone'] || ''
83
+
84
+ # Job Details related
85
+ @description = args['Description'] || args['JobDescription'] || ''
86
+ @requirements = args['JobRequirements'] || ''
87
+ @begin_date = args['BeginDate'] || ''
88
+ @end_date = args['EndDate'] || ''
89
+
90
+ # Application
91
+ @apply_url = args['ApplyURL'] || ''
92
+ @external_apply_url = args['ExternalApplyURL'] || ''
93
+ @external_application = args['ExternalApplication'] || ''
94
+ @is_screener_apply = args['IsScreenerApply'] || ''
95
+ @is_shared_job = args['IsSharedJob'] || ''
96
+ @can_be_quick_applied = args['CanBeQuickApplied'] || ''
97
+ @apply_requirements = Cb::Utils::ResponseArrayExtractor.extract(args, 'ApplyRequirements')
98
+
99
+ # Company related
100
+ @company_name = args['Company'] || ''
101
+ @company_did = args['CompanyDID'] || ''
102
+ @company_details_url = args['CompanyDetailsURL'] || ''
103
+ @company_image_url = args['CompanyImageURL'] || ''
104
+
105
+ # Recommendations related
106
+ @relevancy = args['Relevancy'] || ''
107
+ @state = args['LocationState'] || ''
108
+ @city = args['LocationCity'] || ''
109
+ @zip = args['LocationPostalCode'] || ''
110
+ @company_name = args['Company']['CompanyName'] unless args['Company'].nil? || args['Company']['CompanyName'].nil?
111
+ @company_details_url = args['Company']['CompanyDetailsURL'] unless args['Company'].nil? || args['Company']['CompanyDetailsURL'].nil?
112
+
113
+
114
+ end
115
+
116
+ def find_company
117
+ if @company
118
+ return @company
119
+ else
120
+ @company = Cb::CompanyApi.find_for self
121
+
122
+ return @company
123
+ end
124
+ end
125
+
126
+ def external_application?
127
+ @external_application.downcase == 'true' ? true : false
128
+ end
129
+
130
+ def relocation_covered?
131
+ @relocation_covered.downcase == 'true' ? true : false
132
+ end
133
+
134
+ def manages_others?
135
+ @manages_others.downcase == 'true' ? true : false
136
+ end
137
+
138
+ def screener_apply?
139
+ @is_screener_apply.downcase == 'true' ? true : false
140
+ end
141
+
142
+ def shared_job?
143
+ @is_shared_job.downcase == 'true' ? true : false
144
+ end
145
+
146
+ def can_be_quick_applied?
147
+ @can_be_quick_applied.downcase == 'true' ? true : false
148
+ end
149
+
150
+ def city
151
+ if @city.empty?
152
+ return @location['City']
153
+ else
154
+ return @city
155
+ end
156
+ end
157
+
158
+ def state
159
+ if @state.empty?
160
+ return @location['State']
161
+ else
162
+ return @state
163
+ end
164
+ end
165
+ end
166
+ end
167
+ end