README.md in deepl-rb-1.0.1 vs README.md in deepl-rb-2.0.0

- old
+ new

@@ -1,10 +1,10 @@ [![Gem Version](https://badge.fury.io/rb/deepl-rb.svg)](https://badge.fury.io/rb/deepl-rb) [![Dependency Status](https://gemnasium.com/badges/github.com/wikiti/deepl-rb.svg)](https://gemnasium.com/github.com/wikiti/deepl-rb) [![CircleCI](https://circleci.com/gh/wikiti/deepl-rb.svg?style=shield)](https://circleci.com/gh/wikiti/deepl-rb) [![CodeCov](https://codecov.io/gh/wikiti/deepl-rb/branch/master/graph/badge.svg?token=SHLgQNlZ4o)](https://codecov.io/gh/wikiti/deepl-rb) # DeepL for ruby -A simple ruby wrapper for the [DeepL translation API (v1)](https://www.deepl.com/docs/api-reference.html). +A simple ruby wrapper for the [DeepL translation API (v1)](https://www.deepl.com/api.html). ## Installation Install this gem with @@ -88,16 +88,37 @@ | `ES` | Spanish | `IT` | Italian | `NL` | Dutch | `PL` | Polish -You can also use custom query parameters, like `tag_handling`: +You can also use custom query parameters, like `tag_handling` or `split_sentences`: ```rb -translation = DeepL.translate '<p>A sample</p>', 'EN', 'ES', tag_handling: true +translation = DeepL.translate '<p>A sample</p>', 'EN', 'ES', + tag_handling: 'xml', split_sentences: false puts translation.text # => "<p>Una muestra</p>" +``` + +The following parameters will be automatically converted: + +| Parameter | Conversion +| --------------------- | --------------- +| `preserve_formatting` | Convertes `false` to `'0'` and `true` to `'1'` +| `split_sentences` | Convertes `false` to `'0'` and `true` to `'1'` + +### Usage + +To check current API usage, use: + +```rb +usage = DeepL.usage + +puts usage.character_count +# => 180118 +puts usage.character_limit +# => 1250000 ``` ### Handle exceptions You can capture and process exceptions that may be raised during API calls. These are all the possible exceptions: