项目作者: XenonLab

项目描述 :
REST Client
高级语言: Java
项目地址: git://github.com/XenonLab/xecd-rates-client-java.git
创建时间: 2017-09-14T19:26:23Z
项目社区:https://github.com/XenonLab/xecd-rates-client-java

开源协议:Mozilla Public License 2.0

下载






XE Currency Data Client - Java

XE.com Inc. is the World’s Trusted Currency Authority. This project provides an SDK to interface with our XE Currency Data (XECD) product.

XE Currency Data is a REST API that gives you access to live and historic mid-market exchange rates between all of our supported currencies.

You will need an api key and secret to use this SDK. Sign up for a free trial or register for a full account.

Installation

The preferred way to install this package is from Maven Central.

To add a dependency on XECD Rates Client using Maven, use the following:

  1. <dependency>
  2. <groupId>com.xe.xecd</groupId>
  3. <artifactId>xecd-rates-client</artifactId>
  4. <version>0.1</version>
  5. </dependency>

To add a dependency using Gradle:

  1. dependencies {
  2. compile 'com.xe.xecd:xecd-rates-client:0.1.+'
  3. }

This package follows semantic versioning.

Usage

  1. package com.example;
  2. import com.xe.xecdApiClient.model.HistoricRatesResponse;
  3. import com.xe.xecdApiClient.config.XecdApiConfigBean;
  4. import com.xe.xecdApiClient.service.XecdApiService;
  5. import com.xe.xecdApiClient.service.XecdApiServiceFactory;
  6. public class Main
  7. {
  8. private XecdApiService apiService;
  9. public void main() throws XecdApiException
  10. {
  11. XecdApiConfigBean config = new XecdApiConfigBean();
  12. config.setAccountId("<YOUR_ACCOUNT_ID>");
  13. config.setApiKey("<YOUR_API_KEY>");
  14. apiService = XecdApiServiceFactory.createXecdAPIService(config);
  15. try {
  16. HistoricRateResponse historicRateResponse = apiService.historicRate("CAD", "USD,GBP", "2017-09-14", null, 1.00, false, false);
  17. }
  18. catch(XecdApiException e)
  19. {
  20. System.out.println(e.getMessage());
  21. }
  22. }
  23. }

Documentation

Technical Specifications

Contributing

xecd-rates-client-java is an open-source project. Submit a pull request to contribute!

Testing

  1. cd xecd-rates-client-java
  2. # Unit tests.
  3. ./gradlew test
  4. # Integration tests.
  5. export XECD_ACCOUNT_ID=<YOUR_ACCOUNT_ID>
  6. export XECD_API_KEY=<YOUR_API_KEY>
  7. ./gradlew test

Security Issues

If you discover a security vulnerability within this package, please DO NOT publish it publicly. Instead, contact us at security [at] xe.com. We will follow up with you as soon as possible.

About Us

XE.com Inc. is The World’s Trusted Currency Authority. Development of this project is led by the XE.com Inc. Development Team and supported by the open-source community.