Update other services
This commit is contained in:
parent
e1e4c2e9d6
commit
f8d31ac40a
|
@ -3,33 +3,20 @@
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\Model\Tweet;
|
use App\Model\Tweet;
|
||||||
use Codebird\Codebird;
|
|
||||||
|
|
||||||
class Retweeter
|
class Retweeter
|
||||||
{
|
{
|
||||||
|
/** @var \App\Service\Codebird */
|
||||||
private $codebird;
|
private $codebird;
|
||||||
|
|
||||||
public function __construct(Codebird $codebird)
|
public function __construct(Codebird $codebird)
|
||||||
{
|
{
|
||||||
$codebird::setConsumerKey(
|
|
||||||
getenv('TWITTER_CONSUMER_KEY'),
|
|
||||||
getenv('TWITTER_CONSUMER_SECRET')
|
|
||||||
);
|
|
||||||
|
|
||||||
$codebird = $codebird::getInstance();
|
|
||||||
|
|
||||||
$codebird->setToken(
|
|
||||||
getenv('TWITTER_ACCESS_TOKEN'),
|
|
||||||
getenv('TWITTER_ACCESS_SECRET')
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->codebird = $codebird;
|
$this->codebird = $codebird;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function retweet(Tweet $tweet): void
|
public function retweet(Tweet $tweet): void
|
||||||
{
|
{
|
||||||
$this->codebird->statuses_retweet_ID([
|
$this->codebird->get()->statuses_retweet_ID([
|
||||||
'id' => $tweet->getId(),
|
'id' => $tweet->getId(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\Model\Tweet;
|
use App\Model\Tweet;
|
||||||
use Codebird\Codebird;
|
|
||||||
use Tightenco\Collect\Support\Collection;
|
use Tightenco\Collect\Support\Collection;
|
||||||
|
|
||||||
class TweetFetcher
|
class TweetFetcher
|
||||||
{
|
{
|
||||||
/** @var \Codebird\Codebird */
|
/** @var \App\Service\Codebird */
|
||||||
private $codebird;
|
private $codebird;
|
||||||
|
|
||||||
private $accounts = [
|
private $accounts = [
|
||||||
|
@ -30,24 +29,12 @@ class TweetFetcher
|
||||||
|
|
||||||
public function __construct(Codebird $codebird)
|
public function __construct(Codebird $codebird)
|
||||||
{
|
{
|
||||||
$codebird::setConsumerKey(
|
|
||||||
getenv('TWITTER_CONSUMER_KEY'),
|
|
||||||
getenv('TWITTER_CONSUMER_SECRET')
|
|
||||||
);
|
|
||||||
|
|
||||||
$codebird = $codebird::getInstance();
|
|
||||||
|
|
||||||
$codebird->setToken(
|
|
||||||
getenv('TWITTER_ACCESS_TOKEN'),
|
|
||||||
getenv('TWITTER_ACCESS_SECRET')
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->codebird = $codebird;
|
$this->codebird = $codebird;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTweets(): Collection
|
public function getTweets(): Collection
|
||||||
{
|
{
|
||||||
$response = collect($this->codebird->search_tweets([
|
$response = collect($this->codebird->get()->search_tweets([
|
||||||
'q' => collect($this->params()->all())->implode(' AND '),
|
'q' => collect($this->params()->all())->implode(' AND '),
|
||||||
// 'since_id' => $this->lastTweetId,
|
// 'since_id' => $this->lastTweetId,
|
||||||
]));
|
]));
|
||||||
|
|
Loading…
Reference in a new issue