{"id":21567460,"url":"https://github.com/szajbus/money-exchange","last_synced_at":"2026-05-18T11:02:49.737Z","repository":{"id":56884306,"uuid":"150022325","full_name":"szajbus/money-exchange","owner":"szajbus","description":"Money gem integration with Open Exchange Rates API.","archived":false,"fork":false,"pushed_at":"2018-09-24T08:02:57.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T01:17:04.125Z","etag":null,"topics":["money","openexchangerates","oxr","rails","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szajbus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-23T20:22:52.000Z","updated_at":"2018-10-05T21:34:12.000Z","dependencies_parsed_at":"2022-08-20T23:40:40.942Z","dependency_job_id":null,"html_url":"https://github.com/szajbus/money-exchange","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/szajbus/money-exchange","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szajbus%2Fmoney-exchange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szajbus%2Fmoney-exchange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szajbus%2Fmoney-exchange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szajbus%2Fmoney-exchange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szajbus","download_url":"https://codeload.github.com/szajbus/money-exchange/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szajbus%2Fmoney-exchange/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265407816,"owners_count":23760066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["money","openexchangerates","oxr","rails","ruby"],"created_at":"2024-11-24T10:31:01.040Z","updated_at":"2026-05-18T11:02:44.704Z","avatar_url":"https://github.com/szajbus.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MoneyExchange\n\nMoney gem integration with Open Exchange Rates API.\n\nDevelopment goals:\n\n* seamless integration with `money` gem\n* flexible caching\n* Open Exchange Rates API quota protection\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'money-exchange'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install money-exchange\n\n## Usage\n\nCreate and configure `MoneyExchange::Bank` and set it as `Money.default_bank`.\n\n```ruby\nrequire 'money_exchange'\n\nbank = MoneyExchange::Bank.new(\n  client: MoneyExchange::Client::OXR.new(ENV['OXR_APP_ID']),\n  ttl: 24 * 60 * 60\n)\n\nMoney.default_bank = bank\n```\n\nIt will make `Money` use it transparently for currency conversion.\n\n```ruby\nMoney.new(10000, 'USD').exchange_to('EUR')\n# =\u003e #\u003cMoney fractional:85 currency:EUR\u003e\n```\n\n### Caching\n\nExchange rates are cached internally on the rates store level for the number of seconds set with `ttl` option (defaults to 24 hours). If you want to use external cache store, e.g. the same as used in your Rails application, provide it as `cache_store` option.\n\n```ruby\nMoneyExchange::Bank.new(\n  cache_store: Rails.cache,\n  ttl: 12 * 60 * 60\n)\n```\n\n### Open Exchange Rates API limits\n\nOXR imposes usage limits in their API. In order to protect your quota, don't use the actual API in `development` or `test` environments. Instead configure the bank to use the local client preloaded with locally cached (sample) data.\n\nJust save a response from https://openexchangerates.org/api/latest.json?app_id=OXR_APP_ID locally and load it when configuring the bank.\n\n```ruby\ndata = JSON.parse(File.read(\"path/to/oxr-response.json\"))\n\nMoneyExchange::Bank.new(\n  client: MoneyExchange::Client::Local.new(data)\n)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/szajbus/money-exchange. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the MoneyExchange project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/money-exchange/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszajbus%2Fmoney-exchange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszajbus%2Fmoney-exchange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszajbus%2Fmoney-exchange/lists"}