bobhr 0.5.23 → 0.5.25

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: b6ef6e70507f7b2220fa41a22227eba5d07ddc521c1f2269a34e6bdcd2628a7a
4
- data.tar.gz: 6adc95b33cbadb141a3a062bc651fa0d556fb3e09f8c97001b9b58437a5f9cfc
3
+ metadata.gz: 9b8d978bea211c1e2e4105b2c5007a0dcc68df3924edb1450c9c9b8961599673
4
+ data.tar.gz: c1240f3ec70fb8d152dbc4e63ae35302b20c07144948e1452ebc7e005f0ce53f
5
5
  SHA512:
6
- metadata.gz: 05d8033b2387dfc9b2a4de9a5d1e3ec337bd5d4483aaa7aec35c68c443443a458952368a2b5c294038b81c5d6a3b88f1631691811cbde674e4c1fd8e2667250d
7
- data.tar.gz: 949667da309d4e9f6f03d2080b75054c0507b69516983e9674f288229db59f58e7ed71d2b6ef2d856b12553700030cc225baf6ac6ad715604571112729621051
6
+ metadata.gz: 4697f6c9d4be79ac0e2c6e84b35761e10c6a2f20fa8e2770dbcd22ca01e5035f1119f375bd14c6ada4ddff1b25eebd18298a51fd849115b3f9de4e854bc8033c
7
+ data.tar.gz: 590ddd4fe42bde02327bbe42fdb8c23bf62d5759c314a70be9d84f8ba73dc68ba6d0551480abfff924a5cd8e72dd4249776b92aedd3ef557491cb5b6dab38fb3
data/lib/bob/api/api.rb CHANGED
@@ -10,10 +10,22 @@ module Bob
10
10
  class API
11
11
  BASE_URL = 'https://api.hibob.com'
12
12
 
13
+ MAX_RETRIES = 3
14
+
13
15
  def self.get(endpoint, params = {}, csv_response: false)
14
- url = build_url(endpoint, params)
15
- response = RestClient.get(url, authorization_header)
16
- return create_csv(response.body) if csv_response
16
+ retries = 0
17
+
18
+ begin
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
17
29
 
18
30
  JSON.parse(response.body)
19
31
  end
@@ -5,7 +5,7 @@ module Bob
5
5
  class EmploymentHistory < API
6
6
  def self.all(employee_id)
7
7
  response = get("people/#{employee_id}/employment")
8
- EmploymentHistoryParser.new(response).work_histories
8
+ EmploymentHistoryParser.new(response).employment_histories
9
9
  end
10
10
 
11
11
  def self.create(employee_id, params)
@@ -2,7 +2,7 @@
2
2
 
3
3
  class CompanyListParser < BaseParser
4
4
  def list
5
- Models::CompanyList.new(json_response)
5
+ json_response['values'].map {|attributes| Models::CompanyList.new(attributes) }
6
6
  end
7
7
 
8
8
  def lists
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.23'
4
+ VERSION = '0.5.25'
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.23
4
+ version: 0.5.25
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-12-20 00:00:00.000000000 Z
11
+ date: 2023-01-20 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.3.7
137
+ rubygems_version: 3.2.31
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Ruby gem for Bob API