bamboozled-gitlab 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/bamboozled.gemspec +2 -2
- data/lib/bamboozled/api/employee.rb +16 -1
- data/lib/bamboozled/api/meta.rb +7 -0
- data/lib/bamboozled/version.rb +1 -1
- data/spec/fixtures/employee_time_off_policies.json +5 -0
- data/spec/fixtures/meta_time_off_policies.json +5 -0
- data/spec/lib/bamboozled/api/employee_spec.rb +27 -3
- data/spec/lib/bamboozled/api/meta_spec.rb +8 -0
- metadata +6 -3
- data/relnotes/v0.1.0.md +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee27d54dc3280a0524f21ee7104ab5951979e8f7aa6ac1f41d7d29fa943241e0
|
4
|
+
data.tar.gz: 6ce20114187af5808ecf10a2134cf5afb5291bca4aaeb53a2d403c69b97dc94c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65d653cf4922cfd0a0fa3cb97449ded66648927555de816e3187e2a304516901f9fd61d5971b4b45800e660d6192d4c222883e75805abe9b0a4589b50c86a59c
|
7
|
+
data.tar.gz: 35a49de100dd127d026c506da95adfc4541c8d5f7472d98a71f64e14606af6651c858dd87e337e2a6a5d025c1418bd11d4476b4f842615f1d6cace4864648a9e
|
data/README.md
CHANGED
@@ -158,6 +158,11 @@ Please take the time to go through our [contribution guidelines](CONTRIBUTING.md
|
|
158
158
|
Special thanks to all the awesome people who have helped make this gem better.
|
159
159
|
You can see a list of them [here](https://github.com/Skookum/bamboozled/graphs/contributors).
|
160
160
|
|
161
|
+
#### Deploying to rubygems
|
162
|
+
1. Update the version in the `lib/bamboozled/version.rb` file
|
163
|
+
2. Update specs to use that version
|
164
|
+
3. In github, add a [release](https://github.com/Skookum/bamboozled/releases) off the master branch. This will trigger the github action to deploy to rubygems
|
165
|
+
|
161
166
|
## License
|
162
167
|
|
163
168
|
This project is licensed under the terms of the MIT license. See the
|
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 =
|
7
|
+
spec.name = "bamboozled-gitlab"
|
8
8
|
spec.version = Bamboozled::VERSION
|
9
9
|
spec.authors = ["Mark Rickert", "Lien Van Den Steen"]
|
10
|
-
spec.email = ["mjar81@gmail.com",
|
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"
|
@@ -65,12 +65,27 @@ module Bamboozled
|
|
65
65
|
|
66
66
|
options = {
|
67
67
|
body: params.to_json,
|
68
|
-
headers: {
|
68
|
+
headers: { "Content-Type" => "application/json" }
|
69
69
|
}
|
70
70
|
|
71
71
|
request(:put, "employees/#{employee_id}/time_off/balance_adjustment", options)
|
72
72
|
end
|
73
73
|
|
74
|
+
def time_off_policies(employee_id)
|
75
|
+
request(:get, "employees/#{employee_id}/time_off/policies")
|
76
|
+
end
|
77
|
+
|
78
|
+
def add_time_off_policies(employee_id, policies)
|
79
|
+
allowed_keys = %i[timeOffPolicyId accrualStartDate]
|
80
|
+
policies = policies.map { |policy| policy.keep_if { |k, _| allowed_keys.include? k } }
|
81
|
+
|
82
|
+
options = {
|
83
|
+
body: policies.to_json
|
84
|
+
}
|
85
|
+
|
86
|
+
request(:put, "employees/#{employee_id}/time_off/policies", options)
|
87
|
+
end
|
88
|
+
|
74
89
|
def photo_binary(employee_id)
|
75
90
|
request(:get, "employees/#{employee_id}/photo/small")
|
76
91
|
end
|
data/lib/bamboozled/api/meta.rb
CHANGED
@@ -22,6 +22,13 @@ module Bamboozled
|
|
22
22
|
def time_off_types
|
23
23
|
request(:get, "meta/time_off/types")
|
24
24
|
end
|
25
|
+
|
26
|
+
def time_off_policies
|
27
|
+
options = {
|
28
|
+
headers: { "Content-Type" => "application/json" }
|
29
|
+
}
|
30
|
+
request(:get, "meta/time_off/policies", options)
|
31
|
+
end
|
25
32
|
end
|
26
33
|
end
|
27
34
|
end
|
data/lib/bamboozled/version.rb
CHANGED
@@ -71,16 +71,40 @@ RSpec.describe "Employees" do
|
|
71
71
|
stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response)
|
72
72
|
|
73
73
|
options = {
|
74
|
-
date:
|
74
|
+
date: "2014-06-17",
|
75
75
|
timeOffTypeId: 2,
|
76
76
|
amount: -1.5,
|
77
|
-
note:
|
77
|
+
note: "test"
|
78
78
|
}
|
79
79
|
|
80
|
-
result = @client.employee.time_off_balance_adjustment(
|
80
|
+
result = @client.employee.time_off_balance_adjustment("44259", options)
|
81
81
|
expect(result).to be_a Hash
|
82
82
|
end
|
83
83
|
|
84
|
+
it "Gets an employee's time off policies" do
|
85
|
+
response = File.new("spec/fixtures/employee_time_off_policies.json")
|
86
|
+
stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response)
|
87
|
+
|
88
|
+
policies = @client.employee.time_off_policies("44259")
|
89
|
+
|
90
|
+
expect(policies).to be_a Array
|
91
|
+
expect(policies.first.keys).to match_array %w(timeOffPolicyId timeOffTypeId accrualStartDate)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "adds an employee time off policy" do
|
95
|
+
response = File.new("spec/fixtures/employee_time_off_policies.json")
|
96
|
+
stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response)
|
97
|
+
|
98
|
+
policies = [{
|
99
|
+
timeOffPolicyId: 2,
|
100
|
+
accrualStartDate: "2014-06-17"
|
101
|
+
}]
|
102
|
+
|
103
|
+
result = @client.employee.add_time_off_policies("44259", policies)
|
104
|
+
expect(policies).to be_a Array
|
105
|
+
expect(result.first.keys).to match_array %w(timeOffPolicyId timeOffTypeId accrualStartDate)
|
106
|
+
end
|
107
|
+
|
84
108
|
it "returns the proper url using employee email address" do
|
85
109
|
hashed = "4fdce145bab6d27d69e34403f99fd11c" # Hash of me@here.com
|
86
110
|
required_url = "http://x.bamboohr.com/employees/photos/?h=#{hashed}"
|
@@ -52,4 +52,12 @@ RSpec.describe "Meta" do
|
|
52
52
|
types = @client.meta.time_off_types
|
53
53
|
expect(types).to be_a Hash
|
54
54
|
end
|
55
|
+
|
56
|
+
it "Gets time off policies" do
|
57
|
+
res = get_response("spec/fixtures/meta_time_off_policies.json")
|
58
|
+
make_stub(res)
|
59
|
+
|
60
|
+
types = @client.meta.time_off_types
|
61
|
+
expect(types).to be_a Array
|
62
|
+
end
|
55
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bamboozled-gitlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickert
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -138,7 +138,6 @@ files:
|
|
138
138
|
- logos/bamboozled_logo_green.png
|
139
139
|
- logos/skookum_mark_black.png
|
140
140
|
- logos/skookum_mark_black.svg
|
141
|
-
- relnotes/v0.1.0.md
|
142
141
|
- spec/fixtures/add_employee_details.json
|
143
142
|
- spec/fixtures/add_employee_response.json
|
144
143
|
- spec/fixtures/add_employee_xml.yml
|
@@ -146,11 +145,13 @@ files:
|
|
146
145
|
- spec/fixtures/custom_report.json
|
147
146
|
- spec/fixtures/employee_emails.json
|
148
147
|
- spec/fixtures/employee_table_details.json
|
148
|
+
- spec/fixtures/employee_time_off_policies.json
|
149
149
|
- spec/fixtures/job_info.xml
|
150
150
|
- spec/fixtures/last_changed.json
|
151
151
|
- spec/fixtures/meta_fields.json
|
152
152
|
- spec/fixtures/meta_lists.json
|
153
153
|
- spec/fixtures/meta_tables.json
|
154
|
+
- spec/fixtures/meta_time_off_policies.json
|
154
155
|
- spec/fixtures/meta_time_off_types.json
|
155
156
|
- spec/fixtures/meta_users.json
|
156
157
|
- spec/fixtures/one_employee.json
|
@@ -209,11 +210,13 @@ test_files:
|
|
209
210
|
- spec/fixtures/custom_report.json
|
210
211
|
- spec/fixtures/employee_emails.json
|
211
212
|
- spec/fixtures/employee_table_details.json
|
213
|
+
- spec/fixtures/employee_time_off_policies.json
|
212
214
|
- spec/fixtures/job_info.xml
|
213
215
|
- spec/fixtures/last_changed.json
|
214
216
|
- spec/fixtures/meta_fields.json
|
215
217
|
- spec/fixtures/meta_lists.json
|
216
218
|
- spec/fixtures/meta_tables.json
|
219
|
+
- spec/fixtures/meta_time_off_policies.json
|
217
220
|
- spec/fixtures/meta_time_off_types.json
|
218
221
|
- spec/fixtures/meta_users.json
|
219
222
|
- spec/fixtures/one_employee.json
|
data/relnotes/v0.1.0.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
### New Features
|
2
|
-
|
3
|
-
* New method `Employee#add` allows client to create new employees. ([@kylefdoherty][])
|
4
|
-
* New method `Employee#update` allows client to update new employees. ([@kylefdoherty][])
|
5
|
-
|
6
|
-
### Changes
|
7
|
-
|
8
|
-
### Bug Fixes
|
9
|
-
|
10
|
-
* Added missing documentation for `Employee#add`. ([@mjording][])
|
11
|
-
|
12
|
-
[@kylefdoherty]: https://github.com/kylefdoherty
|
13
|
-
[@mjording]: https://github.com/mjording
|