spear-cb-api 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spear.rb +1 -0
- data/lib/spear/configuration.rb +2 -1
- data/lib/spear/plugins/model/user.rb +5 -0
- data/lib/spear/resource/user.rb +7 -0
- data/lib/spear/structure/user/token_authenticate.rb +14 -0
- data/lib/spear/version.rb +1 -1
- data/spec/spear_spec.rb +26 -21
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dec699507450f5c9d44f0dc3e1fc31aa9deb37d
|
4
|
+
data.tar.gz: 01a2615a36de993317b42841178c5f7d5d0e5f4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc92b53fb30815cf1515830063a953fb7943cee612c702c00eb578625fcb828b6f3b7cd71ac97685547252546509c999410a60eeb3884c66d0b65562c13cddce
|
7
|
+
data.tar.gz: 748b1de68ad195155b8607383cf1507e905aff5a236a03fb6f39dd6a5824cffb8018df389356918dc6bcb138f49315b46bba77fe1a76358d067886b5ae67ad5a
|
data/lib/spear.rb
CHANGED
@@ -23,6 +23,7 @@ module Spear
|
|
23
23
|
autoload :CheckExisting, 'spear/structure/user/check_existing'
|
24
24
|
autoload :Create, 'spear/structure/user/create'
|
25
25
|
autoload :Retrieve, 'spear/structure/user/retrieve'
|
26
|
+
autoload :TokenAuthenticate, 'spear/structure/user/token_authenticate'
|
26
27
|
end
|
27
28
|
|
28
29
|
module Resume
|
data/lib/spear/configuration.rb
CHANGED
@@ -49,7 +49,8 @@ module Spear
|
|
49
49
|
uri_tn_menber_create: '/talentnetwork/member/create/%s',
|
50
50
|
uri_user_checkexisting: '/v2/user/checkexisting',
|
51
51
|
uri_user_create: '/v2/user/create',
|
52
|
-
uri_user_retrieve: '/v2/user/retrieve'
|
52
|
+
uri_user_retrieve: '/v2/user/retrieve',
|
53
|
+
uri_user_token_authenticate: '/v2/user/token'
|
53
54
|
}
|
54
55
|
|
55
56
|
@@options = defaults.merge(options)
|
data/lib/spear/resource/user.rb
CHANGED
@@ -18,6 +18,13 @@ module Spear
|
|
18
18
|
Spear::Request.new(:post, Spear.uri_user_retrieve, {
|
19
19
|
body: {:ExternalID => user_external_id, :Password => password}}).execute
|
20
20
|
end
|
21
|
+
|
22
|
+
def token_authenticate(user_external_id)
|
23
|
+
raise Spear::ParametersRequired.new('UserExternalID') if user_external_id.blank?
|
24
|
+
|
25
|
+
Spear::Request.new(:post, Spear.uri_user_token_authenticate, {
|
26
|
+
body: {:ExternalID => user_external_id, :DestinationUrl => '/jobseeker/MyCB.aspx'}}).execute
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Spear
|
2
|
+
module Structure
|
3
|
+
module User
|
4
|
+
class TokenAuthenticate < Structure::Base
|
5
|
+
attr_reader :token_authentication_url
|
6
|
+
|
7
|
+
def initialize(response)
|
8
|
+
super(response)
|
9
|
+
@token_authentication_url = @root['TokenAuthenticationUrl']
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/spear/version.rb
CHANGED
data/spec/spear_spec.rb
CHANGED
@@ -4,37 +4,37 @@ describe Spear do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
it "check user existing" do
|
7
|
-
|
8
|
-
puts
|
7
|
+
res = Spear.check_existing('zhangfei@163.com.cn', 'Qwer1234!')
|
8
|
+
puts res.response
|
9
9
|
end
|
10
10
|
|
11
11
|
it "application history" do
|
12
|
-
|
13
|
-
puts
|
12
|
+
res = Spear.history('J3H0YY6LLK553R3Z32Z')
|
13
|
+
puts res.response
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'search job' do
|
17
|
-
|
18
|
-
puts
|
17
|
+
res = Spear.search_job({:TalentNetworkDID => 'TN818G76D6YWYNBXHB3Z', :SiteEntity => 'TalentNetworkJob', :CountryCode => 'IN'})
|
18
|
+
puts res.response
|
19
19
|
end
|
20
20
|
|
21
21
|
it "retrieve job" do
|
22
|
-
|
23
|
-
puts
|
22
|
+
res = Spear.retrieve_job('J3H0YY6LLK553R3Z32Z')
|
23
|
+
puts res.response
|
24
24
|
end
|
25
25
|
|
26
26
|
it "create application" do
|
27
|
-
|
28
|
-
puts
|
27
|
+
res = Spear.create_application('IN', {JobDID: 'xxx', Resume: {ResumeTitle: 'title'}, Responses: [{QuestionID: 'id', ResponseText: 'text'}]})
|
28
|
+
puts res.response
|
29
29
|
end
|
30
30
|
|
31
31
|
it "tn join form question" do
|
32
|
-
|
33
|
-
puts
|
32
|
+
res = Spear.join_form_questions('TN818G76D6YWYNBXHB3Z')
|
33
|
+
puts res.response
|
34
34
|
end
|
35
35
|
|
36
36
|
it "tn create member" do
|
37
|
-
|
37
|
+
res = Spear.create_member({
|
38
38
|
TalentNetworkDID: 'TN818G76D6YWYNBXHB3Z',
|
39
39
|
PreferredLanguage: 'USEnglish',
|
40
40
|
AcceptPrivacy: false,
|
@@ -45,26 +45,31 @@ describe Spear do
|
|
45
45
|
{Key: 'JQ7I3CM6P9B09VCVD9YF', Value: 'AVAILABLENOW'}
|
46
46
|
]
|
47
47
|
})
|
48
|
-
puts
|
48
|
+
puts res.response
|
49
49
|
end
|
50
50
|
|
51
51
|
it "get application status" do
|
52
|
-
#
|
53
|
-
|
54
|
-
puts
|
52
|
+
# res = Spear.application_status(['JAWS4L16LFXD7ZL87LLC', 'JAWW63876DWNQGSWZ384', 'JA4M44C77CDSR0QHTRJ6'])
|
53
|
+
res = Spear.application_status('J3H0YY6LLK553R3Z32Z', 'zhangfei@sina.com.cn')
|
54
|
+
puts res.response
|
55
55
|
end
|
56
56
|
|
57
57
|
it "get application blank" do
|
58
|
-
|
59
|
-
puts
|
58
|
+
res = Spear.application_blank('J3H0YY6LLK553R3Z32Z')
|
59
|
+
puts res.response
|
60
60
|
end
|
61
61
|
|
62
62
|
it "application submit" do
|
63
|
-
|
63
|
+
res = Spear.application_submit('J3H0YY6LLK553R3Z32Z', [
|
64
64
|
{QuestionID: 'ApplicantName', ResponseText: 'Zhangfei'},
|
65
65
|
{QuestionID: 'ApplicantEmail', ResponseText: 'zhangfei@sina.com.cn'},
|
66
66
|
{QuestionID: 'Resume', ResponseText: 'test resume'}
|
67
67
|
])
|
68
|
-
puts
|
68
|
+
puts res.response
|
69
|
+
end
|
70
|
+
|
71
|
+
it "token authenicate" do
|
72
|
+
res = Spear.token_authenticate('XRHT30S64S90Y384P9C7')
|
73
|
+
puts res.response
|
69
74
|
end
|
70
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spear-cb-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CBluowei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- lib/spear/structure/user/check_existing.rb
|
218
218
|
- lib/spear/structure/user/create.rb
|
219
219
|
- lib/spear/structure/user/retrieve.rb
|
220
|
+
- lib/spear/structure/user/token_authenticate.rb
|
220
221
|
- lib/spear/version.rb
|
221
222
|
- spear-cb-api.gemspec
|
222
223
|
- spec/spear_spec.rb
|