cb-api 20.2.0 → 20.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92374c6c4f74849c829bf162b42c4440a2baa7d0
4
- data.tar.gz: ef474853a7d47abd21bd3160975777fe1e2dac6c
3
+ metadata.gz: 93505a4bc675cdacf5ff5a8fd8870b7276bae400
4
+ data.tar.gz: 576665c4765eabbcc5710dde17a20f6d5643841d
5
5
  SHA512:
6
- metadata.gz: 2f9e367fdf0b70fbe9a21ac298fc6b8c8fc9d08a92db6401fd4f221850abb9ae07e7872e9a9b9350ee5949d6d20d2d0f6c8a355eb8283fc828e6e6bf47af94f1
7
- data.tar.gz: 92339cb6c2668404be9dff090ca1dec9b16925eb27f0abca5e791579352178892a6e71bbfb21f6bd58c8066eb348523de66aa7565cd9196717c3541b34f67457
6
+ metadata.gz: d03bb23f83f51ee41c77b6abeb8911fdc356c095b4edbd50d7d46477ad8ad029c8b45bc57d66423a254c9199cbe08be68c6e152503d19abddbf72791f6b2adc6
7
+ data.tar.gz: 617611843ed9a6cf44335d890ddbad19f03f8e79cbd2ff6777725128f2e36d737ee64de2c92d199531650073c5073b528a410eb343a3f62372e50d41a4998524
@@ -2,6 +2,7 @@ Version History
2
2
  ====
3
3
  * All Version bumps are required to update this file as well!!
4
4
  ----
5
+ * 20.2.1 `class << self` for classes with all class methods. DRY up the URI building for Cover Letter Update & Delete.
5
6
  * 20.2.0 Adding job insights client
6
7
  * 20.1.1 Having nil reponses behave more like we did pre ruby 2.2 so as not to break downstream peeps
7
8
  * 20.1.0 Remove Migration ID field from resume listing model.
@@ -11,16 +11,18 @@
11
11
  module Cb
12
12
  module Clients
13
13
  class Base
14
- def self.cb_client
15
- @cb_client ||= Cb::Utils::Api.instance
16
- end
14
+ class << self
15
+ def cb_client
16
+ @cb_client ||= Cb::Utils::Api.instance
17
+ end
17
18
 
18
- def self.headers(args)
19
- {
20
- 'Accept' => 'application/json',
21
- 'Authorization' => "Bearer #{ args[:oauth_token] }",
22
- 'Content-Type' => 'application/json'
23
- }
19
+ def headers(args)
20
+ {
21
+ 'Accept' => 'application/json',
22
+ 'Authorization' => "Bearer #{ args[:oauth_token] }",
23
+ 'Content-Type' => 'application/json'
24
+ }
25
+ end
24
26
  end
25
27
  end
26
28
  end
@@ -12,36 +12,40 @@ require_relative 'base'
12
12
  module Cb
13
13
  module Clients
14
14
  class CoverLetters < Base
15
- def self.get(args={})
16
- uri = Cb.configuration.uri_cover_letters
17
- uri += "/#{ args[:id] }" if args[:id]
18
- cb_client.cb_get(uri, headers: headers(args))
19
- end
15
+ class << self
16
+ def get(args={})
17
+ uri = Cb.configuration.uri_cover_letters
18
+ uri += "/#{ args[:id] }" if args[:id]
19
+ cb_client.cb_get(uri, headers: headers(args))
20
+ end
20
21
 
21
- def self.create(args={})
22
- cb_client.cb_put(Cb.configuration.uri_cover_letters,
23
- body: body(args),
24
- headers: headers(args))
25
- end
22
+ def create(args={})
23
+ cb_client.cb_put(Cb.configuration.uri_cover_letters,
24
+ body: body(args),
25
+ headers: headers(args))
26
+ end
26
27
 
27
- def self.delete(args={})
28
- uri = "#{ Cb.configuration.uri_cover_letters }/#{ args[:id] }"
29
- cb_client.cb_delete(uri, body: body(args), headers: headers(args))
30
- end
28
+ def delete(args={})
29
+ cb_client.cb_delete(uri_with_id(args), body: body(args), headers: headers(args))
30
+ end
31
31
 
32
- def self.update(args={})
33
- uri = "#{ Cb.configuration.uri_cover_letters }/#{ args[:id] }"
34
- cb_client.cb_post(uri, body: body(args), headers: headers(args))
35
- end
32
+ def update(args={})
33
+ cb_client.cb_post(uri_with_id(args), body: body(args), headers: headers(args))
34
+ end
35
+
36
+ private
36
37
 
37
- private
38
+ def uri_with_id(args)
39
+ "#{ Cb.configuration.uri_cover_letters }/#{ args[:id] }"
40
+ end
38
41
 
39
- def self.body(args)
40
- body = Hash.new
41
- body[:id] = args[:id] if args[:id]
42
- body[:text] = args[:text] if args[:text]
43
- body[:name] = args[:name] if args[:name]
44
- body.to_json
42
+ def body(args)
43
+ body = Hash.new
44
+ body[:id] = args[:id] if args[:id]
45
+ body[:text] = args[:text] if args[:text]
46
+ body[:name] = args[:name] if args[:name]
47
+ body.to_json
48
+ end
45
49
  end
46
50
  end
47
51
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2015 CareerBuilder, LLC
1
+ # Copyright 2016 CareerBuilder, LLC
2
2
  # Licensed under the Apache License, Version 2.0 (the "License");
3
3
  # you may not use this file except in compliance with the License.
4
4
  # You may obtain a copy of the License at
@@ -9,5 +9,5 @@
9
9
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
10
  # See the License for the specific language governing permissions and limitations under the License.
11
11
  module Cb
12
- VERSION = '20.2.0'
12
+ VERSION = '20.2.1'
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 20.2.0
4
+ version: 20.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The CareerBuilder.com Niche and Consumer Development teams