Skip to content

Commit

Permalink
Merge pull request #690 from recurly/pinho/v2_php_client_updates_fixes
Browse files Browse the repository at this point in the history
[API V2] Client Library and Doc Update - PHP
  • Loading branch information
JJDrill committed Apr 27, 2022
2 parents d2f3783 + 127782a commit 9f5516b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/recurly/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,20 @@ private static function __getTierInstance($node, $node_class)
$nodeNames[] = $node_item->tagName;
}
if( empty(array_diff($nodeNames, ['ending_amount_in_cents', 'usage_percentage'])) ) {
return new Recurly_CurrencyPercentageTier($nodeName);
return new Recurly_CurrencyPercentageTier(Recurly_Base::__getNodeName($node));
} else {
return new $node_class();
}
}

private static function __getNodeName($node)
{
return str_replace("-", "_", $node->nodeName);
}

private static function __createNodeObject($node, $client)
{
$nodeName = str_replace("-", "_", $node->nodeName);
$nodeName = Recurly_Base::__getNodeName($node);

if (!array_key_exists($nodeName, Recurly_Resource::$class_map)) {
return null; // Unknown element
Expand Down
4 changes: 4 additions & 0 deletions lib/recurly/measured_unit.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public static function get($id, $client = null) {
return Recurly_Base::_get(Recurly_MeasuredUnit::uriForMeasuredUnit($id), $client);
}

public function delete() {
return Recurly_Base::_delete($this->uri(), $this->_client);
}

protected function uri() {
if (!empty($this->_href))
return $this->getHref();
Expand Down

0 comments on commit 9f5516b

Please sign in to comment.