Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from Cleeng/prepare_event_api_entity
Browse files Browse the repository at this point in the history
event offer entity
  • Loading branch information
mtymek committed Jul 27, 2015
2 parents 147f0f6 + 7809d5b commit b223f13
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 2 deletions.
1 change: 1 addition & 0 deletions cleeng_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'Entity/Customer.php',
'Entity/BundleOffer.php',
'Entity/SingleOffer.php',
'Entity/EventOffer.php',
'Entity/RemoteAuth.php',
'Entity/CustomerToken.php',
'Entity/Associate.php',
Expand Down
109 changes: 107 additions & 2 deletions src/Cleeng/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ public function getCustomerEmail()
);
}



/**
* Customer API: trackOfferImpression
*
Expand Down Expand Up @@ -779,6 +777,113 @@ public function updateMultiCurrencySingleOffer($multiCurrencyOfferId, $offerData
);
}

/**
* Event Offer API: getEventOffer
*
* @param string $offerId
* @return Cleeng_Entity_EventOffer
*/
public function getEventOffer($offerId)
{
$offer = new Cleeng_Entity_EventOffer();
return $this->api('getEventOffer', array('offerId' => $offerId), $offer);
}

/**
* Event Offer API: listEventOffers
*
* @param array $criteria
* @param int $offset
* @param int $limit
*
* @return Cleeng_Entity_Collection
*/
public function listEventOffers($criteria = array(), $offset = 0, $limit = 20)
{
$collection = new Cleeng_Entity_Collection('Cleeng_Entity_EventOffer');
return $this->api(
'listEventOffers',
array(
'publisherToken' => $this->getPublisherToken(),
'criteria' => $criteria,
'offset' => $offset,
'limit' => $limit,
),
$collection
);
}

/**
* Event Offer API: createEventOffer
*
* @param array $offerData
* @return Cleeng_Entity_EventOffer
* @throws Cleeng_Exception_RuntimeException
*/
public function createEventOffer($offerData)
{
$publisherToken = $this->getPublisherToken();
if (!$publisherToken) {
throw new Cleeng_Exception_RuntimeException("Cannot call " . __FUNCTION__ . ": setPublisherToken must be used first.");
}
return $this->api(
'createEventOffer',
array(
'publisherToken' => $publisherToken,
'offerData' => $offerData
),
new Cleeng_Entity_EventOffer()
);
}

/**
* Event Offer API: updateEventOffer
*
* @param string $offerId
* @param array $offerData
* @throws Cleeng_Exception_RuntimeException
* @return Cleeng_Entity_EventOffer
*/
public function updateEventOffer($offerId, $offerData)
{
$publisherToken = $this->getPublisherToken();
if (!$publisherToken) {
throw new Cleeng_Exception_RuntimeException("Cannot call " . __FUNCTION__ . ": setPublisherToken must be used first.");
}
return $this->api(
'updateEventOffer',
array(
'publisherToken' => $publisherToken,
'offerId' => $offerId,
'offerData' => $offerData,
),
new Cleeng_Entity_EventOffer()
);
}

/**
* Event Offer API: cancelEventOffer
*
* @param string $offerId
* @throws Cleeng_Exception_RuntimeException
* @return Cleeng_Entity_EventOffer
*/
public function cancelEventOffer($offerId)
{
$publisherToken = $this->getPublisherToken();
if (!$publisherToken) {
throw new Cleeng_Exception_RuntimeException("Cannot call " . __FUNCTION__ . ": setPublisherToken must be used first.");
}
return $this->api(
'cancelEventOffer',
array(
'publisherToken' => $publisherToken,
'offerId' => $offerId,
),
new Cleeng_Entity_EventOffer()
);
}

/**
* Rental Offer API: getRentalOffer
*
Expand Down
48 changes: 48 additions & 0 deletions src/Cleeng/Entity/EventOffer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Cleeng PHP SDK (http://cleeng.com)
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*
* @link https://github.com/Cleeng/cleeng-php-sdk for the canonical source repository
* @package Cleeng_PHP_SDK
*/

/**
* @link http://cleeng.com/open/v3/Reference/Event_Offer_API
*/
class Cleeng_Entity_EventOffer extends Cleeng_Entity_Base
{
protected $id;

protected $publisherEmail;

protected $url;

protected $shortUrl;

protected $title;

protected $price;

protected $currency;

protected $applicableTaxRate;

protected $startTime;

protected $endTime;

protected $timeZone;

protected $applyServiceFeeOnCustomer;

protected $active;

protected $createdAt;

protected $updatedAt;

protected $tags;
}

0 comments on commit b223f13

Please sign in to comment.