bobhr 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bob/api.rb +17 -1
- data/lib/bob/reports.rb +1 -1
- data/lib/bob/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 372b43f26c87a5eb6756486b7fae157c03ac8c018b37fae8bce1535e89e143c0
|
4
|
+
data.tar.gz: '0385c30f1f4371f410f11e0de393eeea984788f6f49d50d384002d4d6ca09c1c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05d570b22c1d4c37324bbe32bd7b6a6ff95d50fb71ba2c9e1ac4d27f33f0f92f554e4b25cc930f7f8e37b004e9b8e007ebd088bd1e5f9f20fedef0517047e26a
|
7
|
+
data.tar.gz: 4884d586604c41533afda06c8c012e9c9821a090ae0123596da7ca9a81fd3ca58dc346ad9f85fcd55f6ffe24b4dc2a6c5debc18c36a487b22e27129ca1fa0cd5
|
data/lib/bob/api.rb
CHANGED
@@ -4,14 +4,17 @@ require 'rest-client'
|
|
4
4
|
require 'json'
|
5
5
|
require 'uri'
|
6
6
|
require 'base64'
|
7
|
+
require 'csv'
|
7
8
|
|
8
9
|
module Bob
|
9
10
|
class API
|
10
11
|
BASE_URL = 'https://api.hibob.com'
|
11
12
|
|
12
|
-
def self.get(endpoint, params = {})
|
13
|
+
def self.get(endpoint, params = {}, csv_response = false)
|
13
14
|
url = build_url(endpoint, params)
|
14
15
|
response = RestClient.get(url, headers)
|
16
|
+
return create_csv(response.body) if csv_response
|
17
|
+
|
15
18
|
JSON.parse(response.body)
|
16
19
|
end
|
17
20
|
|
@@ -52,5 +55,18 @@ module Bob
|
|
52
55
|
|
53
56
|
url
|
54
57
|
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def self.create_csv(content)
|
62
|
+
content.gsub!("\r", '').gsub!("", '')
|
63
|
+
splitted = content.split("\n")
|
64
|
+
CSV.open("response.csv", "wb") do |csv|
|
65
|
+
csv << splitted.shift.split(',')
|
66
|
+
splitted.each do |row|
|
67
|
+
csv << row.split(',')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
55
71
|
end
|
56
72
|
end
|
data/lib/bob/reports.rb
CHANGED
data/lib/bob/version.rb
CHANGED