cb-api 0.1.17 → 0.1.18
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.
- checksums.yaml +15 -0
- data/lib/cb.rb +4 -0
- data/lib/cb/clients/email_subscription_api.rb +56 -0
- data/lib/cb/config.rb +6 -1
- data/lib/cb/models/cb_email_subscription.rb +19 -0
- data/lib/cb/version.rb +1 -1
- metadata +7 -13
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTBjZjg4Njg1MWJiZjJlOGYyMzk2OTAzNzAwODIzYTQ1MzE2NWNkZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTIwMzU4Y2Y4NDQ5NTdmZjk5NmFkM2M3ODM5YjJiYTAxMzc1YTYxZA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NzJlMzMwODNiZDk2ZTlhYThhNGQyMDI4ZTBiZDEyNWEwMzBhNTUyOWIxMTUy
|
10
|
+
OTA5Yjk3YmY1MjMyNjhlMDc1NGE4N2Y5ZTEyZmIwODE2YzBiMDc2NWM4MTQ5
|
11
|
+
ZWFmY2IwNGE3YTgzODc1OWUwZGU2YmNmOTNiNzk1MDM3NDhiYmY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGVkNzY2MGJjZGMyMDdiNDIwMDE1OTUzMjgzNjFiZDg4MGU4YzYwZWU0ZDA1
|
14
|
+
ZTZjYTUwODg4NTM2YzZmZTg0NWE2NDMyOWQ2MjAyYmY0MGU0MjFiYjNiOGU1
|
15
|
+
YWRiNTAwZTFiOTc5MzYxZmU2OGUwN2JhYmNkMTViYmIwZjFhMDc=
|
data/lib/cb.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
class EmailSubscriptionApi
|
5
|
+
#############################################################
|
6
|
+
## Retrieve subscription values for a user
|
7
|
+
##
|
8
|
+
## For detailed information around this API please visit:
|
9
|
+
## http://api.careerbuilder.com/usersubscriptionretrieve.aspx
|
10
|
+
#############################################################
|
11
|
+
def self.retrieve_by_did(did)
|
12
|
+
my_api = Cb::Utils::Api.new()
|
13
|
+
cb_response = my_api.cb_get(Cb.configuration.uri_subscription_retrieve, :query => {:ExternalID => did})
|
14
|
+
json_hash = JSON.parse(cb_response.response.body)
|
15
|
+
subscription = CbEmailSubscription.new(json_hash['SubscriptionValues'])
|
16
|
+
|
17
|
+
return subscription
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
#############################################################
|
22
|
+
## Update subscription values for a user
|
23
|
+
##
|
24
|
+
## For detailed information around this API please visit:
|
25
|
+
## http://api.careerbuilder.com/usersubscriptionretrieve.aspx
|
26
|
+
#############################################################
|
27
|
+
def self.modify_subscription ext_id, career_resources, product_sponsor_info, applicant_survey_invites, job_recs, unsubscribe_all
|
28
|
+
if unsubscribe_all
|
29
|
+
career_resources = product_sponsor_info = applicant_survey_invites = job_recs = false.to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
my_api = Cb::Utils::Api.new()
|
33
|
+
|
34
|
+
xml_body = "<Request>"
|
35
|
+
xml_body += "<DeveloperKey>" + Cb.configuration.dev_key.to_s + "</DeveloperKey>"
|
36
|
+
xml_body += "<ExternalID>" + ext_id.to_s + "</ExternalID>"
|
37
|
+
xml_body += "<CareerResources>" + career_resources.to_s + "</CareerResources>"
|
38
|
+
xml_body += "<ProductSponsorInfo>" + product_sponsor_info.to_s + "</ProductSponsorInfo>"
|
39
|
+
xml_body += "<ApplicantSurveyInvites>" + applicant_survey_invites.to_s + "</ApplicantSurveyInvites>"
|
40
|
+
xml_body += "<JobRecs>" + job_recs.to_s + "</JobRecs>"
|
41
|
+
xml_body += "<UnsubscribeAll>" + unsubscribe_all.to_s + "</UnsubscribeAll>"
|
42
|
+
xml_body += "</Request>"
|
43
|
+
|
44
|
+
|
45
|
+
cb_response = my_api.cb_post(Cb.configuration.uri_subscription_modify,
|
46
|
+
:body => xml_body)
|
47
|
+
|
48
|
+
json_hash = JSON.parse(cb_response.response.body)
|
49
|
+
|
50
|
+
subscription = CbEmailSubscription.new(json_hash['SubscriptionValues'])
|
51
|
+
|
52
|
+
return subscription
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/cb/config.rb
CHANGED
@@ -10,7 +10,8 @@ module Cb
|
|
10
10
|
:uri_application_external,
|
11
11
|
:uri_application_registered, :uri_user_change_password,
|
12
12
|
:uri_user_delete, :uri_user_retrieve,
|
13
|
-
:uri_job_branding, :uri_saved_job_search_create
|
13
|
+
:uri_job_branding, :uri_saved_job_search_create,
|
14
|
+
:uri_subscription_retrieve, :uri_subscription_modify
|
14
15
|
|
15
16
|
def initialize
|
16
17
|
Cb::Utils::Country.inject_convenience_methods
|
@@ -35,6 +36,8 @@ module Cb
|
|
35
36
|
@uri_user_delete ||= '/v2/User/delete'
|
36
37
|
@uri_user_retrieve ||= '/v2/user/retrieve'
|
37
38
|
@uri_job_branding ||= '/branding'
|
39
|
+
@uri_subscription_retrieve ||= '/v1/user/subscription/retrieve'
|
40
|
+
@uri_subscription_modify ||= '/v1/user/subscription'
|
38
41
|
@uri_saved_job_search_create ||= '/v2/savedsearch/create'
|
39
42
|
end
|
40
43
|
|
@@ -59,6 +62,8 @@ module Cb
|
|
59
62
|
:uri_user_change_password => @uri_user_change_password,
|
60
63
|
:uri_user_retrieve => @uri_user_retrieve,
|
61
64
|
:uri_job_branding => @uri_job_branding,
|
65
|
+
:uri_subscription_retrieve => @uri_subscription_retrieve,
|
66
|
+
:uri_subscription_modify => @uri_subscription_modify,
|
62
67
|
:uri_saved_job_search_create => @uri_saved_job_search_create
|
63
68
|
}
|
64
69
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Cb
|
2
|
+
class CbEmailSubscription
|
3
|
+
attr_accessor :career_resources, :product_sponsor_info, :applicant_survey_invites,
|
4
|
+
:job_recs, :unsubscribe_all
|
5
|
+
|
6
|
+
def initialize(args = {})
|
7
|
+
return if args.nil?
|
8
|
+
|
9
|
+
@career_resources = args['CareerResources'].to_s || ''
|
10
|
+
@product_sponsor_info = args['ProductSponsorInfo'].to_s || ''
|
11
|
+
@applicant_survey_invites = args['ApplicantSurveyInvites'].to_s || ''
|
12
|
+
@job_recs = args['JobRecs'].to_s || ''
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/cb/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cb-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.18
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jesse Retchko
|
@@ -15,12 +14,11 @@ authors:
|
|
15
14
|
autorequire:
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
|
-
date: 2013-07-
|
17
|
+
date: 2013-07-23 00:00:00.000000000 Z
|
19
18
|
dependencies:
|
20
19
|
- !ruby/object:Gem::Dependency
|
21
20
|
name: httparty
|
22
21
|
requirement: !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
22
|
requirements:
|
25
23
|
- - ~>
|
26
24
|
- !ruby/object:Gem::Version
|
@@ -28,7 +26,6 @@ dependencies:
|
|
28
26
|
type: :runtime
|
29
27
|
prerelease: false
|
30
28
|
version_requirements: !ruby/object:Gem::Requirement
|
31
|
-
none: false
|
32
29
|
requirements:
|
33
30
|
- - ~>
|
34
31
|
- !ruby/object:Gem::Version
|
@@ -36,7 +33,6 @@ dependencies:
|
|
36
33
|
- !ruby/object:Gem::Dependency
|
37
34
|
name: json
|
38
35
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
36
|
requirements:
|
41
37
|
- - ~>
|
42
38
|
- !ruby/object:Gem::Version
|
@@ -44,7 +40,6 @@ dependencies:
|
|
44
40
|
type: :runtime
|
45
41
|
prerelease: false
|
46
42
|
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
43
|
requirements:
|
49
44
|
- - ~>
|
50
45
|
- !ruby/object:Gem::Version
|
@@ -52,7 +47,6 @@ dependencies:
|
|
52
47
|
- !ruby/object:Gem::Dependency
|
53
48
|
name: nori
|
54
49
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
50
|
requirements:
|
57
51
|
- - ~>
|
58
52
|
- !ruby/object:Gem::Version
|
@@ -60,7 +54,6 @@ dependencies:
|
|
60
54
|
type: :runtime
|
61
55
|
prerelease: false
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
57
|
requirements:
|
65
58
|
- - ~>
|
66
59
|
- !ruby/object:Gem::Version
|
@@ -83,6 +76,7 @@ files:
|
|
83
76
|
- lib/cb/clients/cb_saved_job_search_api.rb
|
84
77
|
- lib/cb/clients/company_api.rb
|
85
78
|
- lib/cb/clients/education_api.rb
|
79
|
+
- lib/cb/clients/email_subscription_api.rb
|
86
80
|
- lib/cb/clients/employee_types_api.rb
|
87
81
|
- lib/cb/clients/job_api.rb
|
88
82
|
- lib/cb/clients/job_branding_api.rb
|
@@ -110,6 +104,7 @@ files:
|
|
110
104
|
- lib/cb/models/cb_category.rb
|
111
105
|
- lib/cb/models/cb_company.rb
|
112
106
|
- lib/cb/models/cb_education.rb
|
107
|
+
- lib/cb/models/cb_email_subscription.rb
|
113
108
|
- lib/cb/models/cb_employee_type.rb
|
114
109
|
- lib/cb/models/cb_job.rb
|
115
110
|
- lib/cb/models/cb_job_branding.rb
|
@@ -125,26 +120,25 @@ files:
|
|
125
120
|
- README.md
|
126
121
|
homepage: http://api.careerbuilder.com
|
127
122
|
licenses: []
|
123
|
+
metadata: {}
|
128
124
|
post_install_message:
|
129
125
|
rdoc_options: []
|
130
126
|
require_paths:
|
131
127
|
- lib
|
132
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
129
|
requirements:
|
135
130
|
- - ! '>='
|
136
131
|
- !ruby/object:Gem::Version
|
137
132
|
version: '0'
|
138
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
134
|
requirements:
|
141
135
|
- - ! '>='
|
142
136
|
- !ruby/object:Gem::Version
|
143
137
|
version: '0'
|
144
138
|
requirements: []
|
145
139
|
rubyforge_project:
|
146
|
-
rubygems_version:
|
140
|
+
rubygems_version: 2.0.3
|
147
141
|
signing_key:
|
148
|
-
specification_version:
|
142
|
+
specification_version: 4
|
149
143
|
summary: Ruby wrapper around Careerbuilder Public API.
|
150
144
|
test_files: []
|