Пример #1
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
// set $api_token and $api_secret
include 'auth.php';
try {
    // we need to store HTTP response headers and responses to comply with API caching policy
    $storage_config = array('connection' => 'mongodb://127.0.0.1:27017', 'database' => 'shorefox', 'collection' => 'api');
    $trip = new \Shorefox\Client\Client($api_token, $api_secret, $storage_config, true);
    // get all cruise dates for carnival splendor
    $cruises_carnival_splendor = $trip->getCruiseDates()->getForCruiseShip(5843060);
    // get itinerary for the first carnival splendor cruise returned above
    $cruise = $cruises_carnival_splendor['cruise_dates'][0];
    $itin = $trip->getCruiseDates()->getItinerary($cruise['id']);
} catch (\Exception $e) {
    echo "{$e->getMessage()}, {$e->getCode()}\n";
}
Пример #2
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
// set $api_token and $api_secret
include 'auth.php';
try {
    // we need to store HTTP response headers and responses to comply with API caching policy
    $storage_config = array('connection' => 'mongodb://127.0.0.1:27017', 'database' => 'shorefox', 'collection' => 'api');
    $trip = new \Shorefox\Client\Client($api_token, $api_secret, $storage_config, true);
    // payment key or any other config variables
    $config_all = $trip->getConfig()->getAll();
    // booking config without guests
    // @see https://api.shorefox.com/doc/public/bookings/successful_tour_booking.html
    $stripe_token = 'tok_3hrjWpCOlBD27Z';
    $booking_config = array('booking' => array('adult_count' => 1, 'child_count' => 0, 'time' => '11:00am', 'date' => '2014-03-31', 'guest_name' => 'Justus Corkery', 'guest_email' => '*****@*****.**', 'guest_country' => 'US', 'guest_phone_country_code' => '+1', 'guest_phone_number' => '437-901-8950', 'payment_token' => $stripe_token, 'newsletter_subscribe' => true, 'tour_id' => 1));
    $booking = $trip->getBooking()->create($booking_config);
    var_dump($booking);
} catch (\Exception $e) {
    echo "{$e->getMessage()}, {$e->getCode()}\n";
}
Пример #3
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
// set $api_token and $api_secret
include 'auth.php';
try {
    // we need to store HTTP response headers and responses to comply with API caching policy
    $storage_config = array('connection' => 'mongodb://127.0.0.1:27017', 'database' => 'shorefox', 'collection' => 'api');
    $trip = new \Shorefox\Client\Client($api_token, $api_secret, $storage_config, true);
    // get all tour types
    $tourtypes_all = $trip->getTourTypes()->getAll();
    var_dump($tourtypes_all);
    // get tour types by sub-type, ex for "Water Adventures -> Surf Lessons"
    $tourtypes_all = $trip->getTourTypes()->getWithTourSubType(5);
    // list of tours in caribbean for specific date (date is optional, will otherwise return all caribbean tours)
    $tours_caribbean = $trip->getTours()->getInDestination(3, new \DateTime('2014-05-21'));
    // get tour details for the first tour from above
    $tour = $trip->getTours()->get($tours_caribbean['tours'][0]['id']);
    // get all images for that tour
    $images = $trip->getTours()->getImages($tour['tour']['id']);
    // get guest feedback for the tour
    $feedback = $trip->getTours()->getFeedback($tour['tour']['id']);
    // availability for specific tour from 2014-04-01 to 2014-04-30
    $avail = $trip->getTours()->getAvailability($tour['tour']['id'], new \DateTime('2014-04-01'), new \DateTime('2014-04-30'));
    // check price for tour for 2 adults and 1 child
    $price = $trip->getTours()->getPrice($tour['tour']['id'], 2, 1);
} catch (\Exception $e) {
    echo "{$e->getMessage()}, {$e->getCode()}\n";
}
Пример #4
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
// set $api_token and $api_secret
include 'auth.php';
try {
    // we need to store HTTP response headers and responses to comply with API caching policy
    $storage_config = array('connection' => 'mongodb://127.0.0.1:27017', 'database' => 'shorefox', 'collection' => 'api');
    $trip = new \Shorefox\Client\Client($api_token, $api_secret, $storage_config, true);
    // get all cruise lines
    $cruiselines_all = $trip->getCruiseLines()->getAll();
    // get all ships
    $ships_all = $trip->getCruiseShips()->getAll();
    // get all ships for carnival cruise lines
    $ships_carnival = $trip->getCruiseShips()->getForCruiseLine(68);
} catch (\Exception $e) {
    echo "{$e->getMessage()}, {$e->getCode()}\n";
}
Пример #5
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
// set $api_token and $api_secret
include 'auth.php';
try {
    // we need to store HTTP response headers and responses to comply with API caching policy
    $storage_config = array('connection' => 'mongodb://127.0.0.1:27017', 'database' => 'shorefox', 'collection' => 'api');
    $trip = new \Shorefox\Client\Client($api_token, $api_secret, $storage_config, true);
    // all countries
    $countries_all = $trip->getCountries()->getAll();
    // all calling codes
    $codes_all = $trip->getCallingCodes()->getAll();
    // USA calling codes
    $codes_usa = $trip->getCallingCodes()->getForCountry('US');
    // get all regions (carbbean, alaska, etc)
    $regions_all = $trip->getRegions()->getAll();
    // get details for caribbean
    $regions_caribbean = $trip->getRegions()->get(3);
    // get all destinations (ports) in caribbean
    $destinations_all = $trip->getDestinations()->getInRegion($regions_caribbean['region']['id']);
    // get info on st maarten
    $destinations_stmaarten = $trip->getDestinations()->get(100);
    // get images for st maarten
    $images_stmaarten = $trip->getDestinations()->getImages($destinations_stmaarten['destination']['id']);
} catch (\Exception $e) {
    echo "{$e->getMessage()}, {$e->getCode()}\n";
}