bamboozled 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +32 -10
- data/.hound.yml +2 -0
- data/.rubocop.yml +37 -0
- data/.travis.yml +16 -0
- data/CHANGELOG.md +27 -0
- data/CONTRIBUTING.md +91 -0
- data/Gemfile +10 -5
- data/Guardfile +21 -0
- data/README.md +160 -0
- data/Rakefile +5 -7
- data/bamboozled.gemspec +14 -8
- data/lib/bamboozled.rb +12 -10
- data/lib/bamboozled/api/base.rb +6 -1
- data/lib/bamboozled/api/employee.rb +32 -0
- data/lib/bamboozled/api/time_off.rb +4 -3
- data/lib/bamboozled/errors.rb +14 -12
- data/lib/bamboozled/version.rb +1 -1
- data/logos/bamboozled_logo_black.png +0 -0
- data/logos/bamboozled_logo_green.png +0 -0
- data/logos/skookum_mark_black.png +0 -0
- data/logos/skookum_mark_black.svg +175 -0
- data/relnotes/v0.1.0.md +13 -0
- data/spec/fixtures/add_employee_details.json +7 -0
- data/spec/fixtures/add_employee_response.json +4 -0
- data/spec/fixtures/add_employee_xml.yml +8 -0
- data/spec/fixtures/last_changed.json +28 -0
- data/spec/fixtures/update_employee_details.json +7 -0
- data/spec/fixtures/update_employee_response.json +3 -0
- data/spec/fixtures/update_employee_xml.yml +8 -0
- data/spec/lib/bamboozled/api/employee_spec.rb +154 -0
- data/spec/spec_helper.rb +28 -12
- metadata +95 -18
- data/Gemfile.lock +0 -44
- data/Readme.md +0 -105
- data/spec/lib/bamboozled/employee_spec.rb +0 -107
- data/spec/lib/bamboozled/hash_spec.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a9416ada8eceac7ea3e04dff8fc289b33a49c6
|
4
|
+
data.tar.gz: a59005a19d6941995bc4d896b82529ebe9ebcefb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1d43d4bc115a83e706c8d58998488287b938f7bd82ff9074964b6d844fbae029accf3f7d73f5e2f1e9a4a826b74f4697865cb5c860f96baf1602a858ef257a1
|
7
|
+
data.tar.gz: 8e9e7b24da7477331518467fae8a88e35143a430fa2e01ebddd0f61e4d9ea340f61059baa5235bc76f8d5bd37175fa7043644347c203f615887cc80dc886c2e6
|
data/.gitignore
CHANGED
@@ -1,14 +1,36 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
3
12
|
|
4
|
-
|
5
|
-
|
6
|
-
.
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
7
17
|
|
8
|
-
|
9
|
-
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
10
23
|
|
11
|
-
|
12
|
-
|
24
|
+
## Environment normalisation:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
13
28
|
|
14
|
-
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
Gemfile.lock
|
32
|
+
.ruby-version
|
33
|
+
.ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# require: rubocop-rspec
|
2
|
+
|
3
|
+
Rails:
|
4
|
+
Enabled: false
|
5
|
+
|
6
|
+
Style/AlignHash:
|
7
|
+
Enabled: true
|
8
|
+
EnforcedHashRocketStyle: table
|
9
|
+
EnforcedColonStyle: table
|
10
|
+
|
11
|
+
Style/CollectionMethods:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
Style/CommentAnnotation:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/Documentation:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/MethodCalledOnDoEndBlock:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
Style/OptionHash:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
Style/SingleLineBlockParams:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/StringLiterals:
|
30
|
+
Enabled: true
|
31
|
+
EnforcedStyle: double_quotes
|
32
|
+
|
33
|
+
Style/SymbolArray:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
RSpec/FilePath:
|
37
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,3 +1,19 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
3
|
+
cache: bundler
|
2
4
|
rvm:
|
3
5
|
- 2.0.0
|
6
|
+
- 2.1
|
7
|
+
- 2.2
|
8
|
+
- ruby-head
|
9
|
+
- jruby-head
|
10
|
+
matrix:
|
11
|
+
fast_finish: true
|
12
|
+
allow_failures:
|
13
|
+
- rvm: ruby-head
|
14
|
+
- rvm: jruby-head
|
15
|
+
before_install: gem update --remote bundler && bundle --version
|
16
|
+
install:
|
17
|
+
- bundle install --retry=3
|
18
|
+
script:
|
19
|
+
- bundle exec rspec
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## master (unreleased)
|
4
|
+
|
5
|
+
### New Features
|
6
|
+
|
7
|
+
### Changes
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
## 0.1.0 (2016-06-14)
|
12
|
+
|
13
|
+
### New Features
|
14
|
+
|
15
|
+
* New method `Employee#add` allows client to create new employees. ([@kylefdoherty][])
|
16
|
+
* New method `Employee#update` allows client to update new employees. ([@kylefdoherty][])
|
17
|
+
|
18
|
+
### Changes
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* Added missing documentation for `Employee#add`. ([@mjording][])
|
23
|
+
|
24
|
+
[@markrickert]: https://github.com/markrickert
|
25
|
+
[@enriikke]: https://github.com/Enriikke
|
26
|
+
[@kylefdoherty]: https://github.com/kylefdoherty
|
27
|
+
[@mjording]: https://github.com/mjording
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Contributions are always welcome! If you discover issues or have ideas for
|
4
|
+
improvements, report them or submit pull requests. Please follow the guidelines
|
5
|
+
below when doing so.
|
6
|
+
|
7
|
+
## Issue Reporting
|
8
|
+
|
9
|
+
* Make sure the issue has not already been reported.
|
10
|
+
* Check that the issue has not already been fixed in `master`.
|
11
|
+
* Open a [new issue](https://github.com/Skookum/bamboozled/issues/new) with a
|
12
|
+
clear and concise description of the problem.
|
13
|
+
* Include any relevant code or error output in the issue summary.
|
14
|
+
|
15
|
+
## Pull Request
|
16
|
+
|
17
|
+
* Fork the project.
|
18
|
+
* Create a new branch for your feature/bug.
|
19
|
+
* Get coding!
|
20
|
+
* Write good tests. See [Testing](#testing).
|
21
|
+
* Follow the same coding conventions as the rest of the project. See [Coding Style](#coding-style).
|
22
|
+
* Squash related commits when needed and write good commit messages.
|
23
|
+
* Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [Changelog Entries](#changelog-entries).
|
24
|
+
* Make sure the test suite is passing and that there are no style violations
|
25
|
+
before pushing your code.
|
26
|
+
* Pull requests should be related to a single subject.
|
27
|
+
* Open a pull request until you are happy with your contribution.
|
28
|
+
|
29
|
+
### Testing
|
30
|
+
|
31
|
+
Always include tests with you code. Bamboozled uses [RSpec](https://github.com/rspec/rspec)
|
32
|
+
for testing. We like to follow the recommendations listed in [Better Specs](http://betterspecs.org/).
|
33
|
+
|
34
|
+
```sh
|
35
|
+
# Run the entire test suite.
|
36
|
+
bundle exec rspec
|
37
|
+
|
38
|
+
# Run specific test files.
|
39
|
+
bundle exec rspec spec/lib/bamboozled/lib/employee_spec.rb
|
40
|
+
```
|
41
|
+
|
42
|
+
Alternatively, the `Gemfile` includes [Guard](https://github.com/guard/guard), a
|
43
|
+
file watcher that will automatically run `rspec` when a file is saved. This is
|
44
|
+
not a requirement but we encourage running `bundle exec guard` before starting
|
45
|
+
development so that you are able to catch failed tests as you code away :-).
|
46
|
+
|
47
|
+
### Coding Style
|
48
|
+
|
49
|
+
Bamboozled leverages [Hound](https://houndci.com/) to maintain the code style
|
50
|
+
consistent. Hound uses [rubocop](https://github.com/bbatsov/rubocop), which you
|
51
|
+
can run locally:
|
52
|
+
|
53
|
+
```sh
|
54
|
+
# Run for the entire codebase.
|
55
|
+
bundle exec rubocop
|
56
|
+
|
57
|
+
# Run for a specific file.
|
58
|
+
bundle exec rubocop lib/bamboozled.rb
|
59
|
+
```
|
60
|
+
|
61
|
+
Just like with tests, `guard` will automatically run `rubocop` when a file is
|
62
|
+
saved (unless a test fails). Once again, we would like to encourage running
|
63
|
+
`bundle exec guard` before starting development.
|
64
|
+
|
65
|
+
Hound will comment on pull requests with style violations, and pull requests
|
66
|
+
won't be merged until violations are corrected.
|
67
|
+
|
68
|
+
### Changelog Entries
|
69
|
+
|
70
|
+
* Use [Markdown syntax](http://daringfireball.net/projects/markdown/syntax).
|
71
|
+
* The entry line should start with a bullet point `*`.
|
72
|
+
* If the change has a related GitHub issue, include a link to it as
|
73
|
+
`[#1](https://github.com/Skookum/bamboozled/issues/1):`.
|
74
|
+
* Provide a brief summary of the change.
|
75
|
+
* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
|
76
|
+
* If this is your first contribution, add a link definition for the implicit
|
77
|
+
link to the bottom of the changelog as `[@username]:
|
78
|
+
https://github.com/username`.
|
79
|
+
|
80
|
+
Here are a few examples:
|
81
|
+
|
82
|
+
```
|
83
|
+
* [#3](https://github.com/Skookum/bamboozled/issues/3): Added `HashWithIndifferentAccess` to to fix inconsistencies when accessing data. ([@markrickert][])
|
84
|
+
* New method `Employee#add` allows client to create new employees. ([@kylefdoherty][])
|
85
|
+
```
|
86
|
+
|
87
|
+
---
|
88
|
+
|
89
|
+
<p align="center">
|
90
|
+
<img src="logos/skookum_mark_black.png" alt="Skookum" width="100" />
|
91
|
+
</p>
|
data/Gemfile
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
|
3
2
|
gemspec
|
4
3
|
|
4
|
+
group :test do
|
5
|
+
gem "coveralls", require: false
|
6
|
+
end
|
7
|
+
|
5
8
|
group :development, :test do
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
9
|
+
gem "listen", "3.0.7"
|
10
|
+
gem "guard"
|
11
|
+
gem "guard-rspec", require: false
|
12
|
+
gem "rubocop", require: false
|
13
|
+
gem "rubocop-rspec", require: false
|
14
|
+
gem "guard-rubocop", require: false
|
10
15
|
end
|
data/Guardfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
group :tdd, halt_on_fail: true do
|
2
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
3
|
+
require "guard/rspec/dsl"
|
4
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
5
|
+
|
6
|
+
# RSpec files
|
7
|
+
rspec = dsl.rspec
|
8
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
9
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_files)
|
11
|
+
|
12
|
+
# Ruby files
|
13
|
+
ruby = dsl.ruby
|
14
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
15
|
+
end
|
16
|
+
|
17
|
+
guard :rubocop, all_on_start: false, cmd: "rubocop --require rubocop-rspec" do
|
18
|
+
watch(%r{.+\.rb$}) { |m| m[0] }
|
19
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
20
|
+
end
|
21
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
[![Gem Version](https://img.shields.io/gem/v/bamboozled.svg)][rubygems]
|
2
|
+
[![Build Status](https://img.shields.io/travis/Skookum/bamboozled.svg)][travis]
|
3
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/Skookum/bamboozled.svg)][codeclimate]
|
4
|
+
[![Coverage Status](https://img.shields.io/coveralls/Skookum/bamboozled.svg)][coveralls]
|
5
|
+
[![Inline Docs](http://inch-ci.org/github/Skookum/bamboozled.svg?style=shields)][inchdocs]
|
6
|
+
|
7
|
+
[rubygems]: https://rubygems.org/gems/bamboozled
|
8
|
+
[travis]: https://travis-ci.org/Skookum/bamboozled
|
9
|
+
[codeclimate]: https://codeclimate.com/github/Skookum/bamboozled
|
10
|
+
[coveralls]: https://coveralls.io/r/Skookum/bamboozled
|
11
|
+
[inchdocs]: http://inch-ci.org/github/Skookum/bamboozled
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
<p align="center">
|
16
|
+
<img src="logos/bamboozled_logo_black.png" alt="Bamboozled" />
|
17
|
+
</p>
|
18
|
+
|
19
|
+
Bamboozled is a Ruby wrapper for the [BambooHR API](http://www.bamboohr.com/api/documentation/).
|
20
|
+
|
21
|
+
## Versioning
|
22
|
+
|
23
|
+
Bamboozled follows [Semantic Versioning 2.0.0](http://semver.org/). Make sure to
|
24
|
+
always bound the major version when installing if you want to avoid breaking
|
25
|
+
changes.
|
26
|
+
|
27
|
+
## Documentation
|
28
|
+
|
29
|
+
This documentation tracks the latest changes in the `master` branch of this
|
30
|
+
repo. Some of the features described might not be available in older versions of
|
31
|
+
the gem (including the current stable version). Please consult the relevant git
|
32
|
+
tag (e.g. v0.0.7) if you need documentation for a specific Bamboozled version.
|
33
|
+
|
34
|
+
## Installation
|
35
|
+
|
36
|
+
Bamboozled's installation follows the standard gem installation process:
|
37
|
+
|
38
|
+
```sh
|
39
|
+
$ gem install bamboozled
|
40
|
+
```
|
41
|
+
|
42
|
+
If you prefer to install Bamboozled through `bundler` then add it to your
|
43
|
+
`Gemfile`:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
gem "bamboozled"
|
47
|
+
```
|
48
|
+
|
49
|
+
## Usage
|
50
|
+
|
51
|
+
Create a `client` and provide it with your BambooHR subdomain and an API key:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
# Create the client:
|
55
|
+
client = Bamboozled.client(subdomain: "your_subdomain", api_key: "your_api_key")
|
56
|
+
```
|
57
|
+
|
58
|
+
> TIP! Create an API key by logging into your BambooHR account, then click your
|
59
|
+
> image in the upper right corner and select "API Keys".
|
60
|
+
|
61
|
+
### Employee related data:
|
62
|
+
|
63
|
+
You can pass an array of fields to `all` or `:all` to get all fields your user
|
64
|
+
is allowed to access. Because BambooHR's API doesn't allow for specifying fields
|
65
|
+
on the `/employees/directory` API endpoint, passing a list of fields to retrieve
|
66
|
+
will be signifigantly slower than getting just the default fields since the gem
|
67
|
+
will get the directory of employees, then request the data for each individual
|
68
|
+
employee resulting in `employees.count + 1` API calls.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
# Returns an array of all employees
|
72
|
+
client.employee.all # Gets all employees with default fields
|
73
|
+
client.employee.all(:all) # Gets all fields for all employees
|
74
|
+
client.employee.all(["hireDate", "displayName"])
|
75
|
+
client.employee.all("hireDate,displayName")
|
76
|
+
|
77
|
+
# Get the employee records which have changed since a given date
|
78
|
+
client.employee.last_changed("2015-01-01T00:00:00-08:00", :updated)
|
79
|
+
client.employee.last_changed("2015-01-01T00:00:00-08:00", :inserted)
|
80
|
+
client.employee.last_changed("2015-01-01T00:00:00-08:00", :deleted)
|
81
|
+
client.employee.last_changed("2015-01-01T00:00:00-08:00") # Return all changes
|
82
|
+
|
83
|
+
# Returns a hash of a single employee
|
84
|
+
client.employee.find(employee_id, fields = nil)
|
85
|
+
|
86
|
+
# Adds an employee
|
87
|
+
client.employee.add(employee_details_hash)
|
88
|
+
|
89
|
+
# Tabular employee data
|
90
|
+
client.employee.job_info(employee_id)
|
91
|
+
client.employee.employment_status(employee_id)
|
92
|
+
client.employee.compensation(employee_id)
|
93
|
+
client.employee.dependents(employee_id)
|
94
|
+
client.employee.contacts(employee_id)
|
95
|
+
|
96
|
+
# Time off estimate for employee. Requires end date in Date or Time format or YY-MM-DD string.
|
97
|
+
client.employee.time_off_estimate(employee_id, end_date)
|
98
|
+
|
99
|
+
# Photos for an employee
|
100
|
+
client.employee.photo_url(employee_work_email)
|
101
|
+
client.employee.photo_url(employee_id)
|
102
|
+
client.employee.photo_binary(employee_id)
|
103
|
+
```
|
104
|
+
|
105
|
+
### Time off data
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
# Get time off requests filtered by a number of parameters
|
109
|
+
# :id - the ID of the time off request
|
110
|
+
# :action -
|
111
|
+
# :employeeId - the ID of the employee you're looking for
|
112
|
+
# :start - filter start date
|
113
|
+
# :end - filter end date
|
114
|
+
# :type - type of time off request
|
115
|
+
# :status - must be one or more of the following: approved denied superceded requested canceled
|
116
|
+
client.time_off.requests(:employeeId: employee_id, start: Time.now)
|
117
|
+
|
118
|
+
# See who is out when.
|
119
|
+
client.time_off.whos_out(Time.now, "2014-12-31")
|
120
|
+
```
|
121
|
+
|
122
|
+
### Reports
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
# Find a report by its number
|
126
|
+
client.report.find(report_number, format = "JSON", fd = true)
|
127
|
+
```
|
128
|
+
|
129
|
+
### Metadata
|
130
|
+
|
131
|
+
```ruby
|
132
|
+
# Get fields
|
133
|
+
client.meta.fields
|
134
|
+
# Get lists
|
135
|
+
client.meta.lists
|
136
|
+
# Get tables
|
137
|
+
client.meta.tables
|
138
|
+
# Get users
|
139
|
+
# Note: this is all uses in the system, whereas client.employee.all only gets active employees
|
140
|
+
client.meta.users
|
141
|
+
```
|
142
|
+
|
143
|
+
## Contributing
|
144
|
+
|
145
|
+
Thank you for contributing! We always welcome bug reports and/or pull requests.
|
146
|
+
Please take the time to go through our [contribution guidelines](CONTRIBUTING.md).
|
147
|
+
|
148
|
+
Special thanks to all the awesome people who have helped make this gem better.
|
149
|
+
You can see a list of them [here](https://github.com/Skookum/bamboozled/graphs/contributors).
|
150
|
+
|
151
|
+
## License
|
152
|
+
|
153
|
+
This project is licensed under the terms of the MIT license. See the
|
154
|
+
[LICENSE](/LICENSE) file.
|
155
|
+
|
156
|
+
---
|
157
|
+
|
158
|
+
<p align="center">
|
159
|
+
<img src="logos/skookum_mark_black.png" alt="Skookum" width="100" />
|
160
|
+
</p>
|