spear-cb-api 0.0.10 → 0.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9735511da1987a6ebf6037689ccc8bc1c558111d
4
- data.tar.gz: e66ee281b2cda1bfc31e7d59c6e26801c9776307
3
+ metadata.gz: 2dec699507450f5c9d44f0dc3e1fc31aa9deb37d
4
+ data.tar.gz: 01a2615a36de993317b42841178c5f7d5d0e5f4e
5
5
  SHA512:
6
- metadata.gz: b73ecf48f0b22dd010a6f0899f9636f270388bfcafe4af31cb5e1e59c927869d0f4c41176411c627584bb3ed5497a1ce9a2071a8681936b8daffd32bc5fe3a2b
7
- data.tar.gz: 659f62673de00af1023aab7ce2bad3ce63341cb9bdbd6990999653687ec372d7a408b4ce9e66e39f5b854e0d5d0a50be9d6060ca110b1c34926593a7da73d125
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
@@ -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)
@@ -19,6 +19,11 @@ module Spear
19
19
  Structure::User::Retrieve.new(response)
20
20
  end
21
21
 
22
+ def token_authenticate(user_external_id)
23
+ response = super(user_external_id)
24
+ Structure::User::TokenAuthenticate.new(response)
25
+ end
26
+
22
27
  end
23
28
  end
24
29
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Spear
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
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
- s = Spear.check_existing('zhangfei@163.com.cn', '111111111')
8
- puts s.response
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
- s = Spear.history('J3H0YY6LLK553R3Z32Z')
13
- puts s.response
12
+ res = Spear.history('J3H0YY6LLK553R3Z32Z')
13
+ puts res.response
14
14
  end
15
15
 
16
16
  it 'search job' do
17
- s = Spear.search_job({:TalentNetworkDID => 'TN818G76D6YWYNBXHB3Z', :SiteEntity => 'TalentNetworkJob', :CountryCode => 'IN'})
18
- puts s.response
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
- s = Spear.retrieve_job('J3H0YY6LLK553R3Z32Z')
23
- puts s.response
22
+ res = Spear.retrieve_job('J3H0YY6LLK553R3Z32Z')
23
+ puts res.response
24
24
  end
25
25
 
26
26
  it "create application" do
27
- s = Spear.create_application('IN', {JobDID: 'xxx', Resume: {ResumeTitle: 'title'}, Responses: [{QuestionID: 'id', ResponseText: 'text'}]})
28
- puts s.response
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
- s = Spear.join_form_questions('TN818G76D6YWYNBXHB3Z')
33
- puts s.response
32
+ res = Spear.join_form_questions('TN818G76D6YWYNBXHB3Z')
33
+ puts res.response
34
34
  end
35
35
 
36
36
  it "tn create member" do
37
- s = Spear.create_member({
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 s.response
48
+ puts res.response
49
49
  end
50
50
 
51
51
  it "get application status" do
52
- # s = Spear.application_status(['JAWS4L16LFXD7ZL87LLC', 'JAWW63876DWNQGSWZ384', 'JA4M44C77CDSR0QHTRJ6'])
53
- s = Spear.application_status('J3H0YY6LLK553R3Z32Z', 'zhangfei@sina.com.cn')
54
- puts s.response
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
- s = Spear.application_blank('J3H0YY6LLK553R3Z32Z')
59
- puts s.response
58
+ res = Spear.application_blank('J3H0YY6LLK553R3Z32Z')
59
+ puts res.response
60
60
  end
61
61
 
62
62
  it "application submit" do
63
- s = Spear.application_submit('J3H0YY6LLK553R3Z32Z', [
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 s.response
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.10
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-16 00:00:00.000000000 Z
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