Skip to content

Commit

Permalink
Ensures supplied supported locales are sent along with the api reques…
Browse files Browse the repository at this point in the history
…t appropriately
  • Loading branch information
coconutcraig committed Sep 2, 2019
1 parent 9316958 commit a336c6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/resources/time-slot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ it('can string all filterable options together', async () => {
.between('2018-01-01', '2018-01-31')
.at(1)
.for([1, 2])
.by(1),
.by(1)
.supporting(['en']),
);

expected.toHaveProperty('filters', {
end: '2018-01-31',
locales: ['en'],
location: 1,
services: [1, 2],
start: '2018-01-01',
Expand All @@ -93,6 +95,7 @@ it('can get time slots for no particular user', async () => {
await resource
.between('2018-01-01', '2018-01-31')
.at(1)
.supporting(['fr', 'es'])
.for([1, 2])
.in(timezone)
.get();
Expand All @@ -104,6 +107,7 @@ it('can get time slots for no particular user', async () => {
location_id: 1,
service_id: [1, 2],
start: '2018-01-01',
supported_locales: ['fr', 'es'],
timezone,
},
});
Expand All @@ -119,6 +123,7 @@ it('can get time slots for a specified user', async () => {
.between('2018-01-01', '2018-01-31')
.at(1)
.for([1, 2])
.supporting(['en', 'es'])
.by(1)
.in(timezone)
.get();
Expand All @@ -131,6 +136,7 @@ it('can get time slots for a specified user', async () => {
service_id: [1, 2],
staff_id: 1,
start: '2018-01-01',
supported_locales: ['en', 'es'],
timezone,
},
});
Expand Down
5 changes: 5 additions & 0 deletions src/resources/time-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface TimeSlotParameters {
service_id?: number | number[];
staff_id?: number;
start?: string;
supported_locales?: string[];
timezone?: string;
}

Expand Down Expand Up @@ -80,6 +81,10 @@ export default class TimeSlot extends Conditional implements TimeSlotResource {
start: this.filters.start,
};

if (this.filters.locales) {
params.supported_locales = this.filters.locales;
}

if (this.filters.timezone) {
params.timezone = this.filters.timezone;
}
Expand Down

0 comments on commit a336c6c

Please sign in to comment.