Skip to content

Commit e0c7853

Browse files
authored
Booking creation/update now accepts :name and :description; BookingResponse… (#30)
* adding examples for use of Body and Response helper objects * Booking creation/update now accepts :name and :description; BookingResponse now includes :name, :description, :external_link, :collaborative_link [finishes #146990687]
1 parent 6a6109f commit e0c7853

File tree

8 files changed

+42
-8
lines changed

8 files changed

+42
-8
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [0.1.3] - 2017-06-18 ##
5+
### Added
6+
- [#30](https://github.com/gonebusy/gonebusy-nodejs-client/pull/30) - Booking creation/update now accept optional :name and :description
7+
- [#30](https://github.com/gonebusy/gonebusy-nodejs-client/pull/30) - Booking item response now contains :name, :description, :external_link, :collaborative_link
8+
9+
### Changed
10+
- [#30](https://github.com/gonebusy/gonebusy-nodejs-client/pull/30) - Booking :user_message has been replaced by separate :name and :description
11+
412
## [0.1.2] - 2017-06-14 ##
513
### Added
614
- [#28](https://github.com/gonebusy/gonebusy-nodejs-client/pull/28) - Booking item response now includes :resource_id and :service_id corresponding to Resource providing the Booking and the Service being performed.

lib/Models/CreateBookingBody.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class CreateBookingBody extends BaseModel {
3131
this.days = this.constructor.getValue(obj.days);
3232
this.occurrence = this.constructor.getValue(obj.occurrence);
3333
this.dateRecursBy = this.constructor.getValue(obj.dateRecursBy || obj.date_recurs_by);
34+
this.name = this.constructor.getValue(obj.name);
35+
this.description = this.constructor.getValue(obj.description);
3436
}
3537

3638
/**
@@ -51,6 +53,8 @@ class CreateBookingBody extends BaseModel {
5153
{ name: 'days', realName: 'days' },
5254
{ name: 'occurrence', realName: 'occurrence' },
5355
{ name: 'dateRecursBy', realName: 'date_recurs_by' },
56+
{ name: 'name', realName: 'name' },
57+
{ name: 'description', realName: 'description' },
5458
]);
5559
}
5660
}

lib/Models/EntitiesBookingResponse.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ class EntitiesBookingResponse extends BaseModel {
2222
this.id = this.constructor.getValue(obj.id);
2323
this.ownerId = this.constructor.getValue(obj.ownerId || obj.owner_id);
2424
this.workflowState = this.constructor.getValue(obj.workflowState || obj.workflow_state);
25-
this.userMessage = this.constructor.getValue(obj.userMessage || obj.user_message);
25+
this.name = this.constructor.getValue(obj.name);
2626
this.timeWindow = this.constructor.getValue(obj.timeWindow || obj.time_window);
2727
this.resourceId = this.constructor.getValue(obj.resourceId || obj.resource_id);
2828
this.serviceId = this.constructor.getValue(obj.serviceId || obj.service_id);
29+
this.description = this.constructor.getValue(obj.description);
30+
this.externalLink = this.constructor.getValue(obj.externalLink || obj.external_link);
31+
this.collaborativeLink =
32+
this.constructor.getValue(obj.collaborativeLink
33+
|| obj.collaborative_link);
2934
}
3035

3136
/**
@@ -37,10 +42,13 @@ class EntitiesBookingResponse extends BaseModel {
3742
{ name: 'id', realName: 'id' },
3843
{ name: 'ownerId', realName: 'owner_id' },
3944
{ name: 'workflowState', realName: 'workflow_state' },
40-
{ name: 'userMessage', realName: 'user_message' },
45+
{ name: 'name', realName: 'name' },
4146
{ name: 'timeWindow', realName: 'time_window', type: 'EntitiesTimeWindowResponse' },
4247
{ name: 'resourceId', realName: 'resource_id' },
4348
{ name: 'serviceId', realName: 'service_id' },
49+
{ name: 'description', realName: 'description' },
50+
{ name: 'externalLink', realName: 'external_link' },
51+
{ name: 'collaborativeLink', realName: 'collaborative_link' },
4452
]);
4553
}
4654
}

lib/Models/UpdateBookingByIdBody.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class UpdateBookingByIdBody extends BaseModel {
3131
this.updateRecurring =
3232
this.constructor.getValue(obj.updateRecurring
3333
|| obj.update_recurring);
34+
this.name = this.constructor.getValue(obj.name);
35+
this.description = this.constructor.getValue(obj.description);
3436
}
3537

3638
/**
@@ -49,6 +51,8 @@ class UpdateBookingByIdBody extends BaseModel {
4951
{ name: 'occurrence', realName: 'occurrence' },
5052
{ name: 'dateRecursBy', realName: 'date_recurs_by' },
5153
{ name: 'updateRecurring', realName: 'update_recurring' },
54+
{ name: 'name', realName: 'name' },
55+
{ name: 'description', realName: 'description' },
5256
]);
5357
}
5458
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gonebusy-nodejs-client",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "This is a Node JS client for communicating with the full GoneBusy API",
55
"main": "./lib/index.js",
66
"scripts": {

test/fixtures/bookings/index.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"id": 123,
55
"owner_id": 0,
66
"workflow_state": "string",
7-
"user_message": "string",
7+
"name": "string",
88
"time_window": {
99
"id": 456,
1010
"start_date": "2016-12-19",
@@ -20,7 +20,12 @@
2020
"string"
2121
],
2222
"unavailable": true
23-
}
23+
},
24+
"resource_id": 0,
25+
"service_id": 0,
26+
"description": "string",
27+
"external_link": "string",
28+
"collaborative_link": "string"
2429
}
2530
]
2631
}

test/fixtures/bookings/show.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": 123,
44
"owner_id": 0,
55
"workflow_state": "string",
6-
"user_message": "string",
6+
"name": "string",
77
"time_window": {
88
"id": 456,
99
"start_date": "2016-12-19",
@@ -21,6 +21,9 @@
2121
"unavailable": true
2222
},
2323
"resource_id": 0,
24-
"service_id": 0
24+
"service_id": 0,
25+
"description": "string",
26+
"external_link": "string",
27+
"collaborative_link": "string"
2528
}
2629
}

test/support/controllers/bookings.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ const createParams = {
7272
frequency: 'single',
7373
days: 'string',
7474
occurrence: '4th_to_last',
75-
date_recurs_by: 'day_in_month'
75+
date_recurs_by: 'day_in_month',
76+
name: 'my booking',
77+
description: 'my description'
7678
};
7779

7880
const createBooking = {

0 commit comments

Comments
 (0)