public function __construct($href = null, $client = null) { parent::__construct($href, $client); $this->_values = array(); $this->_unsavedKeys = array(); $this->_errors = new Recurly_ErrorList(); }
public function testPassingClientToStub() { $this->client->addResponse('GET', 'abcdef1234567890', 'adjustments/show-200.xml'); $adjustment = Recurly_Base::_get('abcdef1234567890', $this->client); $this->assertInstanceOf('Recurly_Adjustment', $adjustment); $invoice = $adjustment->invoice; $this->assertInstanceOf('Recurly_Stub', $invoice); $this->assertEquals(getProtectedProperty($invoice, '_client'), $this->client); }
public function testFromNested() { $this->client->addResponse('GET', '/a-mock', 'pager/show-200.xml'); $account = Recurly_Base::_get('/a-mock', $this->client); $this->assertInstanceOf('Recurly_Account', $account); $pager = $account->mocks; $this->assertInstanceOf('Mock_Pager', $pager); $this->assertNull($pager->getHref(), "Nested records shouldn't have a URL"); $this->assertEquals(4, $pager->count(), 'Returns correct count'); $this->assertIteratesCorrectly($pager, 4); }
/** * Delete the URI, validate the response and return the object. * @param string Resource URI, if not fully qualified, the base URL will be appended * @param string Optional client for the request, useful for mocking the client */ protected static function _delete($uri, $client = null) { if (is_null($client)) $client = new Recurly_Client(); $response = $client->request(Recurly_Client::DELETE, $uri); $response->assertValidResponse(); if ($response->body) { return Recurly_Base::__parseXmlToNewObject($response->body, $client); } return null; }
/** * Post to the URI, validate the response and return the object. * @param string Resource URI, if not fully qualified, the base URL will be appended * @param string Data to post to the URI * @param string Optional client for the request, useful for mocking the client */ protected static function _post($uri, $data = null, $client = null) { if (is_null($client)) { $client = new Recurly_Client(); } $response = $client->request(Recurly_Client::POST, $uri, $data); $response->assertValidResponse(); $object = Recurly_Base::__parseXmlToNewObject($response->body, $client); $response->assertSuccessResponse($object); return $object; }
public function testPassingClientToStub() { $this->client->addResponse('GET', 'abcdef1234567890', 'adjustments/show-200.xml'); $adjustment = Recurly_Base::_get('abcdef1234567890', $this->client); $this->assertInstanceOf('Recurly_Adjustment', $adjustment); $this->assertInstanceOf('Recurly_Stub', $adjustment->invoice); // The client is protected so we do a little song and dance to access it: $reflection = new \ReflectionClass($adjustment->invoice); $property = $reflection->getProperty('_client'); $property->setAccessible(true); $this->assertEquals($property->getValue($adjustment->invoice), $this->client); }
public static function get($adjustment_uuid) { return Recurly_Base::_get(Recurly_Client::PATH_ADJUSTMENTS . '/' . rawurlencode($adjustment_uuid)); }
public function delete() { return Recurly_Base::_delete($this->getHref(), $this->_client); }
public function delete($accountCode = null) { return Recurly_Base::_delete($this->uri($accountCode), $this->_client); }
public static function deleteCoupon($couponCode, $client = null) { return Recurly_Base::_delete(Recurly_Coupon::uriForCoupon($couponCode), $client); }
function __construct($objectType, $href, $client = null) { parent::__construct($href, $client); $this->objectType = $objectType; }
public static function get($accountCode, $client = null) { return Recurly_Base::_get(Recurly_CouponRedemption::uriForAccount($accountCode), $client); }
public static function get($id, $client = null) { return Recurly_Base::_get(Recurly_MeasuredUnit::uriForMeasuredUnit($id), $client); }
public static function get($accountCode, $client = null) { return Recurly_Base::_get(Recurly_NoteList::uriForNotes($accountCode), $client); }
public static function get($subUuid, $addOnCode, $usageId, $client = null) { return Recurly_Base::_get(self::uriForUsage($subUuid, $addOnCode, $usageId), $client); }
public static function get($accountCode, $client = null) { return Recurly_Base::_get(Recurly_BillingInfo::uriForBillingInfo($accountCode), $client); }
public static function reopenAccount($accountCode, $client = null) { return Recurly_Base::_put(Recurly_Account::uriForAccount($accountCode) . '/reopen', $client); }
public static function get($uuid, $client = null) { return Recurly_Base::_get(Recurly_Subscription::uriForSubscription($uuid), $client); }
public static function get($uuid, $client = null) { return Recurly_Base::_get(Recurly_Transaction::uriForTransaction($uuid), $client); }
public static function get($planCode, $client = null) { return Recurly_Base::_get(Recurly_Plan::uriForPlan($planCode), $client); }
/** * Get a gift card by the id */ public static function get($giftCardId, $client = null) { return Recurly_Base::_get(Recurly_GiftCard::uriForGiftCard($giftCardId), $client); }
public static function fetch($token, $client = null) { $uri = Recurly_Client::PATH_RECURLY_JS_RESULT . '/' . rawurlencode($token); return Recurly_Base::_get($uri, $client); }
/** * Load another page of results into this pager. */ protected function _loadFrom($uri, $params = null) { if (empty($uri)) { return; } $uri = Recurly_Base::_uriWithParams($uri, $params); $response = $this->_client->request(Recurly_Client::GET, $uri); $response->assertValidResponse(); $this->_objects = array(); $this->__parseXmlToUpdateObject($response->body); $this->_afterParseResponse($response, $uri); }
public static function get($planCode, $addonCode) { return Recurly_Base::_get(Recurly_Addon::uriForAddOn($planCode, $addonCode)); }
public static function get($accountCode, $client = null) { return Recurly_Base::_get(Recurly_Client::PATH_ACCOUNTS . '/' . rawurlencode($accountCode) . Recurly_Client::PATH_BALANCE, $client); }