tongues 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0ebfb2f5ac9c3aa1e4ac263b2edcf13949222bc
|
4
|
+
data.tar.gz: 5c714c36b58d490cd3e07b6e7136f2bd905fc836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5f8849b5cdab263b2b91a145cf1f47dc1e81682e8c0b2ece34d95a9a472f63909fce9b3124577a3581d98c3690cf33a91bd67f6c91c505f6b35b8d7481516cc
|
7
|
+
data.tar.gz: 91e8e069f0461640ba4f0549a29d54f23543cb3bd96157927e689af728fc032fa0e8b78c2315d4fc0a92b4f1bd8ed353fb36f50ec58672004959efb4071ff551
|
@@ -10,6 +10,8 @@ module Tongues
|
|
10
10
|
|
11
11
|
## Detects the language for the text in params
|
12
12
|
def detect(text)
|
13
|
+
raise NoApiKeyError, 'Invalid api key. Check config/initializers/tongues.rb' if Tongues::Configuration.api_key.blank?
|
14
|
+
|
13
15
|
response = call_api(text)
|
14
16
|
|
15
17
|
if detection = parse_response(response)
|
@@ -43,4 +45,7 @@ module Tongues
|
|
43
45
|
JSON.parse(response)['data']['detections'].first
|
44
46
|
end
|
45
47
|
end
|
48
|
+
|
49
|
+
class NoApiKeyError < StandardError
|
50
|
+
end
|
46
51
|
end
|
@@ -22,7 +22,7 @@ module Tongues
|
|
22
22
|
|
23
23
|
## Returns the api key
|
24
24
|
def api_key
|
25
|
-
@@api_key
|
25
|
+
@@api_key ||= ''
|
26
26
|
end
|
27
27
|
|
28
28
|
## Modifies the api_key
|
@@ -32,7 +32,7 @@ module Tongues
|
|
32
32
|
|
33
33
|
## Returns the api key
|
34
34
|
def self.api_key
|
35
|
-
@@api_key
|
35
|
+
@@api_key ||= ''
|
36
36
|
end
|
37
37
|
|
38
38
|
## Modifies the api_key
|
data/lib/tongues/version.rb
CHANGED