-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue #36: client.meta.users failing
The issue stems from the various ways the Bamboo HR API returns results for the metadata endpoints. The original code tried to handle it with metaprogramming, but the returning results are not the same. Added tests and methods specific to the four metadata endpoints. Address [Issue #36](#36)
- Loading branch information
Showing
6 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
HTTP/1.1 200 OK | ||
content-type: application/json; charset=utf-8 | ||
date: Tue, 17 Jun 2014 19:25:35 UTC | ||
|
||
[{"id":4175,"name":"Accrual Level Start Date","type":"date"},{"id":8,"name":"Address Line 1","type":"text","alias":"address1"},{"id":9,"name":"Address Line 2","type":"text","alias":"address2"},{"id":4191,"name":"Asset cost","type":"currency"},{"id":"4191.1","name":"Asset cost - Currency code","type":"text"},{"id":4189,"name":"Asset description","type":"text"},{"id":4235,"name":"Benefit Groups","type":"benefit_group"},{"id":1502,"name":"Benefit History","type":"benefit_history"},{"id":6,"name":"Birth Date","type":"date","alias":"dateOfBirth"},{"id":10,"name":"City","type":"text","alias":"city"},{"id":4021,"name":"Compensation: Date","type":"date","alias":"payRateEffectiveDate"},{"id":4017,"name":"Compensation Change Reason","type":"list","alias":"payChangeReason"},{"id":4045,"name":"Compensation comments","type":"textarea"},{"id":"4020.1","name":"Completed - Category","type":"list"},{"id":"4020.2","name":"Completed - Completed","type":"date"},{"id":"4020.3","name":"Completed - Cost","type":"currency"},{"id":"4020.4","name":"Completed - Credits","type":"int"},{"id":"4020.5","name":"Completed - Hours","type":"int"},{"id":"4020.6","name":"Completed - Instructor","type":"text"},{"id":"4020.7","name":"Completed - Notes","type":"text"},{"id":4020,"name":"Completed - Title","type":"training_type"},{"id":"4180.8","name":"Conference Time Off - Accrual Start Date","type":"time_off_type"},{"id":"4180.6","name":"Conference Time Off - Adjustments (YTD)","type":"int"},{"id":"4180.3","name":"Conference Time Off - Available Balance","type":"int"},{"id":"4180.7","name":"Conference Time Off - Current balance","type":"time_off_type"},{"id":"4180.5","name":"Conference Time Off - Days scheduled","type":"int"},{"id":"4180.4","name":"Conference Time Off - Days taken (YTD)","type":"int"},{"id":"4180.2","name":"Conference Time Off - Policy","type":"text"},{"id":4180,"name":"Conference Time Off - Policy Assigned","type":"time_off_type_exists"},{"id":4194,"name":"Conference Time Off Policy policy - Assigned","type":"time_off_policy_exists"},{"id":"4194.1","name":"Conference Time Off Policy policy - Started on","type":"date"},{"id":3991,"name":"Country","type":"country","alias":"country"},{"id":4192,"name":"Date loaned","type":"date"},{"id":4193,"name":"Date returned","type":"date"},{"id":4,"name":"Department","type":"list","alias":"department"},{"id":1928,"name":"Dependent Birth Date","type":"date"},{"id":1931,"name":"Dependent City","type":"text"},{"id":3992,"name":"Dependent Country","type":"country"},{"id":1923,"name":"Dependent First Name","type":"text"},{"id":4231,"name":"Dependent Full-Time Student","type":"checkbox"},{"id":1927,"name":"Dependent Gender","type":"gender"},{"id":1935,"name":"Dependent Home Phone","type":"phone"},{"id":1924,"name":"Dependent Last Name","type":"text"},{"id":1925,"name":"Dependent Middle Name","type":"text"},{"id":1926,"name":"Dependent Relationship","type":"relationship"},{"id":1933,"name":"Dependent SSN","type":"ssn"},{"id":1932,"name":"Dependent State","type":"state"},{"id":1929,"name":"Dependent Street 1","type":"text"},{"id":1930,"name":"Dependent Street 2","type":"text"},{"id":4230,"name":"Dependent US Citizen","type":"checkbox"},{"id":1934,"name":"Dependent ZIP","type":"text"},{"id":4206,"name":"Dietary Restriction","type":"textarea","alias":"customDietaryRestriction"},{"id":1355,"name":"Division","type":"list","alias":"division"},{"id":157,"name":"EEO Job Category","type":"list","alias":"eeo"},{"id":4239,"name":"Eligible For Re-hire","type":"list"},{"id":692,"name":"Emergency Contact City","type":"text"},{"id":3993,"name":"Emergency Contact Country","type":"country"},{"id":2123,"name":"Emergency Contact Email","type":"email"},{"id":159,"name":"Emergency Contact Home Phone","type":"phone"},{"id":693,"name":"Emergency Contact Mobile Phone","type":"phone"},{"id":158,"name":"Emergency Contact Name","type":"text"},{"id":4211,"name":"Emergency Contact Primary","type":"checkbox"},{"id":160,"name":"Emergency Contact Relationship","type":"list"},{"id":4226,"name":"Emergency Contacts","type":"employee_contacts"},{"id":690,"name":"Emergency Contact State","type":"state"},{"id":691,"name":"Emergency Contact Street 1","type":"text"},{"id":2124,"name":"Emergency Contact Street 2","type":"text"},{"id":4063,"name":"Emergency Contact Work Ext","type":"text"},{"id":4044,"name":"Emergency Contact Work Phone","type":"phone"},{"id":689,"name":"Emergency Contact ZIP Code","type":"text"},{"id":636,"name":"Employee #","type":"employee_number","alias":"employeeNumber"},{"id":16,"name":"Employment Status","type":"list","alias":"employmentHistoryStatus"},{"id":"16.1","name":"Employment Status - FTE","type":"list","alias":"employmentHistoryStatus"},{"id":4232,"name":"Employment Status: ACA Full-Time","type":"aca_status"},{"id":1936,"name":"Employment Status: Date","type":"date"},{"id":4046,"name":"Employment status comments","type":"textarea"},{"id":1037,"name":"Ethnicity","type":"list","alias":"ethnicity"},{"id":4224,"name":"Favorite place to eat, hang or other in your city:","type":"textarea","alias":"customFavoriteplacetoeat,hangorotherinyourcity:"},{"id":4223,"name":"Favorite song to work to:","type":"textarea","alias":"customFavoritesongtoworkto:"},{"id":1,"name":"First Name","type":"text","alias":"firstName"},{"id":1359,"name":"FLSA Code","type":"list","alias":"exempt"},{"id":4229,"name":"FMLA Training - Completed","type":"date"},{"id":"4229.2","name":"FMLA Training - Due Date","type":"date"},{"id":"4229.3","name":"FMLA Training - Required Date","type":"date"},{"id":4205,"name":"Food Allergies","type":"textarea","alias":"customFoodAllergies"},{"id":154,"name":"Gender","type":"gender","alias":"gender"},{"id":4227,"name":"Harassment Training - Completed","type":"date"},{"id":"4227.2","name":"Harassment Training - Due Date","type":"date"},{"id":"4227.3","name":"Harassment Training - Required Date","type":"date"},{"id":3,"name":"Hire Date","type":"date","alias":"hireDate"},{"id":4207,"name":"Hobbies","type":"textarea","alias":"customHobbies"},{"id":1357,"name":"Home Email","type":"email","alias":"homeEmail"},{"id":14,"name":"Home Phone","type":"phone","alias":"homePhone"},{"id":4197,"name":"Item","type":"list"},{"id":4047,"name":"Job Information: Date","type":"date"},{"id":17,"name":"Job Title","type":"list","alias":"jobTitle"},{"id":"4221.8","name":"Jury Duty - Accrual Start Date","type":"time_off_type"},{"id":"4221.6","name":"Jury Duty - Adjustments (YTD)","type":"int"},{"id":"4221.3","name":"Jury Duty - Available Balance","type":"int"},{"id":"4221.7","name":"Jury Duty - Current balance","type":"time_off_type"},{"id":"4221.5","name":"Jury Duty - Days scheduled","type":"int"},{"id":"4221.4","name":"Jury Duty - Days taken (YTD)","type":"int"},{"id":"4221.2","name":"Jury Duty - Policy","type":"text"},{"id":4221,"name":"Jury Duty - Policy Assigned","type":"time_off_type_exists"},{"id":2,"name":"Last Name","type":"text","alias":"lastName"},{"id":18,"name":"Location","type":"list","alias":"location"},{"id":4198,"name":"M/N","type":"text"},{"id":155,"name":"Marital Status","type":"marital_status","alias":"maritalStatus"},{"id":"4256.8","name":"Maternity/Paternity - Accrual Start Date","type":"time_off_type"},{"id":"4256.6","name":"Maternity/Paternity - Adjustments (YTD)","type":"int"},{"id":"4256.3","name":"Maternity/Paternity - Available Balance","type":"int"},{"id":"4256.7","name":"Maternity/Paternity - Current balance","type":"time_off_type"},{"id":"4256.5","name":"Maternity/Paternity - Hours scheduled","type":"int"},{"id":"4256.4","name":"Maternity/Paternity - Hours taken (YTD)","type":"int"},{"id":"4256.2","name":"Maternity/Paternity - Policy","type":"text"},{"id":4256,"name":"Maternity/Paternity - Policy Assigned","type":"time_off_type_exists"},{"id":5,"name":"Middle Name","type":"text","alias":"middleName"},{"id":"4259.8","name":"Military Leave - Accrual Start Date","type":"time_off_type"},{"id":"4259.6","name":"Military Leave - Adjustments (YTD)","type":"int"},{"id":"4259.3","name":"Military Leave - Available Balance","type":"int"},{"id":"4259.7","name":"Military Leave - Current balance","type":"time_off_type"},{"id":"4259.5","name":"Military Leave - Hours scheduled","type":"int"},{"id":"4259.4","name":"Military Leave - Hours taken (YTD)","type":"int"},{"id":"4259.2","name":"Military Leave - Policy","type":"text"},{"id":4259,"name":"Military Leave - Policy Assigned","type":"time_off_type_exists"},{"id":4203,"name":"MISC.","type":"textarea","alias":"customMISC."},{"id":13,"name":"Mobile Phone","type":"phone","alias":"mobilePhone"},{"id":4255,"name":"Original Hire Date","type":"date","alias":"originalHireDate"},{"id":4252,"name":"Paid per","type":"paid_per","alias":"payPer"},{"id":19,"name":"Pay rate","type":"currency","alias":"payRate"},{"id":"19.1","name":"Pay rate - Currency code","type":"text","alias":"payRate"},{"id":4253,"type":"pay_period","deprecated":true,"name":"Pay Period","alias":"payPeriod"},{"id":4269,"name":"Pay Schedule","type":"list","alias":"paySchedule"},{"id":156,"name":"Pay type","type":"pay_type","alias":"payType"},{"id":1358,"type":"text","deprecated":true,"name":"Nickname","alias":"nickname"},{"id":1358,"name":"Preferred Name","type":"text","alias":"preferredName"},{"id":"4181.8","name":"PTO-Standard - Accrual Start Date","type":"time_off_type"},{"id":"4181.6","name":"PTO-Standard - Adjustments (YTD)","type":"int"},{"id":"4181.3","name":"PTO-Standard - Available Balance","type":"int"},{"id":"4181.7","name":"PTO-Standard - Current balance","type":"time_off_type"},{"id":"4181.5","name":"PTO-Standard - Hours scheduled","type":"int"},{"id":"4181.4","name":"PTO-Standard - Hours taken (YTD)","type":"int"},{"id":"4181.2","name":"PTO-Standard - Policy","type":"text"},{"id":4181,"name":"PTO-Standard - Policy Assigned","type":"time_off_type_exists"},{"id":4225,"name":"PTO-Standard Policy - 5 weeks policy - Assigned","type":"time_off_policy_exists"},{"id":"4225.1","name":"PTO-Standard Policy - 5 weeks policy - Started on","type":"date"},{"id":4182,"name":"PTO-Standard Policy - old policy - Assigned","type":"time_off_policy_exists"},{"id":"4182.1","name":"PTO-Standard Policy - old policy - Started on","type":"date"},{"id":4222,"name":"PTO-Standard Policy copy policy - Assigned","type":"time_off_policy_exists"},{"id":"4222.1","name":"PTO-Standard Policy copy policy - Started on","type":"date"},{"id":91,"name":"Reporting to","type":"employee"},{"id":4190,"name":"S/N","type":"text"},{"id":1610,"name":"Self-service access","type":"employee_access"},{"id":"4209.8","name":"Sick Time Off - Accrual Start Date","type":"time_off_type"},{"id":"4209.6","name":"Sick Time Off - Adjustments (YTD)","type":"int"},{"id":"4209.3","name":"Sick Time Off - Available Balance","type":"int"},{"id":"4209.7","name":"Sick Time Off - Current balance","type":"time_off_type"},{"id":"4209.5","name":"Sick Time Off - Days scheduled","type":"int"},{"id":"4209.4","name":"Sick Time Off - Days taken (YTD)","type":"int"},{"id":"4209.2","name":"Sick Time Off - Policy","type":"text"},{"id":4209,"name":"Sick Time Off - Policy Assigned","type":"time_off_type_exists"},{"id":7,"name":"SSN","type":"ssn","alias":"ssn"},{"id":11,"name":"State","type":"state","alias":"state"},{"id":387,"type":"status","deprecated":true,"name":"Employment Status","alias":"employmentStatus"},{"id":387,"name":"Status","type":"status","alias":"status"},{"id":4204,"name":"T-Shirt Size","type":"list","alias":"customT-ShirtSize"},{"id":4238,"name":"Termination Reason","type":"list"},{"id":4237,"name":"Termination Type","type":"list"},{"id":4208,"name":"Transportation Method","type":"textarea","alias":"customTransportationMethod"},{"id":4233,"name":"Twitter handle","type":"text","alias":"customTwitterhandle"},{"id":4228,"name":"Ulle - Completed","type":"date"},{"id":"4228.2","name":"Ulle - Due Date","type":"date"},{"id":"4228.3","name":"Ulle - Required Date","type":"date"},{"id":"4195.8","name":"Unpaid Time Off - Accrual Start Date","type":"time_off_type"},{"id":"4195.6","name":"Unpaid Time Off - Adjustments (YTD)","type":"int"},{"id":"4195.3","name":"Unpaid Time Off - Available Balance","type":"int"},{"id":"4195.7","name":"Unpaid Time Off - Current balance","type":"time_off_type"},{"id":"4195.5","name":"Unpaid Time Off - Days scheduled","type":"int"},{"id":"4195.4","name":"Unpaid Time Off - Days taken (YTD)","type":"int"},{"id":"4195.2","name":"Unpaid Time Off - Policy","type":"text"},{"id":4195,"name":"Unpaid Time Off - Policy Assigned","type":"time_off_type_exists"},{"id":4001,"name":"Veteran Status","type":"multilist"},{"id":4196,"name":"Wedding date","type":"date","alias":"customWeddingdate"},{"id":"4200.8","name":"WFH - Accrual Start Date","type":"time_off_type"},{"id":"4200.6","name":"WFH - Adjustments (YTD)","type":"int"},{"id":"4200.3","name":"WFH - Available Balance","type":"int"},{"id":"4200.7","name":"WFH - Current balance","type":"time_off_type"},{"id":"4200.5","name":"WFH - Hours scheduled","type":"int"},{"id":"4200.4","name":"WFH - Hours taken (YTD)","type":"int"},{"id":"4200.2","name":"WFH - Policy","type":"text"},{"id":4200,"name":"WFH - Policy Assigned","type":"time_off_type_exists"},{"id":15,"name":"Work Email","type":"email","alias":"workEmail"},{"id":635,"name":"Work Ext.","type":"text","alias":"workPhoneExtension"},{"id":634,"name":"Work Phone","type":"phone","alias":"workPhone"},{"id":12,"name":"Zip Code","type":"text","alias":"zipcode"},{"id":-38,"name":"Termination Date","type":"date","alias":"terminationDate"}] |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe "Meta" do | ||
|
||
before do | ||
@client = Bamboozled.client(subdomain: "x", api_key: "x") | ||
end | ||
|
||
it "Gets all users" do | ||
response = File.new("spec/fixtures/meta_users.json") | ||
stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response) | ||
|
||
users = @client.meta.users | ||
expect(users).to be_a Array | ||
end | ||
|
||
it "Gets all fields" do | ||
response = File.new("spec/fixtures/meta_fields.json") | ||
stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response) | ||
|
||
fields = @client.meta.fields | ||
expect(fields).to be_a Array | ||
end | ||
|
||
it "Gets the lists" do | ||
response = File.new("spec/fixtures/meta_lists.json") | ||
stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response) | ||
|
||
fields = @client.meta.lists | ||
expect(fields).to be_a Array | ||
end | ||
end |