Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions opensrs/Ops.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public function XML2PHP($msg)
public function encode($array)
{
++$this->_MSGCNT;
//$msg_id = $this->_SESSID + $this->_MSGCNT; /* addition removes the leading zero */
$msg_id = ltrim($this->_SESSID.$this->_MSGCNT, '0');
$msg_type = $this->_MSGTYPE_STD;

Expand Down
5 changes: 4 additions & 1 deletion opensrs/RequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ class RequestFactory
'mailsetdomainblocklist' => 'mail\SetDomainBlockList',
'mailsetdomaindisabledstatus' => 'mail\SetDomainDisabledStatus',
'mailsetdomainmailboxlimits' => 'mail\SetDomainMailboxLimits',
'accountgetbalance' => 'account\GetBalance'
'accountgetbalance' => 'account\GetBalance',
// EVENT polling commands
'eventpoll' => 'event\PollEvent',
'eventack' => 'event\PollAck',
);

public static function build($func, $type, $dataObject)
Expand Down
44 changes: 44 additions & 0 deletions opensrs/backwardcompatibility/dataconversion/event/PollAck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace opensrs\backwardcompatibility\dataconversion\event;

use opensrs\backwardcompatibility\dataconversion\DataConversion;

class PollAck extends DataConversion
{
// New structure for API calls handled by
// the toolkit.
//
// index: field name
// value: location of data to map to this
// field from the original structure
//
// example 1:
// "cookie" => 'data->cookie'
// this will map ->data->cookie in the
// original object to ->cookie in the
// new format
//
// example 2:
// ['attributes']['domain'] = 'data->domain'
// this will map ->data->domain in the original
// to ->attributes->domain in the new format
protected $newStructure = array(
'attributes' => array(
'event_id' => 'data->event_id',
),
);

public function convertDataObject($dataObject, $newStructure = null)
{
$p = new parent();

if (is_null($newStructure)) {
$newStructure = $this->newStructure;
}

$newDataObject = $p->convertDataObject($dataObject, $newStructure);

return $newDataObject;
}
}
44 changes: 44 additions & 0 deletions opensrs/backwardcompatibility/dataconversion/event/PollEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace opensrs\backwardcompatibility\dataconversion\event;

use opensrs\backwardcompatibility\dataconversion\DataConversion;

class PollEvent extends DataConversion
{
// New structure for API calls handled by
// the toolkit.
//
// index: field name
// value: location of data to map to this
// field from the original structure
//
// example 1:
// "cookie" => 'data->cookie'
// this will map ->data->cookie in the
// original object to ->cookie in the
// new format
//
// example 2:
// ['attributes']['domain'] = 'data->domain'
// this will map ->data->domain in the original
// to ->attributes->domain in the new format
protected $newStructure = array(
'attributes' => array(
'limit' => 'data->poll_limit',
),
);

public function convertDataObject($dataObject, $newStructure = null)
{
$p = new parent();

if (is_null($newStructure)) {
$newStructure = $this->newStructure;
}

$newDataObject = $p->convertDataObject($dataObject, $newStructure);

return $newDataObject;
}
}
38 changes: 38 additions & 0 deletions opensrs/event/PollAck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace opensrs\event;

use opensrs\Base;

class PollAck extends Base
{
public $action = 'ack';
public $object = 'event';

public $_formatHolder = '';
public $resultFullRaw;
public $resultRaw;
public $resultFullFormatted;
public $resultFormatted;

public $requiredFields = array(
'attributes' => array(
'event_id'
)
);

public function __construct($formatString, $dataObject, $returnFullResponse = true)
{
parent::__construct();

$this->_formatHolder = $formatString;
$this->_validateObject($dataObject);

$this->send($dataObject, $returnFullResponse);
}

public function __destruct()
{
parent::__destruct();
}
}
32 changes: 32 additions & 0 deletions opensrs/event/PollEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace opensrs\event;

use opensrs\Base;

class PollEvent extends Base
{
public $action = 'poll';
public $object = 'event';

public $_formatHolder = '';
public $resultFullRaw;
public $resultRaw;
public $resultFullFormatted;
public $resultFormatted;

public function __construct($formatString, $dataObject, $returnFullResponse = true)
{
parent::__construct();

$this->_formatHolder = $formatString;
$this->_validateObject($dataObject);

$this->send($dataObject, $returnFullResponse);
}

public function __destruct()
{
parent::__destruct();
}
}