Skip to content

Commit

Permalink
Extracts small part of object to model method
Browse files Browse the repository at this point in the history
  • Loading branch information
coconutcraig committed Nov 18, 2018
1 parent ae0a226 commit d9ab8f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/models/attendee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export default class Attendee extends Model implements AttendeeModel {
}
});

return attributes;
return {
attributes,
type: 'attendees',
};
}
}
6 changes: 1 addition & 5 deletions src/resources/appointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,8 @@ export default class Appointment implements AppointmentResource {
protected params(): AppointmentParameters {
const attendees = (this.attendees as AttendeeModel[])
.map((attendee: AttendeeModel): object => {
let parameters: object = {
attributes: attendee.toResponse(),
type: 'attendees',
};

const answers = attendee.getAnswers();
let parameters: object = attendee.toResponse();

if (answers.length > 0) {
parameters = {
Expand Down

0 comments on commit d9ab8f9

Please sign in to comment.