From bf12b810acdf6159f48bea640ea6529b1e8cf810 Mon Sep 17 00:00:00 2001 From: visavi Date: Tue, 22 Oct 2019 18:36:44 +0300 Subject: [PATCH] fix readme --- README.md | 83 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index f2b49c3..22a31f9 100644 --- a/README.md +++ b/README.md @@ -7,33 +7,78 @@ $imp = new Imp(); $imp->setId('1'); $video = new Video(); -$video->setMimes( - [ +$video->setMimes([ 'video/mp4', 'application/x-shockwave-flash', 'application/javascript', 'video/webm', - 'video/mpg' - ] -) - ->setMinduration(1); - ->setMaxduration(120); - ->setProtocols([2, 3, 5, 6, 7, 8]); - ->setW(576); - ->setH(320); - ->setLinearity(2); - ->setSkip(1); - -$imp->setVideo($video); + 'video/mpg', + ]) + ->setMinduration(1) + ->setMaxduration(120) + ->setProtocols([2, 3, 5, 6, 7, 8]) + ->setW(576) + ->setH(320) + ->setLinearity(2) + ->setSkip(1) + ->setSkipmin(10) + ->setSkipafter(10) + ->setSequence(1) + ->setMaxextended(-1) + ->setApi([1,2]) + ->setPlacement(3); + +$imp->setVideo($video) + ->setBidfloor(100) + ->setBidfloorcur('RUB') + ->setSecure(1); + +$site = new Site(); +$site->setId('1234') + ->setDomain('test.ru') + ->setCat([ + 'IAB0', + 'IAB0-0', + ]) + ->setPublisher((new Publisher())->setId('test')) + ->setPage('https://test.ru'); + +$geo = new Geo(); +$geo->setLat(47.2361) + ->setLon(39.7189) + ->setType(2) + ->setCountry('RUS') + ->setRegion('RU-ROS') + ->setCity('Rostov-on-Don') + ->setZip('344000'); + +$device = new Device(); +$device->setUa('Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0') + ->setGeo($geo) + ->setIp('127.0.0.1') + ->setDevicetype(2) + ->setMake('unknown') + ->setModel('unknown') + ->setOs('Windows') + ->setLanguage('ru'); + +$user = new User(); +$user->setId('test1') + ->setBuyerid('xxxxxxxxx'); $bidRequest = new BidRequest(); $bidRequest - ->setId('test-id') - ->addImp($imp); - + ->setId('test-3') + ->addImp($imp) + ->setSite($site) + ->setDevice($device) + ->setUser($user) + ->setAt(2) + ->setTmax(300) + ->setCur(['RUB']); -$request = json_encode($bidRequest->toArray()); +$request = $bidRequest->getBidRequest(); ``` -### Install +## Install `composer require visavi/openrtb`