bobhr 0.5.11 → 0.5.14

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: 825527923439ead3067a1642f7f52a596ff1587cb282973eb427c413657e3b85
4
- data.tar.gz: 35fd1616c04900e98536f470072c575f31ab70f8f4ebdf780ba16d466418b561
3
+ metadata.gz: a20c0745a84b5e37e77621a9a2763add4a7eac30416f00846c86300920bba425
4
+ data.tar.gz: 1177e6df4144020f139592e3f39591ac3bde0a212b353a1e100b26c62f9dc74a
5
5
  SHA512:
6
- metadata.gz: 5a7a574ea9c83d927509842630d0968c6ee168bc772536ba9c6c7f067f7b3bcadede9c2eed53b2d445dd0ea9be6a1cd1cfe1622ede6c65a11868e54481fa7457
7
- data.tar.gz: e2ddd07b3d3f6bdc5d0053bd427a1d47fb03dad86a581f5652ede10bab0a7efea11dff52b4a58e689a8a43ec244b756fd0e7e60e5de33af67c0b430490d6e845
6
+ metadata.gz: fb4a4fa0fcf022f1d36c8ed5d5f8de745a7c57b44dd5e1e792c53f9b6185a9361c4f67c2c48492743662ddbc4e6264c2fa77153516c5d79f5e0729abe2f8a7e2
7
+ data.tar.gz: ec53c213c5eb300d5081a7a44e9e074d605111645a9a93783e3380b976f149c0b67e5de7a20e8ecc9d068682dd3ba67ada6ecaeb490e86f489b4d74846012865
data/lib/bob/api/api.rb CHANGED
@@ -34,20 +34,19 @@ module Bob
34
34
  response.code
35
35
  end
36
36
 
37
- def self.post_file(endpoint, file)
37
+ def self.post_file(endpoint, file_path)
38
38
  url = build_url(endpoint)
39
39
  payload = {
40
40
  multipart: true,
41
- file: file,
41
+ file: File.new(file_path)
42
42
  }
43
43
 
44
44
  headers = {
45
- 'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001',
45
+ Accept: 'application/json',
46
+ 'Content-Type': 'multipart/form-data',
46
47
  Authorization: "Basic #{Base64.strict_encode64("#{Bob.access_user_name}:#{Bob.access_token}")}"
47
48
  }
48
49
  response = RestClient.post(url, payload, headers)
49
- binding.break
50
- p response
51
50
  response.code
52
51
  end
53
52
 
@@ -11,8 +11,8 @@ module Bob
11
11
  post("docs/people/#{employee_id}/confidential", params, use_api_key: true)
12
12
  end
13
13
 
14
- def self.upload_public_document(employee_id, file)
15
- post_file("docs/people/#{employee_id}/shared/upload", file)
14
+ def self.upload_public_document(employee_id, file_path)
15
+ post_file("docs/people/#{employee_id}/shared/upload", file_path)
16
16
  end
17
17
  end
18
18
  end
@@ -6,6 +6,7 @@ module Models
6
6
  attributes = Bob::Util.underscorize_hash(raw)
7
7
 
8
8
  attributes.each do |k, v|
9
+ k = "field_#{k}" if k.to_i > 0
9
10
  instance_variable_set("@#{k}", v.is_a?(Hash) ? Models::Base.new(v) : v)
10
11
  self.class.send(:define_method, k, proc { instance_variable_get("@#{k}") })
11
12
  self.class.send(:define_method, "#{k}=", proc { |val| instance_variable_set("@#{k}", val) })
@@ -47,15 +47,15 @@ module Models
47
47
  end
48
48
 
49
49
  def manager
50
- work.reports_to
50
+ work&.reports_to
51
51
  end
52
52
 
53
53
  def has_second_level_manager?
54
- work.second_level_manager.present?
54
+ work&.second_level_manager.present?
55
55
  end
56
56
 
57
57
  def second_level_manager
58
- @second_level_manager ||= Bob::Employees.find(work.second_level_manager)
58
+ @second_level_manager ||= Bob::Employees.find(work&.second_level_manager)
59
59
  end
60
60
 
61
61
  def has_third_level_manager?
@@ -63,15 +63,15 @@ module Models
63
63
  end
64
64
 
65
65
  def third_level_manager
66
- second_level_manager.manager
66
+ second_level_manager&.manager
67
67
  end
68
68
 
69
69
  def has_fourth_level_manager?
70
- second_level_manager.work.second_level_manager.present?
70
+ second_level_manager.work&.second_level_manager.present?
71
71
  end
72
72
 
73
73
  def fourth_level_manager
74
- second_level_manager.second_level_manager
74
+ second_level_manager&.second_level_manager
75
75
  end
76
76
 
77
77
  def cost_center
@@ -3,7 +3,8 @@
3
3
  module Models
4
4
  class TimeOff < Models::Base
5
5
  def employee
6
- @employee ||= Bob::Employees.find(employee_id)
6
+ identification = email.present? ? email : employee_id
7
+ @employee ||= Bob::Employees.find(identification)
7
8
  end
8
9
 
9
10
  def parental_leave?
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.11'
4
+ VERSION = '0.5.14'
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.11
4
+ version: 0.5.14
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-05-31 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.2.31
132
+ rubygems_version: 3.3.7
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Ruby gem for Bob API