Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/newapplesho/currencylayer-api-smalltalk

Pharo Smalltalk wrapper for currencylayer API
https://github.com/newapplesho/currencylayer-api-smalltalk

currency-api pharo smalltalk

Last synced: 6 days ago
JSON representation

Pharo Smalltalk wrapper for currencylayer API

Awesome Lists containing this project

README

        

# currencylayer-api-smalltalk [![Build Status](https://travis-ci.org/newapplesho/currencylayer-api-smalltalk.svg?branch=master)](https://travis-ci.org/newapplesho/currencylayer-api-smalltalk)

Pharo Smalltalk wrapper for [currencylayer API](https://currencylayer.com).

## Supported Smalltalk Versions
[Pharo Smalltalk](http://pharo.org/) 4.0, 5.0, 6.0, 6.1

## Installation

```smalltalk
Metacello new
baseline: 'Currencylayer';
repository: 'github://newapplesho/currencylayer-api-smalltalk:v0.1/pharo-repository';
load.
```

## Set up
```smalltalk
CurrencylayerSettings default accessKey:'Your API Access Key'.
```

HTTPS Encryption

```smalltalk
"Subscription: Free"
CurrencylayerSettings default useSSL: false.

"Subscription: Basic, Pro, Enterprise"
CurrencylayerSettings default useSSL: true.
```

## Usage
You can read official documentation [here](https://currencylayer.com/documentation).

### Real-time Rates

```smalltalk
currencylayer := Currencylayer new.
currencylayer live:#('AUD' 'EUR' 'GBP' 'PLN').
```

### Source Currency Switching

```smalltalk
currencylayer := Currencylayer new.
currencylayer sourceCurrency: 'JPY'.
```

### Currency Conversion Endpoint

```smalltalk
currencylayer := Currencylayer new.
currencylayer convert: 100 from: 'JPY' to: 'USD'. "print it"
```

Example response

```json
{
"privacy": "https:\/\/currencylayer.com\/privacy",
"success": true,
"info": {
"timestamp": 1462096813,
"quote": 0.009402
},
"query": {
"to": "USD",
"from": "JPY",
"amount": 100
},
"terms": "https:\/\/currencylayer.com\/terms",
"result": 0.9402
}
```