Skip to content

Commit

Permalink
Fix url
Browse files Browse the repository at this point in the history
Remove unnecessary lines
Edit readme
  • Loading branch information
AliAkbar committed Apr 30, 2019
1 parent 48dfd62 commit cff9ee8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ End with an example of getting some data out of the system or using it for a lit
## Example
```php
$api->sendTextMessage('Message','to channel name without at sign')
$api->sendPhotoMessage('filepath,'to channel name without at sign','Caption')
$api->sendVideoMessage('filepath,'to channel name without at sign','Caption')
$api->sendPhotoMessage($filepath,'to channel name without at sign','Caption')
$api->sendVideoMessage($filepath,'to channel name without at sign','Caption')
```

## Contributing
Expand Down
12 changes: 5 additions & 7 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
use BaleBot\Model\GetFileUploadUrl;
use BaleBot\Model\Helper\PhotoHelper;
use BaleBot\Model\Helper\VideoHelper;
use BaleBot\Model\Message\Text;
use BaleBot\Model\SendPhotoMessage;
use BaleBot\Model\SendTextMessage;
use BaleBot\Model\SendVideoMessage;
use BaleBot\Model\Thumb;
use BaleBot\Response\FileUrlResponse;
use BaleBot\Response\SendMessageResponse;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;

class Api
{
const URL = "https://apitest.bale.ai/v1/bots/http/";
const URL = "https://apitest.bale.ai/v1/bots/http/sendMessage/";

private $_token;

Expand Down Expand Up @@ -97,7 +95,7 @@ public function sendPhotoMessage($filename, $nickName, $caption = null)
{
$message->message->caption->text = $caption;
}
echo Request::make('messaging', $message)->asJson();

return Request::make('messaging', $message)->response($this, SendMessageResponse::class)->body;
}

Expand Down Expand Up @@ -128,7 +126,7 @@ public function sendVideoMessage($filename, $nickName, $caption = null)
{
$message->message->caption->text = $caption;
}
echo Request::make('messaging', $message)->asJson();

return Request::make('messaging', $message)->response($this, SendMessageResponse::class)->body;
}

Expand All @@ -144,9 +142,9 @@ public function uploadFile($filename)
$upload->size = filesize($filename);

$uploadUrl = Request::make('files', $upload)->response($this, FileUrlResponse::class)->body;
var_dump($uploadUrl);
$r = $this->putFile($uploadUrl, $filename);

$r = $this->putFile($uploadUrl, $filename);
// #todo check $r return value
return $uploadUrl;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function asArray()
public static function fromArray($data, $body = null)
{
$request = parent::fromArray($data);

/* @var $request Response */
if ($body)
{
$request->_attributes['body'] = new $body($request->_attributes['body']);
Expand Down

0 comments on commit cff9ee8

Please sign in to comment.