Skip to content

Commit

Permalink
Merge pull request #3 from dhritimanrick/patch-1
Browse files Browse the repository at this point in the history
Update Currency.php
  • Loading branch information
msonowal authored Jun 4, 2018
2 parents c5dae91 + cf1411b commit 395993d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

class Currency
{
private $client, $base_currency, $cache_key, $rates;
const DEFAULT_API_URL = 'http://api.fixer.io/latest?base=';
private $client, $base_currency, $cache_key, $rates , $api_key;
const DEFAULT_API_URL = 'http://api.fixer.io/latest?';
public $api_url;
public $cache_expiry;

public function __construct($base_currency = null)
{
{
$this->client = new Client();
$this->cache_expiry = config('currency.cache_expiry');
$this->cache_key = config('currency.cache_key');
$this->api_key = config('currency.api_key');
$this->setBaseCurrency($base_currency);
if (!$this->isRatesSameAsBaseCurrency()) {
$this->updateRates();
Expand All @@ -38,7 +39,7 @@ public function getCacheKey()
}
public function getApiUrl()
{
return self::DEFAULT_API_URL.$this->base_currency;
return self::DEFAULT_API_URL.'&access_key='.$this->api_key.'&base='.$this->base_currency;
}
public function setBaseCurrency($currency_code = null)
{
Expand Down

0 comments on commit 395993d

Please sign in to comment.