-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from recurly/api-2.3
Changes for API 2.3
- Loading branch information
Showing
21 changed files
with
157 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class Recurly_AccountBalanceTest extends Recurly_TestCase | ||
{ | ||
function defaultResponses() { | ||
return array( | ||
array('GET', '/accounts/abcdef1234567890/balance', 'balance/show-200.xml'), | ||
); | ||
} | ||
|
||
public function testGet() { | ||
$balance = Recurly_AccountBalance::get('abcdef1234567890', $this->client); | ||
|
||
$this->assertInstanceOf('Recurly_AccountBalance', $balance); | ||
$this->assertEquals($balance->getHref(), 'https://api.recurly.com/v2/accounts/abcdef1234567890/balance'); | ||
$this->assertInstanceOf('Recurly_Stub', $balance->account); | ||
$this->assertEquals(true, $balance->past_due); | ||
|
||
$this->assertInstanceOf('Recurly_CurrencyList', $balance->balance_in_cents); | ||
$this->assertEquals(2910, $balance->balance_in_cents['USD']->amount_in_cents); | ||
$this->assertEquals(-520, $balance->balance_in_cents['EUR']->amount_in_cents); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/xml; charset=utf-8 | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<account_balance href="https://api.recurly.com/v2/accounts/abcdef1234567890/balance"> | ||
<account href="https://api.recurly.com/v2/accounts/abcdef1234567890"/> | ||
<past_due type="boolean">true</past_due> | ||
<balance_in_cents> | ||
<USD type="integer">2910</USD> | ||
<EUR type="integer">-520</EUR> | ||
</balance_in_cents> | ||
</account_balance> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
HTTP/1.1 200 OK | ||
X-Api-Version: 1.999 | ||
Recurly-Deprecated: true | ||
Recurly-Sunset-Date: 2014-01-01T00:00:00+00:00 | ||
Content-Language: en-US | ||
X-RateLimit-Limit: 2000 | ||
X-RateLimit-Remaining: 1998 | ||
X-RateLimit-Reset: 1467912540 | ||
X-Records: 3 | ||
Link: <https://api.recurly.com/v2/accounts?order=asc&per_page=1>; rel="start", <https://api.recurly.com/v2/accounts?cursor=-1963376195782139893&order=asc&per_page=1>; rel="prev" | ||
ETag: "d41d8cd98f00b204e9800998ecf8427e" | ||
Content-Type: application/xml; charset=utf-8 | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: 6a8c07775f9dac83402cea1a28752a55 | ||
X-Runtime: 0.048038 | ||
Connection: close | ||
Transfer-Encoding: chunked | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<accounts type="array"> | ||
</accounts> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
class Recurly_AccountBalance extends Recurly_Resource | ||
{ | ||
public static function get($accountCode, $client = null) { | ||
return Recurly_Base::_get(Recurly_Client::PATH_ACCOUNTS . '/' . rawurlencode($accountCode) . Recurly_Client::PATH_BALANCE, $client); | ||
} | ||
|
||
function __construct() { | ||
parent::__construct(); | ||
$this->balance_in_cents = new Recurly_CurrencyList('balance_in_cents'); | ||
} | ||
|
||
protected function getNodeName() { | ||
return 'balance'; | ||
} | ||
|
||
protected function getWriteableAttributes() { | ||
return array(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters