bobhr 0.5.26 → 0.5.28
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/api.rb +6 -16
- data/lib/bob/api/metadata/time_off_policies.rb +2 -2
- data/lib/bob/configuration.rb +2 -1
- data/lib/bob/models/employee.rb +1 -1
- data/lib/bob/parsers/company_list_parser.rb +1 -1
- data/lib/bob/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 517aaa5bb5c24baa4d78f669c1e6ffe70aa3d2024bd5307384ce45d7ff606092
|
4
|
+
data.tar.gz: a0fd0d5e69441b3fb531abe3a69f71df15505345192168069ff7370f03c151e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eda0b5d8399ebf9792ec68a06dd6997cd94a3402460bd0cd78576a0462a3124c72df22f82ac3f5b841d2e02460677d6f4ee7cbcdba8c4e4186123257e8182151
|
7
|
+
data.tar.gz: 27c3aa148f7bc244f7cedced5c84a1c77defe68e5cbe8828dc1cd13d3ac54418f4f1c50247c19caae8d140cc69d27ee9685b8c5dd892ce2f8bc4cbf405311137
|
data/lib/bob/api/api.rb
CHANGED
@@ -9,23 +9,12 @@ require 'csv'
|
|
9
9
|
module Bob
|
10
10
|
class API
|
11
11
|
BASE_URL = 'https://api.hibob.com'
|
12
|
-
|
13
|
-
MAX_RETRIES = 3
|
12
|
+
SANDBOX_URL = 'https://api.sandbox.hibob.com'
|
14
13
|
|
15
14
|
def self.get(endpoint, params = {}, csv_response: false)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
url = build_url(endpoint, params)
|
20
|
-
response = RestClient.get(url, authorization_header)
|
21
|
-
rescue
|
22
|
-
if (retries += 1) < MAX_RETRIES
|
23
|
-
sleep 60
|
24
|
-
retry
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
return create_csv(response.body) if csv_response
|
15
|
+
url = build_url(endpoint, params)
|
16
|
+
response = RestClient.get(url, authorization_header)
|
17
|
+
return create_csv(response.body) if csv_response
|
29
18
|
|
30
19
|
JSON.parse(response.body)
|
31
20
|
end
|
@@ -98,7 +87,8 @@ module Bob
|
|
98
87
|
end
|
99
88
|
|
100
89
|
def self.build_url(endpoint, params = {})
|
101
|
-
url = "#{BASE_URL}/#{Bob.api_version}/#{endpoint}"
|
90
|
+
url = "#{BASE_URL}/#{Bob.api_version}/#{endpoint}" unless Bob.use_sandbox
|
91
|
+
url = "#{SANDBOX_URL}/#{Bob.api_version}/#{endpoint}" if Bob.use_sandbox
|
102
92
|
url += "?#{URI.encode_www_form(params)}" unless params.empty?
|
103
93
|
|
104
94
|
url
|
@@ -8,12 +8,12 @@ module Bob
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.find(policy_name)
|
11
|
-
response = get(
|
11
|
+
response = get('timeoff/policies', { policyName: policy_name })
|
12
12
|
BaseParser.new(response).fields
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.names_for(policy_name)
|
16
|
-
get(
|
16
|
+
get('timeoff/policies/names', { policyTypeName: policy_name })['policies']
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/bob/configuration.rb
CHANGED
@@ -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 api_key].freeze
|
5
|
+
VALID_OPTIONS_KEYS = %i[access_token access_user_name api_version api_key use_sandbox].freeze
|
6
6
|
attr_accessor(*VALID_OPTIONS_KEYS)
|
7
7
|
|
8
8
|
# Sets all configuration options to their default values
|
@@ -27,6 +27,7 @@ module Bob
|
|
27
27
|
self.access_token = ENV['ACCESS_TOKEN']
|
28
28
|
self.access_user_name = ENV['ACCESS_USER_NAME']
|
29
29
|
self.api_key = ENV['API_KEY']
|
30
|
+
self.use_sandbox = false
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/bob/models/employee.rb
CHANGED
data/lib/bob/version.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.5.
|
4
|
+
version: 0.5.28
|
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: 2023-
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
137
|
+
rubygems_version: 3.3.26
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Ruby gem for Bob API
|