/** * @author nathanhelenihi * @group common */ public function testToArray() { new MaError(); // Just to load error definitions. $obj = new MaResponse(); $data = 'Bad data'; $obj->error(MA_OTA_ERR_JSON_INVALID, $data); $errors = $obj->errors[0]->getMappings(); $this->assertSame($obj->toArray(), array('success' => false, 'errors' => array(array('id' => MA_OTA_ERR_JSON_INVALID, 'type' => $errors[MA_OTA_ERR_JSON_INVALID]['type'], 'msg' => $errors[MA_OTA_ERR_JSON_INVALID]['msg'], 'data' => $data)))); }
/** * Get a list of bookings within a date range for a property. * * args['verb']* string Defines the API endpoint method. * args['guid']* string A unique 36 character code that identifies a request. * args['mya_property_id']* string The property_id in MyAllocator. * args['ota_property_id']* string The property_id in OTA. * * @param array $args (See above) * * @return \MyAllocator\phpsdkota\src\Object\MaResponse */ public function getBookingList($args) { $rsp = new \MyAllocator\phpsdkota\src\Object\MaResponse(); $data = array('Bookings' => array(array('booking_id' => 'boo-235872225.json', 'version' => 0), array('booking_id' => 'exp-503365981.json', 'version' => 0))); return $rsp->success($data); }