Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when calling the update_rates method #10

Closed
cristielciu opened this issue Jun 23, 2022 · 6 comments
Closed

Error when calling the update_rates method #10

cristielciu opened this issue Jun 23, 2022 · 6 comments

Comments

@cristielciu
Copy link

I'm getting this error when I try to call update_rates with a valid API Access Key

Traceback (most recent call last):
        1: from (irb):24
Money::Bank::Error (You have not supplied a valid API Access Key. [Technical Support: support@apilayer.com])

I think this is due to a change in the currency layer API endpoint
More details here

If my investigation is right then the fix should be a quick one
Just update https://github.com/phlegx/money-currencylayer-bank/blob/master/lib/money/bank/currencylayer_bank.rb#L34 with

CL_URL = 'api.apilayer.com/currency_data/live'.freeze

and https://github.com/phlegx/money-currencylayer-bank/blob/master/lib/money/bank/currencylayer_bank.rb#L243 with

URI.open(source_url, "apikey" => access_key).read
@phlegx
Copy link
Owner

phlegx commented Jun 23, 2022

Like described in the documentation, the endpoint is correct: https://currencylayer.com/documentation

See my last commit in master. I have changed http to https. Can you give it a try please?

@phlegx
Copy link
Owner

phlegx commented Jun 23, 2022

This gem works only with API access keys created on https://currencylayer.com. New created API access keys from https://apilayer.com do not work with this gem. I will release a new version that support both endpoints.

@blazeblazeblaze
Copy link

Hi @phlegx . We're getting Money::Bank::Error: Access Restricted - Your current Subscription Plan does not support HTTPS Encryption. errors when using a free plan. The assumption is that the free plan doesn't support HTTPs, perhaps this should be configurable. In a meantime, we downgraded which resolved this issue.

@pradosh987
Copy link

Hi @phlegx
Shouldn't it be http as default value for CL_URL which was changed in this commit 63d86f7. Otherwise setting secure_connection = false will get ignored and this will have no effect because CL_URL always starts with https

 CL_URL = 'https://api.currencylayer.com/live'.freeze
  # CurrencylayerBank secure url
  CL_SECURE_URL = CL_URL.sub('http:', 'https:')     

@phlegx
Copy link
Owner

phlegx commented Jul 27, 2022

@blazeblazeblaze @pradosh987 thats true. I rewrite the gem to support the new and the old endpoints soon as possible.

@phlegx
Copy link
Owner

phlegx commented Aug 25, 2022

Released v0.7.0 🎉

# (optional)
# Use the old endpoint api.currencylayer.com. By default, the new endpoint is used.
mclb.currencylayer = true

@phlegx phlegx closed this as completed Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants