Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
This is the official Ruby SDK for the Currencycloud API. Additional documentation for each API endpoint can be found at developer.currencycloud.com.
If you have any queries or you require support, please contact our development team at development@currencycloud.com Please quote your login id in any correspondence as this makes it easier for us to locate your account and give you the support you need.
You don't need this source code unless you want to modify the gem. If you just want to use the library in your application, you should run:
gem install currency_cloud
If you want to build the gem from source:
gem build currency_cloud.gemspec
This library aims to support and is tested against the following Ruby implementations:
require 'currency_cloud'
## Configure ##
CurrencyCloud.login_id = '<your login id>'
CurrencyCloud.api_key = '<your api key>'
CurrencyCloud.environment = :demonstration # use :production when ready
## Make API calls ##
currencies = CurrencyCloud::Reference.currencies
#[#<CurrencyCloud::Currency:0x3fcb6d03960c {"code"=>"AED", "decimal_places"=>2, "name"=>"United Arab Emirates Dirham"}>,
# #<CurrencyCloud::Currency:0x3fcb6d0390f8 {"code"=>"AUD", "decimal_places"=>2, "name"=>"Australian Dollar"}>,
# #<CurrencyCloud::Currency:0x3fcb6d038d24 {"code"=>"CAD", "decimal_places"=>2, "name"=>"Canadian Dollar"}>,
# <snip .../>
# #<CurrencyCloud::Currency:0x3fcb6d0295b8 {"code"=>"TRY", "decimal_places"=>2, "name"=>"Turkish Lira"}>,
# #<CurrencyCloud::Currency:0x3fcb6d028fc8 {"code"=>"USD", "decimal_places"=>2, "name"=>"United States Dollar"}>,
# #<CurrencyCloud::Currency:0x3fcb6d0288d4 {"code"=>"ZAR", "decimal_places"=>2, "name"=>"South African Rand"}>]
balances = CurrencyCloud::Balance.find
#<CurrencyCloud::Balances:0x007f96da812838
# @collection=
# [#<CurrencyCloud::Balance:0x3fcb6d4093b8 {"id"=>"5a998e06-3eb7-46d6-ba58-f749864159ce", "account_id"=>"e7483671-5dc6-0132-e126-002219414986", "currency"=>"GBP", "amount"=>"20034.78", "created_at"=>"2014-12-04T09:50:35+00:00", "updated_at"=>"2015-03-23T14:33:37+00:00"}>,
# #<CurrencyCloud::Balance:0x3fcb6d4089b8 {"id"=>"7b3796d0-35f3-4f47-8554-8020750a8f9d", "account_id"=>"e7483671-5dc6-0132-e126-002219414986", "currency"=>"EUR", "amount"=>"3012.16", "created_at"=>"2014-12-04T09:50:41+00:00", "updated_at"=>"2015-04-13T08:22:50+00:00"}>,
# @pagination=
# #<CurrencyCloud::Pagination total_entries=5, total_pages=1, current_page=1, per_page=25, previous_page=-1, next_page=-1, order="created_at", order_asc_desc="asc">>
If you want to make calls on behalf of another user (e.g. someone who has a sub-account with you), you can execute certain commands 'on behalf of' the user's contact_id. Here is an example:
CurrencyCloud.on_behalf_of("c6ece846-6df1-461d-acaa-b42a6aa74045") do
beneficiary = CurrencyCloud::Beneficiary.create(<params>)
conversion = CurrencyCloud::Conversion.create(<params>)
payment = CurrencyCloud::Payment.create(<params>)
end
Alternatively, you can just merge it with an existing params Hash
, for example:
CurrencyCloud::Account.create(account_name: 'My Test User', on_behalf_of: "c6ece846-6df1-461d-acaa-b42a6aa74045")
Each of the above transactions will be executed in scope of the limits for that contact and linked to that contact. Note that the real user who executed the transaction will also be stored.
When an error occurs in the API, the library aims to give us much information as possible. Here is an example:
CurrencyCloud::BadRequestError
---
platform: Ruby 1.9.3
request:
parameters:
login_id: non-existent-login-id
api_key: deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
verb: post
url: https://devapi.currencycloud.com/v2/authenticate/api
response:
status_code: 400
date: Wed, 29 Apr 2015 22:46:53 GMT
request_id: 2775253392756800903
errors:
- field: api_key
code: api_key_length_is_invalid
message: api_key should be 64 character(s) long
params:
length: 64
This is split into 5 sections:
BadRequestError
represents an HTTP 400 errorThe final section contains valuable information:
When troubleshooting API calls with Currencycloud support, including the full error in any correspondence can be very helpful.
Test cases can be run with: bundle exec rspec
. There is also a Guardfile
that
is useful for continuously rerunning tests while you develop.
We welcome pull requests from everyone! Please see CONTRIBUTING
Our sincere thanks for helping us create the best API for moving money anywhere around the world!
This project uses semantic versioning. You can safely express a dependency on a major version and expect all minor and patch versions to be backwards compatible.
Technology evolves quickly and we are always looking for better ways to serve our customers. From time to time we need to make room for innovation by removing sections of code that are no longer necessary. We understand this can be disruptive and consequently we have designed a Deprecation Policy that protects our customers' investment and that allows us to take advantage of modern tools, frameworks and practices in developing software.
Deprecation means that we discourage the use of a feature, design or practice because it has been superseded or is no longer considered efficient or safe but instead of removing it immediately, we mark it as @deprecated to provide backwards compatibility and time for you to update your projects. While the deprecated feature remains in the SDK for a period of time, we advise that you replace it with the recommended alternative which is explained in the relevant section of the code.
We remove deprecated features after three months from the time of announcement.
The security of our customers' assets is of paramount importance to us and sometimes we have to deprecate features because they may pose a security threat or because new, more secure, ways are available. On such occasions we reserve the right to set a different deprecation period which may range from immediate removal to the standard three months.
Once a feature has been marked as deprecated, we no longer develop the code or implement bug fixes. We only do security fixes.
(No features are currently being deprecated)
We actively support the latest version of the SDK. We support the immediate previous version on best-efforts basis. All other versions are no longer supported nor maintained.
Copyright (c) 2016-2019 Currencycloud. See LICENSE for details.
FAQs
Unknown package
We found that currency_cloud demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.