Skip to content

Commit

Permalink
- Change register domain post method to get the arguments as string b…
Browse files Browse the repository at this point in the history
…ecause of ns should repeat
  • Loading branch information
habil committed May 16, 2017
1 parent a492db0 commit 7b5d650
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/APIs/Domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ public function register(
$additional = []
)
{
return $this->post(
'register',
[
$params = [
'domain-name' => $domain,
'years' => $years,
'ns' => $ns,
Expand All @@ -131,8 +129,11 @@ public function register(
'invoice-option' => $invoice, // Options: NoInvoice, PayInvoice, KeepInvoice
'purchase-privacy' => $purchasePrivacy,
'protect-privacy' => $protectPrivacy,
] + $this->processAttributes($additional)
);
] + $this->processAttributes($additional);

$params = http_build_query($params);

return $this->postArgString('register', $params);
}

public function transfer(
Expand Down
16 changes: 16 additions & 0 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ protected function post($method, $args = [], $prefix = '')
);
}

public function postArgString($method, $args = '', $prefix = '')
{
$authenticationString = http_build_query($this->authentication);

return $this->parse(
$this->guzzle->request(
'POST',
$this->api . '/' . $prefix . $method . '.json?' . preg_replace(
'/%5B[0-9]+%5D/simU',
'',
$args . '&' . $authenticationString
)
)
);
}

/**
* @param ResponseInterface $response
* @param string $type
Expand Down

0 comments on commit 7b5d650

Please sign in to comment.