Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yakut committed Jan 20, 2015
2 parents cdf31c3 + 4dac432 commit a55722c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Call/BaseCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BaseCall
protected $mode = 0; // Sandbox by default
protected $responseFormat = 'XML';
protected $keys = [];
protected $postFields;
protected $input;


public function __construct(array $parameters)
Expand Down Expand Up @@ -140,15 +140,15 @@ protected function getKeys()
* @param string $value
* @return $this
*/
public function setPostFields($value)
public function setInput($value)
{
$this->postFields = $value;
$this->input = $value;

return $this;
}

public function getPostFields()
public function getInput()
{
return $this->postFields;
return $this->input;
}
}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ $call
$service = $this->get('web_consul_ebay_api.make_call');
$output = $service->getResponse($call);
```
Typically, the query properties are set by the standard setter.
For more complex structures and containers created special types:

* WebConsul\EbayApiBundle\Type
* Affiliate
* AspectFilter
* ItemFilter
* NameValueList
* PaginationInput
* ProductID
* RequesterCredentials

Full documentation will be stored in the `Resources/doc/index.md`

Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Call/testCall.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% endfor %}

<h2>Input</h2>
{{ dump(call.postFields) }}
{{ dump(call.input) }}

<h2>Output</h2>
{% autoescape %}
Expand Down
6 changes: 3 additions & 3 deletions Service/MakeCallService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public function __construct(Serializer $serializer)

public function getResponse(BaseCall $call)
{
$postFields = $this->getPostFields($call);
$call->setPostFields($postFields);
$input = $this->getPostFields($call);
$call->setInput($input);
$ch = curl_init($call->getRequestUrl());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $call->getHeaders()); //set headers using the above array of headers
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
if (isset($call->parameters['timeout'])) {
curl_setopt($ch, CURLOPT_TIMEOUT, $call->parameters['timeout']);
}
Expand Down

0 comments on commit a55722c

Please sign in to comment.