Skip to content

Commit dda7d94

Browse files
authored
Merge pull request #36 from HireFrederick/get_employee_by_id_endpoint
added get endpoint for employee by ID
2 parents 5976b64 + 74566a8 commit dda7d94

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

lib/booker/v4.1/merchant.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def appointments_partial(location_id:, start_date:, end_date:, fetch_all: true,
6262
)
6363
end
6464

65+
def employee(id:, params: {}, model: Booker::V4::Models::Employee)
66+
get("#{V41_PREFIX}/employee/#{id}", build_params({}, params), model)
67+
end
68+
6569
def employees(location_id:, fetch_all: true, params: {})
6670
paginated_request(
6771
method: :post,

lib/booker/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Booker
2-
VERSION = '3.3.15'
2+
VERSION = '3.3.16'
33
end

spec/lib/booker/v4.1/merchant_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,18 @@
204204
end
205205
end
206206

207+
describe '#employee' do
208+
let(:path) { "#{v41_prefix}/employee/#{employee_id}" }
209+
let(:employee_id) { 123 }
210+
let(:employee) { instance_double(Booker::V4::Models::Employee) }
211+
212+
it 'calls get and returns the modeled response' do
213+
expect(client).to receive(:get)
214+
.with(path, base_params, Booker::V4::Models::Employee).and_return(employee)
215+
expect(client.employee(id: employee_id)).to be employee
216+
end
217+
end
218+
207219
describe '#employees' do
208220
let(:path) { "#{v41_prefix}/employees" }
209221
let(:additional_params) { {LocationID: booker_location_id} }

0 commit comments

Comments
 (0)