|
1 | | -# xecd-rates-client-java |
2 | | -XECD REST Client |
| 1 | +<p align=""> |
| 2 | + <a href="http://www.xe.com" target="_blank"> |
| 3 | + <img src="https://upload.wikimedia.org/wikipedia/en/5/55/XE_Corporation_logo.png" width="90" height="72"/> |
| 4 | + </a> |
| 5 | +</p> |
| 6 | + |
| 7 | +# XE Currency Data Client - Java |
| 8 | + |
| 9 | +XE.com Inc. is the World's Trusted Currency Authority. This project provides an SDK to interface with our XE Currency Data (XECD) product. |
| 10 | + |
| 11 | +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. |
| 12 | + |
| 13 | +You will need an api key and secret to use this SDK. Sign up for a [free trial][5] or register for a [full account][6]. |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +The preferred way to install this package is by cloning it from github and building it locally. This package uses the [gradle][4] build system. |
| 18 | + |
| 19 | +```bash |
| 20 | +cd xecd-rates-client-java |
| 21 | +./gradlew publishToMavenLocal |
| 22 | +``` |
| 23 | + |
| 24 | +To add a dependency on XECD Rates Client using Maven, use the following: |
| 25 | + |
| 26 | +```xml |
| 27 | +<dependency> |
| 28 | + <groupId>com.xe.xecd</groupId> |
| 29 | + <artifactId>xecd-rates-client</artifactId> |
| 30 | + <version>0.1</version> |
| 31 | +</dependency> |
| 32 | +``` |
| 33 | + |
| 34 | +To add a dependency using Gradle: |
| 35 | + |
| 36 | +```groovy |
| 37 | +dependencies { |
| 38 | + compile 'com.xe.xecd:xecd-rates-client:0.1.+' |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +This package follows [semantic versioning][3]. |
| 43 | + |
| 44 | +## Usage |
| 45 | + |
| 46 | +```java |
| 47 | +package com.example; |
| 48 | + |
| 49 | +import com.xe.xecdApiClient.model.HistoricRatesResponse; |
| 50 | +import com.xe.xecdApiClient.config.XecdApiConfigBean; |
| 51 | +import com.xe.xecdApiClient.service.XecdApiService; |
| 52 | +import com.xe.xecdApiClient.service.XecdApiServiceFactory; |
| 53 | + |
| 54 | +public class Main |
| 55 | +{ |
| 56 | + private XecdApiService apiService; |
| 57 | + |
| 58 | + public void main() throws XecdApiException |
| 59 | + { |
| 60 | + XecdApiConfigBean config = new XecdApiConfigBean(); |
| 61 | + config.setAccountId("<YOUR_ACCOUNT_ID>"); |
| 62 | + config.setApiKey("<YOUR_API_KEY>"); |
| 63 | + apiService = XecdApiServiceFactory.createXecdAPIService(config); |
| 64 | + |
| 65 | + try { |
| 66 | + HistoricRatesResponse historicRatesResponse = apiService.historicRate("CAD", "USD,GBP", "2017-09-14", null, 1.00, false, false); |
| 67 | + } |
| 68 | + catch(XecdApiException e) |
| 69 | + { |
| 70 | + System.out.println(e.getMessage()); |
| 71 | + } |
| 72 | + } |
| 73 | +} |
| 74 | +``` |
| 75 | + |
| 76 | +## Documentation |
| 77 | + |
| 78 | +[Technical Specifications][2] |
| 79 | + |
| 80 | +## Contributing |
| 81 | + |
| 82 | +xecd-rates-client-java is an open-source project. Submit a pull request to contribute! |
| 83 | + |
| 84 | +## Testing |
| 85 | + |
| 86 | +```bash |
| 87 | +cd xecd-rates-client-java |
| 88 | + |
| 89 | +# Unit tests. |
| 90 | +./gradlew test |
| 91 | + |
| 92 | +# Integration tests. |
| 93 | +export XECD_ACCOUNT_ID=<YOUR_ACCOUNT_ID> |
| 94 | +export XECD_API_KEY=<YOUR_API_KEY> |
| 95 | +./gradlew test |
| 96 | +``` |
| 97 | + |
| 98 | +## Security Issues |
| 99 | + |
| 100 | +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. |
| 101 | + |
| 102 | +## About Us |
| 103 | + |
| 104 | +[XE.com Inc.][1] 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. |
| 105 | + |
| 106 | +[1]: http://www.xe.com |
| 107 | +[2]: http://www.xe.com/xecurrencydata/XE_Currency_Data_API_Specifications.pdf |
| 108 | +[3]: http://semver.org/ |
| 109 | +[4]: https://gradle.org/ |
| 110 | +[5]: https://xecd.xe.com/account/signup.php?freetrial |
| 111 | +[6]: http://www.xe.com/xecurrencydata/ |
0 commit comments