Esempio n. 1
0
 public function __construct($href = null, $client = null)
 {
     parent::__construct($href, $client);
     $this->_values = array();
     $this->_unsavedKeys = array();
     $this->_errors = new Recurly_ErrorList();
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 /**
  * 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;
 }
Esempio n. 5
0
 /**
  * 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);
 }
Esempio n. 9
0
 public function delete($accountCode = null)
 {
     return Recurly_Base::_delete($this->uri($accountCode), $this->_client);
 }
Esempio n. 10
0
 public static function deleteCoupon($couponCode, $client = null)
 {
     return Recurly_Base::_delete(Recurly_Coupon::uriForCoupon($couponCode), $client);
 }
Esempio n. 11
0
 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);
 }
Esempio n. 13
0
 public static function get($id, $client = null)
 {
     return Recurly_Base::_get(Recurly_MeasuredUnit::uriForMeasuredUnit($id), $client);
 }
Esempio n. 14
0
 public static function get($accountCode, $client = null)
 {
     return Recurly_Base::_get(Recurly_NoteList::uriForNotes($accountCode), $client);
 }
Esempio n. 15
0
 public static function get($subUuid, $addOnCode, $usageId, $client = null)
 {
     return Recurly_Base::_get(self::uriForUsage($subUuid, $addOnCode, $usageId), $client);
 }
Esempio n. 16
0
 public static function get($accountCode, $client = null)
 {
     return Recurly_Base::_get(Recurly_BillingInfo::uriForBillingInfo($accountCode), $client);
 }
Esempio n. 17
0
 public static function reopenAccount($accountCode, $client = null) {
   return Recurly_Base::_put(Recurly_Account::uriForAccount($accountCode) . '/reopen', $client);
 }
Esempio n. 18
0
 public static function get($uuid, $client = null)
 {
     return Recurly_Base::_get(Recurly_Subscription::uriForSubscription($uuid), $client);
 }
Esempio n. 19
0
 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);
 }
Esempio n. 21
0
 /**
  * Get a gift card by the id
  */
 public static function get($giftCardId, $client = null)
 {
     return Recurly_Base::_get(Recurly_GiftCard::uriForGiftCard($giftCardId), $client);
 }
Esempio n. 22
0
 public static function fetch($token, $client = null)
 {
     $uri = Recurly_Client::PATH_RECURLY_JS_RESULT . '/' . rawurlencode($token);
     return Recurly_Base::_get($uri, $client);
 }
Esempio n. 23
0
 /**
  * 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);
 }
Esempio n. 24
0
 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);
 }