bamboozled-gitlab 0.2.9 → 0.2.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4d649a7e640ec6d04fc6681ae57c009a06074a094d6c03f34e4ebf7608971df
4
- data.tar.gz: 805f024096cb4ec040cebb5abfe38c0c176399b6fdb034af511f01b028cb4194
3
+ metadata.gz: 1bb824cff5b90ba6e27dba753824572e334f507dd0e1e576de477d43fde9eed4
4
+ data.tar.gz: 3cc9d10446f2b8ff1cc9841e0181e79f309b6094ff458cc1a7c897a803bc7474
5
5
  SHA512:
6
- metadata.gz: 643909c1f710fca8d51499ad4a83a812764de0a6cdb2c2505112088b0d9bc780de7470d4eaddffcfefbd418afcbb90bc43d9e89ba03b0e7c8df23ee649ea83c9
7
- data.tar.gz: cbfbc6cdb28d1a36345a1451bafcb3c0e36cb5d2789041b9155f059a3804dba33c7a956f694df2b3aac395c8994ac5877cb9459ff6280e93cf0c149d7cfbdda0
6
+ metadata.gz: 36985162f4df37beb37760054b408365d3bd02ea93244c2062aaadbfc2f7606c3c8f3ce79ea484ddda52c28f43196fadf5061f0cd0f4424455c99661189905fd
7
+ data.tar.gz: 50a32b7285feceb4a1091272c2b559e1cecb13330228e337fc2c71b91ba04cfb84fe0f809b38da2b6c024977e9797695ad694b6e78e690e34b36933e537dbb2f
data/bamboozled.gemspec CHANGED
@@ -4,10 +4,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "bamboozled/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "bamboozled-gitlab"
7
+ spec.name = 'bamboozled-gitlab'
8
8
  spec.version = Bamboozled::VERSION
9
- spec.authors = ["Mark Rickert"]
10
- spec.email = ["mjar81@gmail.com"]
9
+ spec.authors = ["Mark Rickert", "Lien Van Den Steen"]
10
+ spec.email = ["mjar81@gmail.com", 'lvandensteen@gitlab.com']
11
11
  spec.summary = "A Ruby wrapper for the BambooHR API http://www.bamboohr.com/"
12
12
  spec.description = "Bamboozled wraps the BambooHR API without the use of Rails dependencies."
13
13
  spec.homepage = "http://github.com/Skookum/bamboozled"
@@ -59,6 +59,18 @@ module Bamboozled
59
59
  request(:get, "employees/#{employee_id}/time_off/calculator?end=#{end_date}")
60
60
  end
61
61
 
62
+ def time_off_balance_adjustment(employee_id, params)
63
+ allowed_parameters = %i[date timeOffTypeId amount note]
64
+ params = params.keep_if { |k, _| allowed_parameters.include? k }
65
+
66
+ options = {
67
+ body: params.to_json,
68
+ headers: { 'Content-Type' => 'application/json' }
69
+ }
70
+
71
+ request(:put, "employees/#{employee_id}/time_off/balance_adjustment", options)
72
+ end
73
+
62
74
  def photo_binary(employee_id)
63
75
  request(:get, "employees/#{employee_id}/photo/small")
64
76
  end
@@ -19,7 +19,9 @@ module Bamboozled
19
19
  typecast_values: false)
20
20
  end
21
21
 
22
+ def time_off_types
23
+ request(:get, "meta/time_off/types")
24
+ end
22
25
  end
23
26
  end
24
27
  end
25
-
@@ -1,3 +1,3 @@
1
1
  module Bamboozled
2
- VERSION = "0.2.9".freeze
2
+ VERSION = "0.2.10".freeze
3
3
  end
@@ -0,0 +1,5 @@
1
+ HTTP/1.1 200 OK
2
+ content-type: application/json; charset=utf-8
3
+ date: Tue, 17 Jun 2014 19:25:35 UTC
4
+
5
+ {"timeOffTypes":[{"id":"2","name":"Employee Accruals","units":"days","color":"company","icon":null}],"defaultHours":[{"name":"Saturday","amount":"0"},{"name":"Sunday","amount":"0"},{"name":"default","amount":"8"},{"name":"Monday","amount":"8"},{"name":"Tuesday","amount":"8"},{"name":"Wednesday","amount":"8"},{"name":"Thursday","amount":"8"},{"name":"Friday","amount":"8"}]}
@@ -0,0 +1,4 @@
1
+ HTTP/1.1 201 Created
2
+ content-type: application/json; charset=utf-8
3
+ date: Tue, 17 Jun 2014 19:25:35 UTC
4
+ location: https://api.bamboohr.com/api/gateway.php/alphasights/v1/employees/44259/time_off/history/38668
@@ -66,6 +66,21 @@ RSpec.describe "Employees" do
66
66
  .to match_array %w(timeOffType name units balance)
67
67
  end
68
68
 
69
+ it "Adjusts an employee's time off balance" do
70
+ response = File.new("spec/fixtures/time_off_balance_adjustment.json")
71
+ stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response)
72
+
73
+ options = {
74
+ date: '2014-06-17',
75
+ timeOffTypeId: 2,
76
+ amount: -1.5,
77
+ note: 'test'
78
+ }
79
+
80
+ result = @client.employee.time_off_balance_adjustment('44259', options)
81
+ expect(result).to be_a Hash
82
+ end
83
+
69
84
  it "returns the proper url using employee email address" do
70
85
  hashed = "4fdce145bab6d27d69e34403f99fd11c" # Hash of me@here.com
71
86
  required_url = "http://x.bamboohr.com/employees/photos/?h=#{hashed}"
@@ -44,4 +44,12 @@ RSpec.describe "Meta" do
44
44
  fields = @client.meta.lists
45
45
  expect(fields).to be_a Array
46
46
  end
47
+
48
+ it "Gets time off types" do
49
+ res = get_response("spec/fixtures/meta_time_off_types.json")
50
+ make_stub(res)
51
+
52
+ types = @client.meta.time_off_types
53
+ expect(types).to be_a Hash
54
+ end
47
55
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bamboozled-gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickert
8
- autorequire:
8
+ - Lien Van Den Steen
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2021-02-02 00:00:00.000000000 Z
12
+ date: 2021-05-25 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -97,6 +98,7 @@ dependencies:
97
98
  description: Bamboozled wraps the BambooHR API without the use of Rails dependencies.
98
99
  email:
99
100
  - mjar81@gmail.com
101
+ - lvandensteen@gitlab.com
100
102
  executables: []
101
103
  extensions: []
102
104
  extra_rdoc_files: []
@@ -149,8 +151,10 @@ files:
149
151
  - spec/fixtures/meta_fields.json
150
152
  - spec/fixtures/meta_lists.json
151
153
  - spec/fixtures/meta_tables.json
154
+ - spec/fixtures/meta_time_off_types.json
152
155
  - spec/fixtures/meta_users.json
153
156
  - spec/fixtures/one_employee.json
157
+ - spec/fixtures/time_off_balance_adjustment.json
154
158
  - spec/fixtures/time_off_estimate.json
155
159
  - spec/fixtures/time_tracking_add_200_response.json
156
160
  - spec/fixtures/time_tracking_add_empty_response.json
@@ -178,7 +182,7 @@ homepage: http://github.com/Skookum/bamboozled
178
182
  licenses:
179
183
  - MIT
180
184
  metadata: {}
181
- post_install_message:
185
+ post_install_message:
182
186
  rdoc_options: []
183
187
  require_paths:
184
188
  - lib
@@ -193,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
197
  - !ruby/object:Gem::Version
194
198
  version: '0'
195
199
  requirements: []
196
- rubygems_version: 3.1.2
197
- signing_key:
200
+ rubygems_version: 3.2.3
201
+ signing_key:
198
202
  specification_version: 4
199
203
  summary: A Ruby wrapper for the BambooHR API http://www.bamboohr.com/
200
204
  test_files:
@@ -210,8 +214,10 @@ test_files:
210
214
  - spec/fixtures/meta_fields.json
211
215
  - spec/fixtures/meta_lists.json
212
216
  - spec/fixtures/meta_tables.json
217
+ - spec/fixtures/meta_time_off_types.json
213
218
  - spec/fixtures/meta_users.json
214
219
  - spec/fixtures/one_employee.json
220
+ - spec/fixtures/time_off_balance_adjustment.json
215
221
  - spec/fixtures/time_off_estimate.json
216
222
  - spec/fixtures/time_tracking_add_200_response.json
217
223
  - spec/fixtures/time_tracking_add_empty_response.json