From 51729b919f70f25c56a3af10b5e00fca0e24f642 Mon Sep 17 00:00:00 2001 From: Ildar Usmanov Date: Fri, 27 Oct 2017 17:37:13 +0300 Subject: [PATCH 1/7] add headers into publisher --- src/publishers/HttpEventPublisher.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/publishers/HttpEventPublisher.php b/src/publishers/HttpEventPublisher.php index c7cf9d7..f290b74 100644 --- a/src/publishers/HttpEventPublisher.php +++ b/src/publishers/HttpEventPublisher.php @@ -84,7 +84,9 @@ protected function sendRequest($rKey, $event) $this->buildRequestUrl($rKey), [ 'headers' => [ - 'Content-Type' => 'application/json' + 'Content-Type' => 'application/json', + 'User-Agent' => $this->getOption('header_user_agent'), + 'Host' => $this->getOption('header_host'), ], 'body' => \json_encode($event), ] From c02956907be095cbf764b5e9588fde598f3d7475 Mon Sep 17 00:00:00 2001 From: Ildar Usmanov Date: Mon, 18 Dec 2017 17:59:52 +0300 Subject: [PATCH 2/7] send access token in http headers --- src/publishers/HttpEventPublisher.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/publishers/HttpEventPublisher.php b/src/publishers/HttpEventPublisher.php index f290b74..68a082c 100644 --- a/src/publishers/HttpEventPublisher.php +++ b/src/publishers/HttpEventPublisher.php @@ -86,6 +86,7 @@ protected function sendRequest($rKey, $event) 'headers' => [ 'Content-Type' => 'application/json', 'User-Agent' => $this->getOption('header_user_agent'), + 'Auth-Token' => $this->getOption('token'), 'Host' => $this->getOption('header_host'), ], 'body' => \json_encode($event), @@ -102,8 +103,6 @@ protected function sendRequest($rKey, $event) */ protected function buildRequestUrl($rKey) { - return $this->getOption('url') - . '/' . $rKey . '/events' - . '?token=' . $this->getOption('token'); + return $this->getOption('url') . '/' . $rKey . '/events'; } } From 402fed8027b75623e4678ee6214b1bb5fcaa306d Mon Sep 17 00:00:00 2001 From: Ildar Usmanov Date: Mon, 18 Dec 2017 18:19:33 +0300 Subject: [PATCH 3/7] tiny refactoring --- src/publishers/HttpEventPublisher.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/publishers/HttpEventPublisher.php b/src/publishers/HttpEventPublisher.php index 68a082c..932ac67 100644 --- a/src/publishers/HttpEventPublisher.php +++ b/src/publishers/HttpEventPublisher.php @@ -83,12 +83,13 @@ protected function sendRequest($rKey, $event) 'POST', $this->buildRequestUrl($rKey), [ - 'headers' => [ - 'Content-Type' => 'application/json', - 'User-Agent' => $this->getOption('header_user_agent'), - 'Auth-Token' => $this->getOption('token'), - 'Host' => $this->getOption('header_host'), - ], + 'headers' => array_merge( + [ + 'Content-Type' => 'application/json', + 'Auth-Token' => $this->getOption('token'), + ], + $this->getOption('headers') + ), 'body' => \json_encode($event), ] ); From 9d30e340e617ff69536e91c1605e2ad8461ab89f Mon Sep 17 00:00:00 2001 From: Ildar Usmanov Date: Mon, 25 Dec 2017 09:57:27 +0300 Subject: [PATCH 4/7] add travis ciyaml config --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..40a5c16 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: php +php: + - nightly \ No newline at end of file From 21bd9d38f092fef4c29c8a71cc0fd95cdc310a66 Mon Sep 17 00:00:00 2001 From: Ildar Usmanov Date: Mon, 25 Dec 2017 10:06:47 +0300 Subject: [PATCH 5/7] add testing script --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 40a5c16..616e8d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ language: php php: - - nightly \ No newline at end of file + - nightly +script: vendor/bin/codecept run unit \ No newline at end of file From e7a400b10bb5e25616be6e4f2c37cb3062ae91d4 Mon Sep 17 00:00:00 2001 From: Ildar Usmanov Date: Mon, 25 Dec 2017 10:11:25 +0300 Subject: [PATCH 6/7] update travis ci config --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 616e8d0..9c86610 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: php php: - nightly -script: vendor/bin/codecept run unit \ No newline at end of file +script: + - composer install + - ./vendor/bin/codecept run unit \ No newline at end of file From 323cbfdc77c26fa597340d6d27cac0f6ebaa04e4 Mon Sep 17 00:00:00 2001 From: Ildar Usmanov Date: Mon, 25 Dec 2017 10:18:53 +0300 Subject: [PATCH 7/7] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2c848d..cecfb36 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Eventmapper PHP - +[![Build Status](https://travis-ci.org/WajoxSoftware/php-eventmapper-lib.svg?branch=version-2)](https://travis-ci.org/WajoxSoftware/php-eventmapper-lib) ## Write and use event handler 1. Create your class by extending wajox\eventmapper\AbstractEventHandler 2. Put your handler code into method run(), the method should return boolean value