yandex-translator-api 0.9.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -7
- data/lib/yandex/translator/detect.rb +1 -1
- data/lib/yandex/translator/translate.rb +1 -1
- data/lib/yandex/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d9608bcfdc944f75b0b5f4df553b3db20cef4a
|
4
|
+
data.tar.gz: ead7ffaf10b823fa0fae61c843374c37fedcef42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67c3ed3b8634f8f1108e6d0a495f97555fe6a16ee84c9308a2d23cb7778385e8ac6c9bc5cff63c8f2dba55a888320f0cb23f1240b807c229601008a30f3681a2
|
7
|
+
data.tar.gz: 43d444a507b52c87a0f588c7421be5835994360fb51b0a40f8f5cc325a1b7558d4e4b938a5ae3c0d4fddcc781a5ffe62b4182a63e5c87a2bf3a2f823f698e027
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Yandex Translator API
|
2
2
|
|
3
|
-
|
3
|
+
Text translating by Yandex Translator API
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -20,20 +20,51 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
Create Translator object.
|
24
24
|
|
25
|
-
|
25
|
+
```ruby
|
26
|
+
translator = Yandex::Translator.new('api_key')
|
27
|
+
```
|
28
|
+
|
29
|
+
### Langs
|
30
|
+
|
31
|
+
Request for getting possible translation directions is #langs.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
translator.langs
|
35
|
+
```
|
36
|
+
|
37
|
+
It returns array of possible translations or error.
|
38
|
+
|
39
|
+
### Detect
|
40
|
+
|
41
|
+
Request for detecting language of the text is #detect.
|
26
42
|
|
27
|
-
|
43
|
+
```ruby
|
44
|
+
translator.detect text: 'Hello', hint: 'en,de'
|
45
|
+
```
|
46
|
+
|
47
|
+
It returns locale of the text or error.
|
48
|
+
text - text for detecting, required param
|
49
|
+
hint - list of possible languages
|
50
|
+
|
51
|
+
### Translate
|
52
|
+
|
53
|
+
Request for translating of the text is #translate.
|
28
54
|
|
29
|
-
|
55
|
+
```ruby
|
56
|
+
translator.translate text: 'Hello', from: 'en', to: 'ru'
|
57
|
+
```
|
58
|
+
|
59
|
+
It returns translated text or error.
|
60
|
+
text - text for detecting, required param
|
61
|
+
from - language of the text
|
62
|
+
to - translating direction, required param
|
30
63
|
|
31
64
|
## Contributing
|
32
65
|
|
33
66
|
Bug reports and pull requests are welcome on GitHub at https://github.com/kortirso/yandex-translator-api.
|
34
67
|
|
35
|
-
|
36
68
|
## License
|
37
69
|
|
38
70
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
39
|
-
|
@@ -2,7 +2,7 @@ module Yandex
|
|
2
2
|
class Translator
|
3
3
|
module Translate
|
4
4
|
|
5
|
-
def translate(args)
|
5
|
+
def translate(args = {})
|
6
6
|
check_args(text: args[:text], to: args[:to])
|
7
7
|
translate_direction = args[:from].nil? ? args[:to] : "#{args[:from]}-#{args[:to]}"
|
8
8
|
response = call('/translate', { lang: translate_direction, text: args[:text] })
|
data/lib/yandex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yandex-translator-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Bogdanov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|