lbry.com/lib/thirdparty/LBRY.class.php
2017-12-13 11:03:39 -05:00

32 lines
No EOL
770 B
PHP

<?php
class LBRY
{
public static function getApiUrl($endpoint)
{
return Config::get('lbry_api_server') . $endpoint;
}
public static function getLBCtoUSDRate()
{
$response = CurlWithCache::get(static::getApiUrl('/lbc/exchange_rate'), [], [
'cache' => 3600, //one hour
'json_response' => true
]);
return $response['data']['lbc_usd'] ?? 0;
}
public static function subscribe($email, $tag = null)
{
return Curl::post(static::getApiUrl('/list/subscribe'), array_filter([
'email' => $email,
'tag' => $tag,
]), ['json_response' => true]);
}
public static function unsubscribe($email)
{
return Curl::post(static::getApiUrl('/list/unsubscribe'), ['email' => $email], ['json_response' => true]);
}
}