Skip to content

Commit

Permalink
Merge pull request #75 from poing/0.0.8
Browse files Browse the repository at this point in the history
0.0.8
  • Loading branch information
poing committed Dec 16, 2020
2 parents 304f863 + 809c5b7 commit d526a32
Show file tree
Hide file tree
Showing 70 changed files with 2,011 additions and 130 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 5 additions & 1 deletion .gitignore
@@ -1 +1,5 @@
/vendor/
/vendor
/build
composer.lock
*.cache
.DS_Store
97 changes: 47 additions & 50 deletions .travis.yml
@@ -1,75 +1,72 @@
language: php

php:
# - 5.5.9
# - 5.6 # Version 5.6.40 | End of Life: 10 Jan 2019
# - 7.0 # Version 7.0.33 | End of Life: 10 Jan 2019
# - 7.1 # Version 7.1.33 | End of Life: 1 Dec 2019
# - 7.2 # Version 7.2.30 | End of Life: 30 Nov 2020
# - 7.3 # End of Life: 6 Dec 2021
# - 7.4 # End of Life: 28 Nov 2022
# - hhvm
- 7.3 # End of Life: 6 Dec 2021
- 7.4 # End of Life: 28 Nov 2022
- 8.0 # End of Life: 26 Nov 2023
- nightly

env:
#- TESTBENCH=3.7.*
#- TESTBENCH=3.8.*
#- TESTBENCH=3.*
#- TESTBENCH=4.*
- TESTBENCH=5.*
#- TESTBENCH=dev-master
global:
- XDEBUG_MODE=coverage
- DOCKER_COMPOSE_VERSION=1.27.4
#- WOMBAT_HOST=172.77.62.74 # Value from docker-compose.yml
#- TESTBENCH=5.*
jobs:
# Used with matrix for older testbench/Laravel versions
#- TESTBENCH=3.7.*
#- TESTBENCH=3.8.*
#- TESTBENCH=3.*
#- TESTBENCH=4.*
- TESTBENCH=5.* # Laravel 7.x
- TESTBENCH=6.* # Laravel 8.x
#- TESTBENCH=dev-master

services:
- docker

# blocklist
branches:
except:
- /^analysis-.*$/
- /^analysis-.*$/ # Ignore StyleCI PR's

before_install:
#- composer remove illuminate/support illuminate/console illuminate/database \
# illuminate/events illuminate/filesystem illuminate/support
- composer require --dev "phpunit/phpunit:8.*" --prefer-dist --no-update
- composer require --dev "orchestra/testbench:${TESTBENCH}" --prefer-dist --no-update
# Update docker-compose version
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin

# if: ILLUMINATE=5.5.*
# - composer require --dev "orchestra/testbench:3.5.*"
# Fix used when working with older versions of testbench/Laravel
#- composer require --dev "phpunit/phpunit:8.*" --prefer-dist --no-update
- composer require --dev "orchestra/testbench:${TESTBENCH}" --prefer-dist --no-update

# optionally set up exclusions and allowed failures in the matrix
matrix:
exclude:
- php: 7.2
env: TESTBENCH=dev-master
- php: 7.3
env: TESTBENCH=dev-master
- php: hhvm
env: TESTBENCH=3.8.*
- php: hhvm
env: TESTBENCH=3.9.*
- php: hhvm
env: TESTBENCH=4.*
# allow_failures:
# # https://github.com/sebastianbergmann/phpunit/issues/4038
# - php: 7.3
# env: TESTBENCH=4.*
# - php: 7.3
# env: TESTBENCH=5.*
# - php: 7.4
# env: TESTBENCH=4.*
# - php: 7.4
# env: TESTBENCH=5.*
install:
# Build WombatDialer for Integration Testing
- docker-compose -f test/builds/wbt/docker-compose.yml up -d --force-recreate --build
- sleep 10 # Allow WombatDialer time to start

jobs:
allow_failures:
#- php: 8.0
- php: nightly

before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction

script:
- mkdir -p build/logs
- phpunit --verbose --coverage-clover build/logs/clover.xml
# - vendor/bin/phpunit --verbose

after_success:
- travis_retry php vendor/bin/php-coveralls
#- mkdir -p build/logs
#- export XDEBUG_MODE=debug
#- phpunit --verbose --coverage-clover build/logs/clover.xml
- vendor/bin/phpunit --verbose
# - phpunit --verbose --coverage-text

#after_script:
# - travis_retry php vendor/bin/coveralls -v
after_script:
#after_success:
- travis_retry php vendor/bin/php-coveralls -v

# configure notifications (email, IRC, campfire etc)
notifications:
Expand Down
1 change: 1 addition & 0 deletions README.md
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.com/poing/laravel-wombatdialer-api.svg?branch=main)](https://travis-ci.com/poing/laravel-wombatdialer-api)
[![Coverage Status](https://coveralls.io/repos/github/poing/laravel-wombatdialer-api/badge.svg?branch=main)](https://coveralls.io/github/poing/laravel-wombatdialer-api?branch=main)
[![StyleCI](https://github.styleci.io/repos/301573810/shield?branch=main&style=flat)](https://github.styleci.io/repos/301573810?branch=main)

# laravel-wombatdialer-api
Expand Down
16 changes: 14 additions & 2 deletions composer.json
Expand Up @@ -4,7 +4,8 @@
"keywords": ["WombatDialer", "Wombat", "Dialer", "Laravel", "API", "outbound calling", "outbound", "calling", "call center", "callcenter", "PBX"],
"type": "library",
"require": {
"laravel/framework": ">=7.0"
"laravel/framework": ">=7.0",
"guzzlehttp/guzzle": "^7.0.1"
},
"license": "GPL-3.0-or-later",
"authors": [
Expand All @@ -27,11 +28,22 @@
"WombatDialer\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"WombatDialer\\Test\\": "test/"
}
},
"extra": {
"laravel": {
"providers": [
"WombatDialer\\WombatdialerServiceProvider"
]
}
},
"require-dev": {
"phpunit/phpunit": "^9.4",
"orchestra/testbench": "^6.3",
"php-coveralls/php-coveralls": "^2.4",
"laravel/legacy-factories": "^1.0.4"
}
}
}
19 changes: 19 additions & 0 deletions phpunit.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<testsuite name="WombatTest">
<directory>./test</directory>
</testsuite>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</phpunit>
27 changes: 27 additions & 0 deletions phpunit.xml.bak
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">

<testsuite name="WombatTest" >
<directory>./test</directory>
</testsuite>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
Binary file modified src/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions src/Concerns/EpTraits.php
Expand Up @@ -11,7 +11,7 @@ trait EpTraits
'queueName' => '',
'name' => 'DefaultSample',
'astId' => [
'id' => 106,
'id' => 25,
],
'idx' => '',
'campaignId' => '',
Expand All @@ -26,5 +26,5 @@ trait EpTraits
'description' => 'Sample',
'dialFind' => '',
'dialReplace' => '',
];
];
}
10 changes: 5 additions & 5 deletions src/Concerns/TrunkTraits.php
Expand Up @@ -8,11 +8,11 @@ trait TrunkTraits
protected $primaryKeyname = 'trunkId';
protected $default = [
'astId' => [
'id' => 101,
'id' => 4,
],
'name' => 'Gamma',
'dialstring' => 'Local/${num}@from-internal/n',
'capacity' => 10,
'securityKey' => '',
];
'dialstring' => 'Local/${num}@from-internal/n',
'capacity' => 10,
'securityKey' => '',
];
}
20 changes: 14 additions & 6 deletions src/Controllers/Edit/Campaign/Disposition.php
Expand Up @@ -22,11 +22,9 @@ public function addRules($campaignId, $data)
$response = Http::withBasicAuth($this->userAuth(), $this->passAuth())
->asForm()
->post($this->connection(), ['data' => json_encode($data)]);
$this->checkDispData($data);
//check response and send mail if errors
$this->html_mail($response);
if ((! in_array($data['onState'], $this->statusOptions())) || (! in_array($data['verb'], $this->actionsOptions()))) {
trigger_error('Value not found in option array!');
}

return $response->json();
}
Expand All @@ -44,16 +42,26 @@ public function updateRules($campaignId, $data)
$response = Http::withBasicAuth($this->userAuth(), $this->passAuth())
->asForm()
->post($this->connection(), ['data' => json_encode($data)]);
$this->checkDispData($data);
//check response and send mail if errors
$this->html_mail($response);
if ((! in_array($data['onState'], $this->statusOptions())) || (! in_array($data['verb'], $this->actionsOptions()))) {
trigger_error('Value not found in option array!');
}

// $record = collect($results['results'])->first()[$this->primaryKeyname];
return $response->json();
}

/**
* To check, Whether the 'onState' data matches with the data in the GUI.
*
* Returns a string, If the data does not matches.
*/
public function checkDispData($data)
{
if ((! in_array($data['onState'], $this->statusOptions())) || (! in_array($data['verb'], $this->actionsOptions()))) {
trigger_error('Value not found in option array!');
}
}

/**
* Generates a Formatted HTML_MAIL.
* @param $response fails, It generates a html_mail.
Expand Down
34 changes: 28 additions & 6 deletions src/Controllers/Edit/Campaign/Reschedule.php
Expand Up @@ -23,11 +23,9 @@ public function addRules($campaignId, $data)
$response = Http::withBasicAuth($this->userAuth(), $this->passAuth())
->asForm()
->post($this->connection(), ['data' => json_encode($data)]);
$this->checkRulesData($data);
//check response and &send mail if error
$this->html_mail($response);
if (! in_array($data['status'], $this->statusOptions())) {
trigger_error('Value not found in option array!');
}

return $response->json();
}
Expand All @@ -50,6 +48,20 @@ public function indexRules($campaignId)
return $response->json();
}

/**
* Perform API GET.
* Displays the records based on the @param $campaignId.
*
* @param $campaignId
* @return Json
*/
public function showRules($campaignId)
{
$response = self::indexRules($campaignId);

return $response;
}

/**
* Perform API POST.
* Updates the existing Rules for the API.
Expand All @@ -63,11 +75,9 @@ public function updateRules($campaignId, $data)
$response = Http::withBasicAuth($this->userAuth(), $this->passAuth())
->asForm()
->post($this->connection(), ['data' => json_encode($data)]);
$this->checkRulesData($data);
//check response and &send mail if error
$this->html_mail($response);
if (! in_array($data['status'], $this->statusOptions())) {
trigger_error('Value not found in option array!');
}

// $record = collect($results['results'])->first()[$this->primaryKeyname];
return $response->json();
Expand All @@ -93,6 +103,18 @@ public function destroyRules($campaignId, $data)
return $response->json();
}

/**
* To check, Whether the 'Status' data matches with the data in the GUI.
*
* Returns a string, If the data does not matches.
*/
public function checkRulesData($data)
{
if (! in_array($data['status'], $this->statusOptions())) {
trigger_error('Value not found in option array!');
}
}

/**
* Generates a Formatted HTML_MAIL.
* @param $response fails, It generates a html_mail.
Expand Down

0 comments on commit d526a32

Please sign in to comment.