bobhr 0.3.3 → 0.4.1
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/bob/api.rb +8 -6
- data/lib/bob/reports.rb +14 -1
- data/lib/bob/version.rb +1 -1
- data/lib/bob/webhooks.rb +10 -0
- data/lib/bob.rb +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b9d038c1042d01b0e46340d931e1c5da69fa042d4f7b5b80d4b0da16c9d55cb
|
4
|
+
data.tar.gz: 76de84e1183c0670233fdbd90436bd05d4f1a37e7546f04d4ed18ed0b9c98598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0faea7caf98f0e5b1c3db8af78bce12b9422453dc4e56da3fd87fa2bfbd7a9430198e9c24397f4b517af3e1a18f15c44995a58b3aafbacb62eea9b9b0a2d1308
|
7
|
+
data.tar.gz: '0286903dc7b12ea93d9acdf031e5df8c77c843ee2a123291b492c31f5641e4113fcc8774e0ea399aa5cbc6a760e74f96c6e8069a393f6c902b23085e9a0bc7d7'
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
51
51
|
|
52
52
|
## Contributing
|
53
53
|
|
54
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lienvdsteen/hibob. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/lienvdsteen/hibob/blob/master/CODE_OF_CONDUCT.md).
|
55
55
|
|
56
56
|
## License
|
57
57
|
|
@@ -59,4 +59,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
59
59
|
|
60
60
|
## Code of Conduct
|
61
61
|
|
62
|
-
Everyone interacting in the Hibob project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
62
|
+
Everyone interacting in the Hibob project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/lienvdsteen/hibob/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/bob/api.rb
CHANGED
@@ -10,7 +10,7 @@ module Bob
|
|
10
10
|
class API
|
11
11
|
BASE_URL = 'https://api.hibob.com'
|
12
12
|
|
13
|
-
def self.get(endpoint, params = {}, csv_response
|
13
|
+
def self.get(endpoint, params = {}, csv_response: false)
|
14
14
|
url = build_url(endpoint, params)
|
15
15
|
response = RestClient.get(url, headers)
|
16
16
|
return create_csv(response.body) if csv_response
|
@@ -56,17 +56,19 @@ module Bob
|
|
56
56
|
url
|
57
57
|
end
|
58
58
|
|
59
|
-
private
|
60
|
-
|
61
59
|
def self.create_csv(content)
|
62
|
-
|
60
|
+
file_name = SecureRandom.alphanumeric(15)
|
61
|
+
|
62
|
+
content.gsub!("\r", '').gsub!('', '')
|
63
63
|
splitted = content.split("\n")
|
64
|
-
CSV.open("
|
64
|
+
CSV.open("tmp/#{file_name}.csv", 'wb') do |csv|
|
65
65
|
csv << splitted.shift.split(',')
|
66
66
|
splitted.each do |row|
|
67
|
-
csv <<
|
67
|
+
csv << CSV.parse_line(row)
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
"tmp/#{file_name}.csv"
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
data/lib/bob/reports.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'net/sftp'
|
4
|
+
|
3
5
|
module Bob
|
4
6
|
class Reports < API
|
5
7
|
def self.all
|
@@ -7,7 +9,18 @@ module Bob
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def self.read(report_id)
|
10
|
-
get("company/reports/#{report_id}/download?format=csv", {}, true)
|
12
|
+
get("company/reports/#{report_id}/download?format=csv", {}, csv_response: true)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.sftp_upload(sftp_details:, report_id:)
|
16
|
+
file_name = read(report_id)
|
17
|
+
uri = URI.parse("sftp://#{sftp_details[:host]}")
|
18
|
+
|
19
|
+
Net::SFTP.start(uri.host, sftp_details[:user], password: sftp_details[:password]) do |sftp|
|
20
|
+
sftp.upload!(file_name, sftp_details[:remote_file_path])
|
21
|
+
end
|
22
|
+
|
23
|
+
true
|
11
24
|
end
|
12
25
|
end
|
13
26
|
end
|
data/lib/bob/version.rb
CHANGED
data/lib/bob/webhooks.rb
ADDED
data/lib/bob.rb
CHANGED
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.
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-sftp
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rest-client
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,6 +78,7 @@ files:
|
|
64
78
|
- lib/bob/reports.rb
|
65
79
|
- lib/bob/time_off.rb
|
66
80
|
- lib/bob/version.rb
|
81
|
+
- lib/bob/webhooks.rb
|
67
82
|
- lib/bobhr.rb
|
68
83
|
homepage: https://github.com/lienvdsteen/hibob
|
69
84
|
licenses:
|
@@ -85,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
100
|
- !ruby/object:Gem::Version
|
86
101
|
version: '0'
|
87
102
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.3.7
|
89
104
|
signing_key:
|
90
105
|
specification_version: 4
|
91
106
|
summary: Ruby gem for Bob API
|