bobhr 0.5.4 → 0.5.7

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
  SHA256:
3
- metadata.gz: 9e2f23eb79a6c8ff9f97d068faec100a7dfbc1ad19660dbf35d24506579a3c73
4
- data.tar.gz: d650aac15ce41ffb4615c461eb1d4472a263c77582e114237fd442a44d90481d
3
+ metadata.gz: 830aed0d496d361b22920509e3f59f00cc0c15b71c9d9c4e1e36ad31a0189ea9
4
+ data.tar.gz: 8ef2f6a47e1fb831c2b38b0a992f47fcbf22164e76cc04ccee09f400d8a21863
5
5
  SHA512:
6
- metadata.gz: d0f9fe09c4605ab62d86b0bd1d624405fd9295fc536321ff371562dbbfcefe94263246f4094264a79b1f8f8013ce0ecdf7d46b112d2b9bd371c819fdc454f361
7
- data.tar.gz: c972a2596bbfaf7c57e958f394a35a56f744c2e85dc32688ebede7aae7d30f371a8346e7cb466682b9646edbcb8bff8e8eec37ab398bd058b17a661847de9ca4
6
+ metadata.gz: d674a8bbbff9ea7070392e3df5c93b447002ffffe85d422617959cf921d922a9f1a0f6e898521013c5edcf216d0868122ed3cd3fec8f24f99d5ba70d630776b9
7
+ data.tar.gz: 6faea74ea478adfc54f8856cb4c3b12151b56212c73f2850ed8f1a2f541081082ef6571fffbb83580412887da9b85ac89bb6601eb83b0bcb0f3a084a97b747b7
data/lib/bob/api/api.rb CHANGED
@@ -24,6 +24,12 @@ module Bob
24
24
  response.code
25
25
  end
26
26
 
27
+ def self.post_media(endpoint, params = {})
28
+ url = build_url(endpoint)
29
+ response = RestClient.post(url, params.to_json, media_headers.merge(content_headers))
30
+ response.code
31
+ end
32
+
27
33
  def self.delete(endpoint)
28
34
  url = build_url(endpoint)
29
35
  response = RestClient.delete(url)
@@ -42,6 +48,12 @@ module Bob
42
48
  }
43
49
  end
44
50
 
51
+ def self.media_headers
52
+ {
53
+ Authorization: Bob.api_key
54
+ }
55
+ end
56
+
45
57
  def self.content_headers
46
58
  {
47
59
  Accept: 'application/json',
@@ -4,11 +4,11 @@ module Bob
4
4
  module Employee
5
5
  class Documents < API
6
6
  def self.add_public_document(employee_id, params = {})
7
- post("docs/people/#{employee_id}/shared", params)
7
+ post_media("docs/people/#{employee_id}/shared", params)
8
8
  end
9
9
 
10
10
  def self.add_private_document(employee_id, params = {})
11
- post("docs/people/#{employee_id}/confidential", params)
11
+ post_media("docs/people/#{employee_id}/confidential", params)
12
12
  end
13
13
  end
14
14
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Bob
4
4
  module Configuration
5
- VALID_OPTIONS_KEYS = %i[access_token access_user_name api_version].freeze
5
+ VALID_OPTIONS_KEYS = %i[access_token access_user_name api_version api_key].freeze
6
6
  attr_accessor(*VALID_OPTIONS_KEYS)
7
7
 
8
8
  # Sets all configuration options to their default values
@@ -26,6 +26,7 @@ module Bob
26
26
  self.api_version = 'v1'
27
27
  self.access_token = ENV['ACCESS_TOKEN']
28
28
  self.access_user_name = ENV['ACCESS_USER_NAME']
29
+ self.api_key = ENV['API_KEY']
29
30
  end
30
31
  end
31
32
  end
@@ -38,8 +38,44 @@ module Models
38
38
  human_readable.work.custom_columns.column_1629151373898
39
39
  end
40
40
 
41
+ def has_manager?
42
+ manager.present?
43
+ end
44
+
41
45
  def manager
42
46
  work.reports_to
43
47
  end
48
+
49
+ def has_second_level_manager?
50
+ work.second_level_manager.present?
51
+ end
52
+
53
+ def second_level_manager
54
+ @second_level_manager ||= Bob::Employees.find(work.second_level_manager)
55
+ end
56
+
57
+ def has_third_level_manager?
58
+ third_level_manager.present?
59
+ end
60
+
61
+ def third_level_manager
62
+ second_level_manager.manager
63
+ end
64
+
65
+ def has_fourth_level_manager?
66
+ second_level_manager.work.second_level_manager.present?
67
+ end
68
+
69
+ def fourth_level_manager
70
+ second_level_manager.second_level_manager
71
+ end
72
+
73
+ def cost_center
74
+ payroll.custom.field_1634476091511
75
+ end
76
+
77
+ def personal_email
78
+ home.private_email
79
+ end
44
80
  end
45
81
  end
data/lib/bob/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bob
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bobhr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lien Van Den Steen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-16 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json