that_language-service 0.1.0.pre3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/that_language/service/application.rb +26 -22
- data/lib/that_language/service/version.rb +1 -1
- data/that_language-service.gemspec +6 -4
- metadata +37 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdac55053ce4beeca722594f232c14ddf74e158f
|
4
|
+
data.tar.gz: 1c94d5ccb87b000c077905e98a426377930ae367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78e1ef777ba3f4848df131f09bd8bc2387dc3274510c990dfe3353ebc143145aff93183f14d2da4c9317bcb2e0f5f3a40282366bf8e9c9e6f0fc0b8aa6e31408
|
7
|
+
data.tar.gz: 21c266097bdd623d7ef47b43deebd159fdb0f841ba8de960906ffc47ac8b8984c947454eb522ef21e97b86ab71aef19bac69109103aa7b5e8181bae0f271980a
|
@@ -1,57 +1,61 @@
|
|
1
1
|
require "sinatra"
|
2
|
+
require "sinatra/multi_route"
|
2
3
|
require "that_language"
|
3
4
|
|
4
5
|
module ThatLanguage
|
5
6
|
module Service
|
6
7
|
class Application < Sinatra::Application
|
7
|
-
get '/
|
8
|
-
render_json
|
8
|
+
route :get, :post, '/language' do
|
9
|
+
render_json language: ThatLanguage.language(text)
|
9
10
|
end
|
10
11
|
|
11
|
-
post '/language_code' do
|
12
|
-
render_json language_code: language_code
|
12
|
+
route :get, :post, '/language_code' do
|
13
|
+
render_json language_code: ThatLanguage.language_code(text)
|
13
14
|
end
|
14
15
|
|
15
|
-
get '/detect' do
|
16
|
+
route :get, :post, '/detect' do
|
16
17
|
render_json({
|
18
|
+
language: ThatLanguage::Iso639[detect.language_code], # TODO: detect.language
|
17
19
|
language_code: detect.language_code,
|
18
20
|
confidence: detect.confidence
|
19
21
|
})
|
20
22
|
end
|
21
23
|
|
22
|
-
post '/
|
24
|
+
route :get, :post, '/details' do
|
25
|
+
render_json ThatLanguage.details(text)
|
26
|
+
end
|
27
|
+
|
28
|
+
get '/available' do
|
29
|
+
render_json available: ThatLanguage.available
|
30
|
+
end
|
31
|
+
|
32
|
+
get '/available_languages' do
|
23
33
|
render_json({
|
24
|
-
|
25
|
-
confidence: detect.confidence
|
34
|
+
available_languages: ThatLanguage.available_languages
|
26
35
|
})
|
27
36
|
end
|
28
37
|
|
29
|
-
get '/
|
30
|
-
render_json
|
38
|
+
get '/available_language_codes' do
|
39
|
+
render_json({
|
40
|
+
available_language_codes: ThatLanguage.available_language_codes
|
41
|
+
})
|
31
42
|
end
|
32
43
|
|
33
|
-
|
34
|
-
render_json
|
44
|
+
get '/version' do
|
45
|
+
render_json version: ThatLanguage::VERSION
|
35
46
|
end
|
36
47
|
|
37
48
|
private
|
38
49
|
|
39
|
-
def render_json(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
def language_code
|
44
|
-
@language_code ||= ThatLanguage.language_code(text)
|
50
|
+
def render_json(obj)
|
51
|
+
content_type :json
|
52
|
+
obj.to_json
|
45
53
|
end
|
46
54
|
|
47
55
|
def detect
|
48
56
|
@detect ||= ThatLanguage.detect(text)
|
49
57
|
end
|
50
58
|
|
51
|
-
def details
|
52
|
-
@details ||= ThatLanguage.details(text)
|
53
|
-
end
|
54
|
-
|
55
59
|
def text
|
56
60
|
params['text']
|
57
61
|
end
|
@@ -9,9 +9,9 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Patrick Helm"]
|
10
10
|
spec.email = ["me@patrick-helm.de"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{Write a longer description or delete this line.}
|
14
|
-
spec.homepage = "
|
12
|
+
spec.summary = %q{Simple Sinatra wrapper for ThatLanguage.}
|
13
|
+
# spec.description = %q{Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/Deradon/that_language-service"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
@@ -27,11 +27,13 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_dependency "that_language", "~> 0.1.0
|
30
|
+
spec.add_dependency "that_language", "~> 0.1.0"
|
31
31
|
spec.add_dependency "sinatra", "~> 1.4.6"
|
32
|
+
spec.add_dependency "sinatra-contrib"
|
32
33
|
spec.add_dependency "thin", "~> 1.6.4"
|
33
34
|
|
34
35
|
spec.add_development_dependency "bundler", "~> 1.10"
|
36
|
+
spec.add_development_dependency "pry"
|
35
37
|
spec.add_development_dependency "rack-test"
|
36
38
|
spec.add_development_dependency "rake", "~> 10.0"
|
37
39
|
spec.add_development_dependency "rspec"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: that_language-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Helm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: that_language
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.0
|
19
|
+
version: 0.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.0
|
26
|
+
version: 0.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sinatra
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.4.6
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra-contrib
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: thin
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '1.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rack-test
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +150,7 @@ dependencies:
|
|
122
150
|
- - ">="
|
123
151
|
- !ruby/object:Gem::Version
|
124
152
|
version: '0'
|
125
|
-
description:
|
153
|
+
description:
|
126
154
|
email:
|
127
155
|
- me@patrick-helm.de
|
128
156
|
executables: []
|
@@ -144,7 +172,7 @@ files:
|
|
144
172
|
- lib/that_language/service/application.rb
|
145
173
|
- lib/that_language/service/version.rb
|
146
174
|
- that_language-service.gemspec
|
147
|
-
homepage:
|
175
|
+
homepage: https://github.com/Deradon/that_language-service
|
148
176
|
licenses:
|
149
177
|
- MIT
|
150
178
|
metadata: {}
|
@@ -159,13 +187,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
187
|
version: '0'
|
160
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
189
|
requirements:
|
162
|
-
- - "
|
190
|
+
- - ">="
|
163
191
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
192
|
+
version: '0'
|
165
193
|
requirements: []
|
166
194
|
rubyforge_project:
|
167
195
|
rubygems_version: 2.4.6
|
168
196
|
signing_key:
|
169
197
|
specification_version: 4
|
170
|
-
summary:
|
198
|
+
summary: Simple Sinatra wrapper for ThatLanguage.
|
171
199
|
test_files: []
|