Skip to content

Commit

Permalink
Merge branch '2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilFreelancer committed Feb 20, 2021
2 parents 5c6f77e + adb5ba1 commit 9539a1e
Show file tree
Hide file tree
Showing 113 changed files with 4,321 additions and 2,886 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Ignoring directories.
/.idea/
/vendor/

# Ignoring files.
/.phpunit.result.cache
/composer.lock
/composer.phar
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
language: php

php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.2'
- '7.3'
- '7.4'

before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev
- composer self-update
- composer install --no-progress

script:
- vendor/bin/phpunit --coverage-clover=coverage.clover
- vendor/bin/phpunit --coverage-clover=coverage.clover

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
40 changes: 20 additions & 20 deletions README.API.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Список классов и их методов

```php
$config = new \UON\Config();
$config = new \Uon\Config();
$config->set('token', 'your-uon-token');
$uon = new \UON\API($config);
$uon = new \Uon\API($config);
```

### \UON\Endpoint\Bcard()
### \Uon\Endpoint\Bcard()

`$uon->bcard`

Expand All @@ -19,7 +19,7 @@ getByCard($id) // Получение транзакций бону
getByUser($id) // Получение транзакций бонусной карты клиента (по ID клиента)
```

### \UON\Endpoint\Cash()
### \Uon\Endpoint\Cash()

`$uon->cash`

Expand All @@ -30,7 +30,7 @@ get($params) // Получение списка касс
create($params) // Добавление кассы
```

### \UON\Endpoint\Catalog()
### \Uon\Endpoint\Catalog()

`$uon->catalog`

Expand All @@ -42,7 +42,7 @@ create($params) // Создание услуги Я-оператор
update($id, $params) // Обновление услуги Я-оператор
```

### \UON\Endpoint\Chat()
### \Uon\Endpoint\Chat()

`$uon->chat`

Expand All @@ -52,7 +52,7 @@ update($id, $params) // Обновление услуги Я-операт
create($params) // Отправка сообщения от менеджера другому менеджеру или туристу
```

### \UON\Endpoint\Cities()
### \Uon\Endpoint\Cities()

`$uon->cities`

Expand All @@ -64,7 +64,7 @@ create($params) // Добавление города
update($id, $params) // Обновление данных по городу
```

### \UON\Endpoint\Hotels()
### \Uon\Endpoint\Hotels()

`$uon->hotels`

Expand All @@ -78,7 +78,7 @@ update($id, $params) // Обновление данных по отелю
delete($id) // Удаление отеля
```

### \UON\Endpoint\Countries()
### \Uon\Endpoint\Countries()

`$uon->countries`

Expand All @@ -90,7 +90,7 @@ create($params) // Добавление страны
update($id, $params) // Обновление данных по стране
```

### \UON\Endpoint\Leads()
### \Uon\Endpoint\Leads()

`$uon->leads`

Expand All @@ -104,7 +104,7 @@ getDate($date_from, $date_to, $page) // Получение данных по л
getDate($date_from, $date_to, $page, $source_id) // Получение данных по лидам / обращениям согласно источнику (постранично)
```

### \UON\Endpoint\Misc()
### \Uon\Endpoint\Misc()

`$uon->misc`

Expand All @@ -121,7 +121,7 @@ getOffices($param) // Получить список офисов
getReasonDeny() // Получить список причин отказа
```

### \UON\Endpoint\Nutrition()
### \Uon\Endpoint\Nutrition()

`$uon->nutrition`

Expand All @@ -133,7 +133,7 @@ create($params) // Добавление питания
update($id, $params) // Обновление типа питания
```

### \UON\Endpoint\Payments()
### \Uon\Endpoint\Payments()

`$uon->payments`

Expand All @@ -147,7 +147,7 @@ update($id, $params) // Изменение платежа
delete($id) // Удаление платежа
```

### \UON\Endpoint\Reminders()
### \Uon\Endpoint\Reminders()

`$uon->reminders`

Expand All @@ -158,7 +158,7 @@ get() // Получение списка напомина
create($r_id) // Добавление напоминания в заявку
```

### \UON\Endpoint\Requests()
### \Uon\Endpoint\Requests()

`$uon->requests`

Expand Down Expand Up @@ -193,7 +193,7 @@ getTravelType($params) // Получение типов заявки
createTravelType($name) // Добавление нового типа заявки
```

### \UON\Endpoint\Services()
### \Uon\Endpoint\Services()

`$uon->services`

Expand All @@ -205,7 +205,7 @@ create($params) // Добавление услуги в заявку
update($id, $params) // Обновление данных по услуге
```

### \UON\Endpoint\Sources()
### \Uon\Endpoint\Sources()

`$uon->sources`

Expand All @@ -216,7 +216,7 @@ all() // Список источников заявки
create($params) // Добавление источника заявки
```

### \UON\Endpoint\Statuses()
### \Uon\Endpoint\Statuses()

`$uon->statuses`

Expand All @@ -227,7 +227,7 @@ get($params) // Получение списка статусов
getLead($params) // Получение списка статусов обращений
```

### \UON\Endpoint\Suppliers()
### \Uon\Endpoint\Suppliers()

`$uon->suppliers`

Expand All @@ -242,7 +242,7 @@ getType($id) // Получение типов партнеров
createType($params) // Добавление типа партнера
```

### \UON\Endpoint\Users()
### \Uon\Endpoint\Users()

`$uon->users`

Expand Down
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/DrTeamRocks/uon/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/DrTeamRocks/uon/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/DrTeamRocks/uon/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/DrTeamRocks/uon/?branch=master)

# U-On Travel RESTful API Client (unofficial)
# U-On Travel API Client (unofficial)

A simple client that allows to work with RESTful API of U-On Travel company.
A simple client that allows to work with API of U-On Travel company.

composer require drteam/uon
```shell
composer require drteam/uon
```

This library is ready for production usage, all source codes provided "as is".

About [migration to 1.8](https://github.com/DrTeamRocks/uon/wiki/Миграция-с-1.7-(и-ниже)-на-1.8-(и-выше)).

## How to use

### Basic example
Expand All @@ -27,24 +27,24 @@ About [migration to 1.8](https://github.com/DrTeamRocks/uon/wiki/Миграци
require_once __DIR__ . '/vendor/autoload.php';

// Main object for work with API
$uon = new \UON\API('some_token');
$uon = new \Uon\Client(['token' => 'some_token']);

// Some examples
$users = $uon->users->all(); // Get a list of all users
$user = $uon->users->get(1); // Get user by unique id
$request = $uon->requests->get(1); // Get request by unique ID
$managers = $uon->misc->getManagers(); // Get list of managers
$managers = $uon->managers->all(); // Get list of managers
```

See other examples of usage [here](extra) separated by class names.

All available methods of all classes with descriptions you can find [here](README.API.md).
All available methods of all classes with descriptions you can find [here](README.Client.md).

### How to configure the client

```php
// Enable config class
use \UON\Config;
use \Uon\Config;

// Class with configuration options
$config = new Config();
Expand All @@ -59,37 +59,37 @@ $config = new Config([
]);
```

Object of Config should be added as parameter of API client:
Object of Config should be added as parameter of client:

```php
use \UON\Config;
use \UON\API;
use \Uon\Config;
use \Uon\Client;

$config = new Config([
'token' => 'some_token',
'timeout' => 10
]);

$client = new API($config);
$client = new Client($config);
```

But you also can use array of parameters:

```php
use \UON\API;
use \Uon\Client;

$client = new API([
$client = new Client([
'token' => 'some_token',
'timeout' => 10
]);
```

If you want create API object with default parameters:
If you want to create Client object with default parameters:

```php
use \UON\API;
use \Uon\Client;

$client = new API('some_token');
$client = new Client(['token' => 'some_token']);
```

### Available parameters of configuration
Expand All @@ -107,7 +107,7 @@ $client = new API('some_token');
| seconds | int | 1 | Time which need wait between tries |

```php
$config = new \UON\Config([
$config = new \Uon\Config([
'token' => 'some_token',
'timeout' => 100,
'tries' => 20,
Expand Down
73 changes: 41 additions & 32 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
{
"authors": [
{
"homepage": "http://drteam.rocks/",
"email": "paul@drteam.rocks",
"name": "Paul Rock",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"UON\\": "src/"
}
},
"description": "U-On Travel RESTful API Client",
"homepage": "https://api.u-on.ru/doc",
"keywords": [
"u-on",
"rest-api"
],
"license": "MIT",
"minimum-stability": "stable",
"name": "drteam/uon",
"require": {
"php": ">=5.6",
"ext-curl": "*",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
},
"type": "library"
"authors": [
{
"homepage": "https://github.com/EvilFreelancer",
"email": "paul@drteam.rocks",
"name": "Paul Rock",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Uon\\": "./src/"
}
},
"autoload-dev": {
"psr-4": {
"Uon\\Tests\\": "./tests/"
}
},
"description": "U-On Travel RESTful API Client",
"homepage": "https://api.u-on.ru/doc",
"keywords": [
"u-on",
"rest",
"api-client",
"client"
],
"license": "MIT",
"name": "drteam/uon",
"require": {
"php": "^7.2",
"ext-curl": "*",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.1"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.1.x-dev",
"larapack/dd": "^1.1",
"phpunit/phpunit": "^8.0"
},
"type": "library",
"minimum-stability": "stable"
}
Loading

0 comments on commit 9539a1e

Please sign in to comment.