languagedetection 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1b0d9f4fad912abdadadaf931c77c9bbf2358c9
|
4
|
+
data.tar.gz: 923dc4555969850bd6d31d6c6f55ab0cb9c386b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30eeed8ab17d111334cc3ad668ed0cd49c820d7d7553949117f1183802256f8fb5eeb682aa3a59c00ae69b467d90a565acc3ae6c6bdd62fb69dcdc7a8b3d3c9c
|
7
|
+
data.tar.gz: 918473e92cf60da7967b1273527b3a27c632d9d433abc8b24f6e09ca4b31385d81f633633301093f18623f606d0caf620b7dc8ea88da245cf38d29c6312bc582
|
data/README.md
CHANGED
@@ -300,7 +300,7 @@ Stay up to date by following [@apilayernet](https://twitter.com/apilayernet) on
|
|
300
300
|
|
301
301
|
## Legal
|
302
302
|
|
303
|
-
All usage of the languagelayer website, API, and services is subject to the [
|
303
|
+
All usage of the languagelayer website, API, and services is subject to the [languagelayer Terms & Conditions](https://languagelayer.com/terms) and all annexed legal documents and agreements.
|
304
304
|
|
305
305
|
---
|
306
306
|
|
data/lib/language_detection.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "uri"
|
1
2
|
require "httparty"
|
2
3
|
require "hashable"
|
3
4
|
require "language_detection/version"
|
@@ -46,7 +47,7 @@ module LanguageLayer
|
|
46
47
|
|
47
48
|
# Populate the Query
|
48
49
|
q.access_key = @access_key
|
49
|
-
q.query = query
|
50
|
+
q.query = URI.escape(query)
|
50
51
|
|
51
52
|
# We then create the Request
|
52
53
|
req = LanguageLayer::DetectRequest.new(q)
|
@@ -100,12 +101,12 @@ module LanguageLayer
|
|
100
101
|
begin
|
101
102
|
|
102
103
|
# We make the actual request
|
103
|
-
res = self.class.
|
104
|
+
res = self.class.post('/batch', req_dto)
|
104
105
|
|
105
106
|
# We ensure that we tap the response so we can use the results
|
106
107
|
res.inspect
|
107
108
|
|
108
|
-
if (
|
109
|
+
if (res[LanguageLayer::BatchResponse::ERROR_EXPR])
|
109
110
|
raise LanguageLayer::BatchException.new res[LanguageLayer::BatchResponse::ERROR_EXPR]
|
110
111
|
end
|
111
112
|
|
@@ -142,7 +143,7 @@ module LanguageLayer
|
|
142
143
|
# We ensure that we tap the response so we can use the results
|
143
144
|
res.inspect
|
144
145
|
|
145
|
-
if (
|
146
|
+
if (res[LanguageLayer::LanguagesResponse::ERROR_EXPR])
|
146
147
|
raise LanguageLayer::LanguagesException.new res[LanguageLayer::LanguagesResponse::ERROR_EXPR]
|
147
148
|
end
|
148
149
|
|