New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

google_currency_rails_cache

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google_currency_rails_cache

  • 1.2
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Google Currency with Rails Cache

This gem extends Money::Bank::VariableExchange with Money::Bank::GoogleCurrency and gives you access to the current Google Currency exchange rates.

You have to load one of the JSON libraries supported by MultiJSON (json for example) if it's not already loaded by your application. In a Rails application, ActiveSupport provides a JSON implementation that is automatically recognized.

This fork of the original GoogleCurrency library uses the Rails.cache for exchange rate storage instead of a Mutex. It is designed for multiple application server environments.

Usage

require 'money'
require 'money/bank/google_currency'
require 'json'
MultiJson.engine = :json_gem # or :yajl

# set default bank to instance of GoogleCurrency
Money.default_bank = Money::Bank::GoogleCurrency.new

# create a new money object, and use the standard #exchange_to method
n = 1.to_money(:USD)
n.exchange_to(:EUR)

An UnknownRate will be thrown if #exchange_to is called with a Currency that Money knows, but Google does not.

An UnknownCurrency will be thrown if #exchange_to is called with a Currency that Money does not know.

Original Google Currency work is Copyright (c) 2011 Shane Emmons. See {file:LICENSE} for details.

FAQs

Package last updated on 16 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc