spear-cb-api 0.0.4 → 0.0.5
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 +4 -4
- data/README.md +2 -2
- data/lib/spear/configuration.rb +11 -6
- data/lib/spear/plugins/model/job.rb +2 -2
- data/lib/spear/request.rb +0 -2
- data/lib/spear/structure/job/retrieve.rb +6 -3
- data/lib/spear/version.rb +1 -1
- data/spec/spear_spec.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 572c44d8a917c806d6cc051ec15a1718f18bf0e8
|
4
|
+
data.tar.gz: c1a4a9002901cfd850f11c9818afaf7f7fef340b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2def3db8234e53e22b19122a937c2675c4e754bfe270db980cf44eeafe323479176f7239f9c88c96211adf010c3810e044b232ae21d3c8830e2cbb67813d8bac
|
7
|
+
data.tar.gz: 02c44672205e3af0bc2cc8c91459efe0fe93056b98efd8a4faf49d49a9927e58c900934f2fff1088bf24aabb10a37063e9f9cd18bc5a65e471944c66cc39b523
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Spear Cb Api
|
2
2
|
|
3
|
-
|
3
|
+
CB api tool.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
###See [Wiki](https://github.com/hilotus/spear-cb-api/wiki)
|
22
22
|
|
23
23
|
## Contributing
|
24
24
|
|
data/lib/spear/configuration.rb
CHANGED
@@ -4,10 +4,6 @@ module Spear
|
|
4
4
|
|
5
5
|
@@options = {}
|
6
6
|
|
7
|
-
def test?
|
8
|
-
@@options[:use_test] || false
|
9
|
-
end
|
10
|
-
|
11
7
|
# use https or http
|
12
8
|
def ssh?
|
13
9
|
@@options[:use_ssh] || true
|
@@ -25,6 +21,10 @@ module Spear
|
|
25
21
|
@@options[:version] || "v2"
|
26
22
|
end
|
27
23
|
|
24
|
+
def test?
|
25
|
+
@@options[:use_test] || false
|
26
|
+
end
|
27
|
+
|
28
28
|
def dev_key
|
29
29
|
@@options[:dev_key]
|
30
30
|
end
|
@@ -42,8 +42,12 @@ module Spear
|
|
42
42
|
@@options[:project]
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
|
45
|
+
# def use_dummy?
|
46
|
+
# @@options[:using_dummy] || false
|
47
|
+
# end
|
48
|
+
|
49
|
+
def config(options={})
|
50
|
+
@@options = options.merge!({use_ssh: true, hostname: 'api.careerbuilder.com', port: 443, version: 'v2'})
|
47
51
|
|
48
52
|
raise Spear::ParametersRequired.new('DeveloperKey') if dev_key.nil?
|
49
53
|
raise Spear::ParametersNotValid.new('You must specify a project name, if you want save api info.') if save_api? and project.nil?
|
@@ -56,6 +60,7 @@ module Spear
|
|
56
60
|
def include_plugins
|
57
61
|
Request.include Plugins::SaveApis if save_api?
|
58
62
|
Spear.extend Plugins::Models if use_model?
|
63
|
+
# Spear.extend Dummy if use_dummy?
|
59
64
|
end
|
60
65
|
|
61
66
|
end
|
data/lib/spear/request.rb
CHANGED
@@ -6,8 +6,6 @@ module Spear
|
|
6
6
|
extend ActiveModel::Callbacks
|
7
7
|
define_model_callbacks :execute, :only => [:before, :after]
|
8
8
|
|
9
|
-
attr_reader :resource
|
10
|
-
|
11
9
|
# params: {:body => {}, :query => {}, :api_options => {}}
|
12
10
|
# exp: api_options: {:path => "/v1"}
|
13
11
|
def execute(method, endpoint, params={})
|
@@ -8,9 +8,12 @@ module Spear
|
|
8
8
|
def initialize(response)
|
9
9
|
super(response)
|
10
10
|
@job_id = response.request.options[:query][:DID]
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
unless @root["Job"].nil?
|
13
|
+
@job_description = @root["Job"]["JobDescription"]
|
14
|
+
@job_requirements = @root["Job"]["JobRequirements"]
|
15
|
+
@job_title = @root["Job"]["JobTitle"]
|
16
|
+
end
|
14
17
|
end
|
15
18
|
end
|
16
19
|
end
|
data/lib/spear/version.rb
CHANGED
data/spec/spear_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
describe Spear do
|
2
2
|
before :each do
|
3
|
-
Spear.config({dev_key: 'xxx', :
|
3
|
+
Spear.config({dev_key: 'xxx', project: 'ProjectName', using_model: true})
|
4
4
|
end
|
5
5
|
|
6
6
|
it "check user existing" do
|
@@ -15,11 +15,11 @@ describe Spear do
|
|
15
15
|
|
16
16
|
it 'search job' do
|
17
17
|
s = Spear.search_job({:TalentNetworkDID => 'TN818G76D6YWYNBXHB3Z', :SiteEntity => 'TalentNetworkJob', :CountryCode => 'IN'})
|
18
|
-
puts s.jobs.last.posted_date
|
18
|
+
puts s.jobs.last.nil? ? 'nil' : s.jobs.last.posted_date
|
19
19
|
end
|
20
20
|
|
21
21
|
it "retrieve job" do
|
22
|
-
s = Spear.retrieve_job('J3J4BP6MGVH2DJZ6MJH'
|
22
|
+
s = Spear.retrieve_job('J3J4BP6MGVH2DJZ6MJH')
|
23
23
|
puts s.job_description
|
24
24
|
end
|
25
25
|
|