cb-api 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NGJiN2Q3MmJkZjQ3ZTgzMjBiZjA1ODZlYjk0MjYxYjE0NmQ1MjExMA==
5
+ data.tar.gz: !binary |-
6
+ OGQ4YWU3ZWU2NjgzOWM5MTNkYWIyMjQ5YjUwNzk2NTI1ODgwYTM0Nw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZmY4MGM2YzkwMzY4YmUwNWQxMjRkMzFjOTdmMDhlOTUwOWM5YTEzNWI0Yjc2
10
+ NjA0Y2VkZTgzNWQ0YTRhODNhOTI3NmVlOGI3M2Y1M2NhN2ZhZTY2ZTQyNWU1
11
+ NDM3M2VkZThjNjI0OTk0OTU0ZmU0ZjdkZjQ2YzU4YTk1ZGEwYjA=
12
+ data.tar.gz: !binary |-
13
+ YmI3OTcxMGY0MjY1OGRkNDE5MzJmYTVkMTE4ODc3ZjVjNjBhN2E1ZjI2Zjcw
14
+ ZTYwNTFlMGYxNTU5YmVhMDc0NGY2OGJjMjRjY2MxNzY0NjJlYmNmM2U4MjU1
15
+ OTljMGI4NDM5YjRkZGU3ZWNjOTE0ZWJlNTdjMjMwN2Y3OTMyNGE=
data/README.md CHANGED
@@ -9,10 +9,10 @@ Configuration
9
9
  ================
10
10
  Set your dev key, and any other configuration settings in a place that will run prior to your API calls.
11
11
 
12
- Cb.configure do | config |
13
- config.dev_key = 'your-dev-key-goes-here'
14
- config.time_out = 5
15
- end
12
+ Cb.configure do |config|
13
+ config.dev_key = 'your-dev-key-goes-here'
14
+ config.time_out = 5
15
+ end
16
16
 
17
17
  Job Search
18
18
  ================
@@ -20,28 +20,28 @@ There's a couple ways to go about conducting a job search.
20
20
 
21
21
  Option 1:
22
22
 
23
- search = Cb.job_search_criteria.location('Atlanta, GA').radius(10).search()
23
+ search = Cb.job_search_criteria.location('Atlanta, GA').radius(10).search()
24
24
 
25
25
  Option 2:
26
26
 
27
- crit = Cb.job_search_criteria
28
- crit.location = 'Atlanta, GA'
29
- crit.radius = 10
30
- search = crit.search()
27
+ crit = Cb.job_search_criteria
28
+ crit.location = 'Atlanta, GA'
29
+ crit.radius = 10
30
+ search = crit.search()
31
31
 
32
32
  Either way, you will get back an array of CbJob.
33
33
 
34
- search.each | job | do
35
- puts job.title
36
- puts job.company_name
37
- puts job.instance_variables
38
- end
34
+ search.each do |job|
35
+ puts job.title
36
+ puts job.company_name
37
+ puts job.instance_variables
38
+ end
39
39
 
40
40
  You will also get meta data regarding the search itself (helpful for pagination).
41
41
 
42
- puts search.cb_response.total_pages
43
- puts search.cb_response.total_count
44
- puts search.cb_response.errors # Hopefully this is nil! If it's not nil, it will be an array of error messages.
42
+ puts search.cb_response.total_pages
43
+ puts search.cb_response.total_count
44
+ puts search.cb_response.errors # Hopefully this is nil! If it's not nil, it will be an array of error messages.
45
45
 
46
46
  Coming Soon
47
47
  ================
data/lib/cb.rb CHANGED
@@ -10,6 +10,7 @@ Dir[File.dirname(__FILE__) + '/cb/utils/*.rb'].each {| file| require file }
10
10
  Dir[File.dirname(__FILE__) + '/cb/clients/*.rb'].each {| file| require file }
11
11
  Dir[File.dirname(__FILE__) + '/cb/criteria/*.rb'].each {| file| require file }
12
12
  Dir[File.dirname(__FILE__) + '/cb/models/*.rb'].each {| file| require file }
13
+ Dir[File.dirname(__FILE__) + '/cb/models/**/*.rb'].each {| file| require file }
13
14
 
14
15
  module Cb
15
16
  class IncomingParamIsWrongTypeException < StandardError; end
@@ -59,6 +60,10 @@ module Cb
59
60
  Cb::ApplicationApi
60
61
  end
61
62
 
63
+ def self.application_external
64
+ Cb::ApplicationExternalApi
65
+ end
66
+
62
67
  def self.country
63
68
  Cb::Utils::Country
64
69
  end
@@ -66,4 +71,8 @@ module Cb
66
71
  def self.user
67
72
  Cb::UserApi
68
73
  end
74
+
75
+ def self.job_branding
76
+ Cb::JobBrandingApi
77
+ end
69
78
  end
@@ -0,0 +1,25 @@
1
+ require 'json'
2
+
3
+ module Cb
4
+ class ApplicationExternalApi
5
+ #############################################################
6
+ ## Submit an external application and attach the apply url to the app if successful
7
+ ##
8
+ ## For detailed information around this API please visit:
9
+ ## http://api.careerbuilder.com/ApplicationInfo.aspx
10
+ #############################################################
11
+ def self.submit_app(app)
12
+ raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::CbApplicationExternal)
13
+
14
+ my_api = Cb::Utils::Api.new()
15
+ xml_hash = my_api.cb_post(Cb.configuration.uri_application_external, :body => app.to_xml)
16
+ my_api.append_api_responses(app, xml_hash)
17
+
18
+ begin
19
+ app.apply_url = xml_hash["ApplyUrl"] || ''
20
+ end
21
+
22
+ return app
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ require 'nori'
2
+
3
+ module Cb
4
+
5
+ class JobBrandingApi
6
+
7
+ def self.find_by_id id
8
+ my_api = Cb::Utils::Api.new
9
+
10
+ cb_response = my_api.cb_get Cb.configuration.uri_job_branding, :query => { :id => id }
11
+
12
+ xml_hash = Nori.new.parse cb_response.response.body
13
+
14
+ return CbJobBranding.new xml_hash['Branding']
15
+ end
16
+
17
+ end
18
+
19
+ end
data/lib/cb/config.rb CHANGED
@@ -7,8 +7,10 @@ module Cb
7
7
  :uri_recommendation_for_job, :uri_recommendation_for_user,
8
8
  :uri_recommendation_for_company,
9
9
  :uri_application, :uri_application_submit,
10
+ :uri_application_external,
10
11
  :uri_application_registered, :uri_user_change_password,
11
- :uri_user_delete, :uri_user_retrieve
12
+ :uri_user_delete, :uri_user_retrieve,
13
+ :uri_job_branding
12
14
 
13
15
  def initialize
14
16
  Cb::Utils::Country.inject_convenience_methods
@@ -28,9 +30,11 @@ module Cb
28
30
  @uri_application ||= '/v1/application/blank'
29
31
  @uri_application_submit ||= '/v1/Application/submit'
30
32
  @uri_application_registered ||= '/v3/Application/registered'
33
+ @uri_application_external ||= '/v1/application/external'
31
34
  @uri_user_change_password ||= '/v2/User/ChangePW'
32
35
  @uri_user_delete ||= '/v2/User/delete'
33
36
  @uri_user_retrieve ||= '/v2/user/retrieve'
37
+ @uri_job_branding ||= '/branding'
34
38
  end
35
39
 
36
40
  def to_hash
@@ -52,7 +56,8 @@ module Cb
52
56
  :uri_application_submit => @uri_application_submit,
53
57
  :uri_application_registered => @uri_application_registered,
54
58
  :uri_user_change_password => @uri_user_change_password,
55
- :uri_user_retrieve => @uri_user_retrieve
59
+ :uri_user_retrieve => @uri_user_retrieve,
60
+ :uri_job_branding => @uri_job_branding
56
61
  }
57
62
  end
58
63
 
@@ -0,0 +1,17 @@
1
+ module Cb::Branding
2
+
3
+ class Media
4
+
5
+ attr_accessor :header, :header_type, :tablet_banner, :mobile_logo, :footer
6
+
7
+ def initialize args = {}
8
+ @header = args['Header'] || ''
9
+ @header_type = args['HeaderType'] || ''
10
+ @tablet_banner = args['TabletBanner'] || ''
11
+ @mobile_logo = args['MobileLogo'] || ''
12
+ @footer = args['Footer'] || ''
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,20 @@
1
+ module Cb::Branding
2
+
3
+ class Section
4
+ # Might be changing?
5
+ attr_accessor :type, :section_1, :section_2, :section_3, :description, :requirements, :snapshot
6
+
7
+ def initialize type, args = {}
8
+ @type = type
9
+
10
+ @section_1 = args['Section1'] || ''
11
+ @section_2 = args['Section2'] || ''
12
+ @section_3 = args['Section3'] || ''
13
+ @description = args['Description'] || ''
14
+ @requirements = args['Requirements'] || ''
15
+ @snapshot = args['Snapshot'] || ''
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,15 @@
1
+ module Cb::Branding
2
+
3
+ class Style
4
+
5
+ attr_accessor :page, :job_details, :company_info
6
+
7
+ def initialize args = {}
8
+ @page = Cb::Branding::Styles::Page.new args['Page']
9
+ @job_details = Cb::Branding::Styles::JobDetails.new args['JobDetails']
10
+ @company_info = Cb::Branding::Styles::CompanyInfo.new args['CompanyInfo']
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,15 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class Base
4
+ attr_writer :styles
5
+
6
+ def initialize args = {}
7
+ @styles = args
8
+ end
9
+
10
+ def raw
11
+ @styles
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,8 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class Buttons < Base
4
+ include Cb::Branding::Styles::CssAdapter
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,16 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class CompanyInfo < Base
4
+ attr_accessor :buttons, :container, :content, :headings
5
+
6
+ def initialize args = {}
7
+ super
8
+
9
+ @buttons = Buttons.new args
10
+ @container = Container.new args
11
+ @content = Content.new args
12
+ @headings = Headings.new args
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,8 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class Container < Base
4
+ include CssAdapter
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,8 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class Content < Base
4
+ include CssAdapter
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,48 @@
1
+ module Cb::Branding
2
+
3
+ module Styles
4
+
5
+ module CssAdapter
6
+
7
+ def to_css
8
+ css = ''
9
+
10
+ @styles.each do |style, value|
11
+ css += generate_style style, value
12
+ end
13
+
14
+ css
15
+ end
16
+
17
+ private
18
+ def generate_style style, value
19
+ {
20
+ 'BackgroundColor' => "background-color: #{value};",
21
+ 'BackgroundImage' => "background-image: url(#{value});",
22
+ 'BackgroundGradient' => "background: #{value['Color1']};
23
+ background: -moz-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%, #{value['Color2']} 100%);
24
+ background: -webkit-gradient(linear, left top, #{value['Orientation'] == 'Vertical' ? 'left bottom' : 'right top'}, color-stop(0%,#{value['Color1']}), color-stop(100%,#{value['Color2']}));
25
+ background: -webkit-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
26
+ background: -o-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
27
+ background: -ms-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
28
+ background: linear-gradient(to #{value['Orientation'] == 'Vertical' ? 'bottom' : 'right'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
29
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{value['Color1']}', endColorstr='#{value['Color2']}',GradientType=#{value['Orientation'] == 'Vertical' ? '0' : '1'} );",
30
+ 'BorderSize' => "border-width: #{value};",
31
+ 'BorderColor' => "border-color: #{value};",
32
+ 'BorderRadius' => "-webkit-border-radius: #{value};
33
+ -moz-border-radius: #{value};
34
+ border-radius: #{value};",
35
+ 'BoxShadow' => "-webkit-box-shadow: #{value};
36
+ -moz-box-shadow: #{value};
37
+ box-shadow: #{value};",
38
+ 'FontColor' => "color: #{value};",
39
+ 'FontSize' => "font-size: #{value};",
40
+ 'FontStyle' => "font-family: #{value};"
41
+ }[style].gsub(/\s+/, '')
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,8 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class Headings < Base
4
+ include CssAdapter
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,16 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class JobDetails < Base
4
+ attr_accessor :container, :content, :headings
5
+
6
+ def initialize args = {}
7
+ super
8
+
9
+ @container = Container.new args
10
+ @content = Content.new args
11
+ @headings = Headings.new args
12
+ end
13
+
14
+ end
15
+
16
+ end
@@ -0,0 +1,8 @@
1
+ module Cb::Branding::Styles
2
+
3
+ class Page < Base
4
+ include CssAdapter
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,13 @@
1
+ module Cb::Branding
2
+
3
+ class Widget
4
+ attr_accessor :type, :url
5
+
6
+ def initialize type, url
7
+ @type = type
8
+ @url = url
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,31 @@
1
+ module Cb
2
+ class CbApplicationExternal
3
+ # API Request parameters
4
+ attr_accessor :job_did, :email, :site_id, :ipath
5
+
6
+ # Response from External Application API
7
+ # Populated after application submission.
8
+ attr_accessor :apply_url
9
+
10
+ def initialize(args = {})
11
+ @job_did = args[:job_did] || ''
12
+ @email = args[:email] || ''
13
+ @site_id = args[:site_id] || ''
14
+ @ipath = args[:ipath] || ''
15
+ @apply_url = ''
16
+ end
17
+
18
+ def to_xml
19
+ ret = "<Request>"
20
+ ret += "<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>"
21
+ ret += "<EmailAddress>#{@email}</EmailAddress>"
22
+ ret += "<JobDID>#{@job_did}</JobDID>"
23
+ ret += "<SiteID>#{@site_id}</SiteID>"
24
+ ret += "<IPath>#{@ipath}</IPath>"
25
+ ret += "<IsExternalLinkApply>false</IsExternalLinkApply>"
26
+ ret += "<HostSite>#{Cb.configuration.host_site}</HostSite>"
27
+ ret += "</Request>"
28
+ ret
29
+ end # to_xml
30
+ end # CbApplicationExternal
31
+ end # Cb
@@ -1,6 +1,6 @@
1
1
  module Cb
2
2
  class CbJob
3
- attr_accessor :did, :title, :job_skin, :pay, :pay_per, :commission, :bonus,
3
+ attr_accessor :did, :title, :job_skin, :job_skin_did, :job_branding, :pay, :pay_per, :commission, :bonus,
4
4
  :categories, :category_codes, :degree_required, :experience_required, :travel_required,
5
5
  :industry_codes, :manages_others_code,
6
6
  :contact_email_url, :contact_fax, :contact_name, :contact_phone,
@@ -30,6 +30,8 @@ module Cb
30
30
  @longitude = args['LocationLongitude'] || ''
31
31
  @location_formatted = args['LocationFormatted'] || ''
32
32
  @job_skin = args.has_key?("JobSkin") && !args["JobSkin"].nil? ? args['JobSkin']['#cdata-section'] : ''
33
+ @job_skin_did = args['JobSkinDID'] || ''
34
+ @job_branding = @job_skin_did.blank? ? '' : Cb.job_branding.find_by_id(@job_skid_did)
33
35
 
34
36
  # Compensation
35
37
  @pay = args['PayHighLowFormatted'] || ''
@@ -0,0 +1,29 @@
1
+ require 'cb/models/branding/styles/css_adapter' # Path load errors in cb.rb - just doing this here for the time being.
2
+
3
+ module Cb
4
+ class CbJobBranding
5
+
6
+ attr_accessor :name, :media, :sections, :styles, :widgets, :id, :account_id, :type, :errors
7
+
8
+ def initialize args = {}
9
+ @name = args['Name'] || ''
10
+ @id = args['Id'] || ''
11
+ @account_id = args['AccountId'] || ''
12
+ @type = args['Type'] || ''
13
+ @media = Cb::Branding::Media.new args['Media']
14
+ @styles = Cb::Branding::Style.new args['Styles']
15
+ @errors = args['Errors'] || ''
16
+
17
+ @sections, @widgets = [], []
18
+
19
+ args['Sections'].each do |type, sections|
20
+ @sections << Cb::Branding::Section.new(type, sections) unless sections.nil?
21
+ end
22
+
23
+ args['Widgets'].each do |type, url|
24
+ @widgets << Cb::Branding::Widget.new(type, url) unless url.nil?
25
+ end
26
+ end
27
+
28
+ end
29
+ end
data/lib/cb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
5
- prerelease:
4
+ version: 0.1.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jesse Retchko
9
8
  - Chris Little
9
+ - Matthew Moldavan
10
10
  - Miriam Williams
11
11
  - David Posey
12
12
  - Kyle Bumpus
@@ -14,12 +14,11 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2013-06-25 00:00:00.000000000 Z
17
+ date: 2013-07-09 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: httparty
21
21
  requirement: !ruby/object:Gem::Requirement
22
- none: false
23
22
  requirements:
24
23
  - - ~>
25
24
  - !ruby/object:Gem::Version
@@ -27,7 +26,6 @@ dependencies:
27
26
  type: :runtime
28
27
  prerelease: false
29
28
  version_requirements: !ruby/object:Gem::Requirement
30
- none: false
31
29
  requirements:
32
30
  - - ~>
33
31
  - !ruby/object:Gem::Version
@@ -35,7 +33,6 @@ dependencies:
35
33
  - !ruby/object:Gem::Dependency
36
34
  name: json
37
35
  requirement: !ruby/object:Gem::Requirement
38
- none: false
39
36
  requirements:
40
37
  - - ~>
41
38
  - !ruby/object:Gem::Version
@@ -43,7 +40,6 @@ dependencies:
43
40
  type: :runtime
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
- none: false
47
43
  requirements:
48
44
  - - ~>
49
45
  - !ruby/object:Gem::Version
@@ -52,7 +48,7 @@ description: Ruby wrapper for Careerbuilder Public API.
52
48
  email:
53
49
  - Jesse.Retchko@Careerbuilder.com
54
50
  - Chris.Little@Careerbuilder.com
55
- - MiriamDeana@gmail.com
51
+ - Matt.Moldavan@Careerbuilder.com
56
52
  - David.Posey@Careerbuilder.com
57
53
  - Kyle.Bumpus@Careerbuilder.com
58
54
  - Ben.Schmaltz@Careerbuilder.com
@@ -61,23 +57,40 @@ extensions: []
61
57
  extra_rdoc_files: []
62
58
  files:
63
59
  - lib/cb/clients/application_api.rb
60
+ - lib/cb/clients/application_external_api.rb
64
61
  - lib/cb/clients/category_api.rb
65
62
  - lib/cb/clients/company_api.rb
66
63
  - lib/cb/clients/education_api.rb
67
64
  - lib/cb/clients/employee_types_api.rb
68
65
  - lib/cb/clients/job_api.rb
66
+ - lib/cb/clients/job_branding_api.rb
69
67
  - lib/cb/clients/recommendation_api.rb
70
68
  - lib/cb/clients/user_api.rb
71
69
  - lib/cb/config.rb
72
70
  - lib/cb/criteria/job_details_criteria.rb
73
71
  - lib/cb/criteria/job_search_criteria.rb
72
+ - lib/cb/models/branding/media.rb
73
+ - lib/cb/models/branding/section.rb
74
+ - lib/cb/models/branding/style.rb
75
+ - lib/cb/models/branding/styles/base.rb
76
+ - lib/cb/models/branding/styles/buttons.rb
77
+ - lib/cb/models/branding/styles/company_info.rb
78
+ - lib/cb/models/branding/styles/container.rb
79
+ - lib/cb/models/branding/styles/content.rb
80
+ - lib/cb/models/branding/styles/css_adapter.rb
81
+ - lib/cb/models/branding/styles/headings.rb
82
+ - lib/cb/models/branding/styles/job_details.rb
83
+ - lib/cb/models/branding/styles/page.rb
84
+ - lib/cb/models/branding/widget.rb
74
85
  - lib/cb/models/cb_application.rb
86
+ - lib/cb/models/cb_application_external.rb
75
87
  - lib/cb/models/cb_application_schema.rb
76
88
  - lib/cb/models/cb_category.rb
77
89
  - lib/cb/models/cb_company.rb
78
90
  - lib/cb/models/cb_education.rb
79
91
  - lib/cb/models/cb_employee_type.rb
80
92
  - lib/cb/models/cb_job.rb
93
+ - lib/cb/models/cb_job_branding.rb
81
94
  - lib/cb/models/cb_user.rb
82
95
  - lib/cb/utils/api.rb
83
96
  - lib/cb/utils/country.rb
@@ -89,26 +102,25 @@ files:
89
102
  - README.md
90
103
  homepage: http://api.careerbuilder.com
91
104
  licenses: []
105
+ metadata: {}
92
106
  post_install_message:
93
107
  rdoc_options: []
94
108
  require_paths:
95
109
  - lib
96
110
  required_ruby_version: !ruby/object:Gem::Requirement
97
- none: false
98
111
  requirements:
99
112
  - - ! '>='
100
113
  - !ruby/object:Gem::Version
101
114
  version: '0'
102
115
  required_rubygems_version: !ruby/object:Gem::Requirement
103
- none: false
104
116
  requirements:
105
117
  - - ! '>='
106
118
  - !ruby/object:Gem::Version
107
119
  version: '0'
108
120
  requirements: []
109
121
  rubyforge_project:
110
- rubygems_version: 1.8.24
122
+ rubygems_version: 2.0.3
111
123
  signing_key:
112
- specification_version: 3
124
+ specification_version: 4
113
125
  summary: Ruby wrapper around Careerbuilder Public API.
114
126
  test_files: []