mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 13:36:15 +00:00
Lots of new code for the Spectre routine.
This commit is contained in:
@@ -49,6 +49,40 @@ class Account extends SpectreObject
|
||||
/** @var Carbon */
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNature(): string
|
||||
{
|
||||
return $this->nature;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getBalance(): float
|
||||
{
|
||||
return $this->balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrencyCode(): string
|
||||
{
|
||||
return $this->currencyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtra(): array
|
||||
{
|
||||
return $this->extra;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Account constructor.
|
||||
*
|
||||
|
||||
@@ -68,6 +68,49 @@ class Login extends SpectreObject
|
||||
/** @var Carbon */
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCountryCode(): string
|
||||
{
|
||||
return $this->countryCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getLastSuccessAt(): Carbon
|
||||
{
|
||||
return $this->lastSuccessAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderName(): string
|
||||
{
|
||||
return $this->providerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus(): string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getUpdatedAt(): Carbon
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Login constructor.
|
||||
*
|
||||
@@ -129,7 +172,7 @@ class Login extends SpectreObject
|
||||
'id' => $this->id,
|
||||
'last_attempt' => $this->lastAttempt->toArray(),
|
||||
'last_success_at' => $this->lastSuccessAt->toIso8601String(),
|
||||
'next_refresh_possible_at' => $this->nextRefreshPossibleAt,
|
||||
'next_refresh_possible_at' => $this->nextRefreshPossibleAt->toIso8601String(),
|
||||
'provider_code' => $this->providerCode,
|
||||
'provider_id' => $this->providerId,
|
||||
'provider_name' => $this->providerName,
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Request;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Services\Spectre\Object\Customer;
|
||||
use FireflyIII\Services\Spectre\Object\Login;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -64,12 +65,19 @@ class ListLoginsRequest extends SpectreRequest
|
||||
} else {
|
||||
Log::debug('No next page.');
|
||||
}
|
||||
|
||||
$collection = new Collection;
|
||||
// store logins:
|
||||
/** @var array $loginArray */
|
||||
foreach ($response['data'] as $loginArray) {
|
||||
$this->logins[] = new Login($loginArray);
|
||||
$collection->push(new Login($loginArray));
|
||||
}
|
||||
// sort logins by date created:
|
||||
$sorted = $collection->sortByDesc(
|
||||
function (Login $login) {
|
||||
return $login->getUpdatedAt()->timestamp;
|
||||
}
|
||||
);
|
||||
$this->logins = $sorted->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user