amirhamdy/giata-hotels-api

this is a giata hotels api

1.0.4 2020-05-20 08:29 UTC

This package is auto-updated.

Last update: 2024-11-20 18:39:14 UTC


README

Software License Travis Total Downloads

Install

composer require amirhamdy/giata-hotels-api

For versions < 5.5 of Laravel, add the service provider of the package and alias the package.

Open your config/app.php file.

Add a new line to the providers array:

GiataHotels\GiataHotelsServiceProvider::class

And add a new line to the aliases array:

'GiataAPI' => GiataHotels\GiataHotelsFacade::class

Now you're ready to start using the GiataAPI in your application.

Quick start

use GiataAPI;

$response = GiataAPI::getHotelsByCountry('EG', true);
// $response sample:

{
  "property": [{
      "giataId": "3",
      "lastUpdate": "2020-04-26T03:18:15+02:00",
      "href": "https://multicodes.giatamedia.com/webservice/rest/1.latest/properties/3"
    },
    {
      "giataId": "4",
      "lastUpdate": "2020-04-26T03:18:15+02:00",
      "href": "https://multicodes.giatamedia.com/webservice/rest/1.latest/properties/4"
    },
    ...
    ...
  ],
  "country": "EG",
  "lastUpdate": "2020-04-30"
}

Usage

This package gives you the following methods to use:

GiataAPI::getHotelsByCountry()

Getting all hotels in a country, you can just use the getHotelsByCountry() method.

  • In its most basic form you can specify the countryCode.
GiataAPI::getHotelsByCountry('EG');
  • As an optional second parameter you can pass it, the multi boolean option so you can get all information for each hotel in one request.
GiataAPI::getHotelsByCountry('EG', true);

GiataAPI::getHotelByGiataId()

  • Getting hotel's information using its Giata ID.
GiataAPI::getHotelByGiataId(3);

GiataAPI::getImagesByGiataId()

  • Getting hotel's images using its Giata ID.
GiataAPI::getImagesByGiataId(3);

GiataAPI::getTextsByGiataId()

  • Getting hotel's translations in a specific language default='ar using its Giata ID.
GiataAPI::getTextsByGiataId(3);
  • As a second parameter you can pass the language.
GiataAPI::getTextsByGiataId(3, 'fr');

Other packages you may be interested in

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email amirhamdy4@gmail.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.