Comments (8)
@maennchen it's possible hence the question from the beggining. Actually now in iex
console this is looking good. Let me find the culprit and don't waste your time for now. I would come back to close it.
from currency-conversion.
@strzibny you have to configure it as config :[your_app_name], [YourCurrencyModule], source: [SourceModule]
.
Since you defined your module as CurrencyExchange
and not `MyProject.CurrencyExchange your second code example is correct.
from currency-conversion.
@maennchen That was just copy & edit mistake. Neither variant seems to work for me. I always get the exchange rates from the default source
.
from currency-conversion.
@strzibny Can you IO.inspect
what is in config
here: https://github.com/jshmrtn/currency-conversion/blob/master/lib/currency_conversion.ex#L117 ?
from currency-conversion.
It's
[
base_currency: :USD,
source_protocol: "https",
source: CurrencyConversion.Source.Test,
refresh_interval: :manual,
seed: &MyProject.CurrencyExchange.seed/1
]
So the configuration seems correct.
from currency-conversion.
So the problem is in using seed
which is preferred. I don't think this is right. Seed is for populating initial data, but not for updates.
# in update_worker.ex
defp refresh(opts, load_callback \\ &load_from_source/1) do
load_callback
would be the seed function.
from currency-conversion.
@strzibny The seed
is only called on init
, not for manual / automatic refreshes: https://github.com/jshmrtn/currency-conversion/blob/master/lib/currency_conversion/update_worker.ex#L30
I'll do some testing on my own soon. But I honestly think that you're configuring something wrong since a lot of the tests depend on setting a different source: https://github.com/jshmrtn/currency-conversion/blob/master/test/currency_conversion_test.exs#L17
from currency-conversion.
Ya, I made mistake in some tests and it was ordered dependent. Probably all is well. Sorry about the noise.
from currency-conversion.
Related Issues (9)
- Provide a way to use ex_money with this library HOT 2
- Working with Decimals? HOT 1
- Getting the error - function CurrencyConversion.__using__/1 is undefined or private HOT 1
- Expected behaviour on invalid API key HOT 6
- It is not possible to start the application when source API is down HOT 4
- Add compatibility with phoenix 1.4
- Ability to avoid refresh on start? HOT 12
- Use ETS to store rates instead of GenServer state HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from currency-conversion.