after_the_deadline 0.1.2 → 0.1.3
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 +8 -8
- data/README.md +14 -0
- data/after_the_deadline.gemspec +1 -1
- data/lib/after_the_deadline.rb +24 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZDNiZWZlN2M3MTFmNzI3MmFiMGNiNjgzNWQwZjM1MmI0YmJmYzY4Mw==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
ZjNmMDlmYjNmMWQ2MWFjZTc2YzRlNjA4NTdhZmVmYWRmODRjNzQ4Mw==
|
|
7
7
|
!binary "U0hBNTEy":
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MWRiYzAwNDQyYjI5Mzg3MDIyNjQyYWZkZWNkYjIxZmQ5YWFmMGZmMmY0NjQz
|
|
10
|
+
YTYzZjFiMzFjNzM5OGM3ZTI4N2YwNWRjOTQyODI2MGJjYTNiNDE5ZTY0YzYz
|
|
11
|
+
ODkzZWUwMjQ0NGIzMjkwYWM3ZDMwM2E1ZmUyNWY4MjVjZmI5YWU=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ZTBlYmI4MmQ5ODk1ZjM1NDlmNGQ5ODU0ODkyZjcyZTVhOTRiMjQ1YjJiMWM5
|
|
14
|
+
ZmMyZWYyOWQ3ZjNkMzg4YTUzMzdlNGZhZDQ2YjA2MDRmMWFmMDk2OTJkOWM4
|
|
15
|
+
NmZjOWMxYTMzZTcwZmI5NjRhMDMyYzNkMWU1Y2Y2MjNlZjA1NDg=
|
data/README.md
CHANGED
|
@@ -64,6 +64,20 @@ Or install it yourself as:
|
|
|
64
64
|
AfterTheDeadline.check "My last name, Sepcot, is very unique."
|
|
65
65
|
=> []
|
|
66
66
|
|
|
67
|
+
## Multilanguage
|
|
68
|
+
|
|
69
|
+
After the deadline service provides 5 languages:
|
|
70
|
+
|
|
71
|
+
* English (en, default)
|
|
72
|
+
* French (fr)
|
|
73
|
+
* German (de)
|
|
74
|
+
* Spanish (es)
|
|
75
|
+
* Portuguese (pt)
|
|
76
|
+
|
|
77
|
+
If no language is set English is choosen by default. To set another language simply set it:
|
|
78
|
+
|
|
79
|
+
AfterTheDeadline.set_language('de') # possible values en, fr, de, es, pt
|
|
80
|
+
|
|
67
81
|
## Contributing
|
|
68
82
|
|
|
69
83
|
1. Fork it
|
data/after_the_deadline.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'after_the_deadline'
|
|
5
|
-
spec.version = '0.1.
|
|
5
|
+
spec.version = '0.1.3'
|
|
6
6
|
spec.authors = ['Michael J. Sepcot']
|
|
7
7
|
spec.email = ['developer@sepcot.com']
|
|
8
8
|
spec.description = %q{A ruby library for working with the After The Deadline service.}
|
data/lib/after_the_deadline.rb
CHANGED
|
@@ -9,12 +9,14 @@ def AfterTheDeadline(dictionary = nil, types = AfterTheDeadline::DEFAULT_IGNORE_
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
class AfterTheDeadline
|
|
12
|
+
BASE_URI = 'http://service.afterthedeadline.com'
|
|
13
|
+
DEFAULT_IGNORE_TYPES = ['Bias Language', 'Cliches', 'Complex Expression', 'Diacritical Marks', 'Double Negatives', 'Hidden Verbs', 'Jargon Language', 'Passive voice', 'Phrases to Avoid', 'Redundant Expression']
|
|
14
|
+
SUPPORTED_LANGUAGES = %w(en fr de es pt)
|
|
15
|
+
|
|
12
16
|
@@custom_dictionary = []
|
|
13
17
|
@@ignore_types = []
|
|
14
18
|
@@api_key = nil
|
|
15
|
-
|
|
16
|
-
BASE_URI = 'http://service.afterthedeadline.com'
|
|
17
|
-
DEFAULT_IGNORE_TYPES = ['Bias Language', 'Cliches', 'Complex Expression', 'Diacritical Marks', 'Double Negatives', 'Hidden Verbs', 'Jargon Language', 'Passive voice', 'Phrases to Avoid', 'Redundant Expression']
|
|
19
|
+
@uri = BASE_URI
|
|
18
20
|
|
|
19
21
|
class <<self
|
|
20
22
|
def set_custom_dictionary(dict)
|
|
@@ -33,6 +35,17 @@ class AfterTheDeadline
|
|
|
33
35
|
@@api_key = key
|
|
34
36
|
end
|
|
35
37
|
|
|
38
|
+
def set_language(language)
|
|
39
|
+
language.downcase!
|
|
40
|
+
unless AfterTheDeadline::SUPPORTED_LANGUAGES.include? language
|
|
41
|
+
raise AfterTheDeadline::Exception.new ("Unsupported language #{language}. Supported languages are #{AfterTheDeadline::SUPPORTED_LANGUAGES}")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
@uri = 'en'.eql?(language) ? BASE_URI : "http://#{language}.service.afterthedeadline.com"
|
|
45
|
+
# do not return anything (the assignation in this case)
|
|
46
|
+
nil
|
|
47
|
+
end
|
|
48
|
+
|
|
36
49
|
# Invoke the checkDocument service with provided text.
|
|
37
50
|
#
|
|
38
51
|
# Returns list of AfterTheDeadline::Error objects.
|
|
@@ -68,7 +81,7 @@ class AfterTheDeadline
|
|
|
68
81
|
|
|
69
82
|
def perform(action, params)
|
|
70
83
|
params[:key] = @@api_key if @@api_key
|
|
71
|
-
response = Net::HTTP.post_form URI.parse(
|
|
84
|
+
response = Net::HTTP.post_form URI.parse("#{@uri}#{action}"), params
|
|
72
85
|
raise "Unexpected response code from AtD service: #{response.code} #{response.message}" unless response.is_a? Net::HTTPSuccess
|
|
73
86
|
response.body
|
|
74
87
|
end
|
|
@@ -132,3 +145,10 @@ class AfterTheDeadline::Metrics
|
|
|
132
145
|
private
|
|
133
146
|
attr_writer :spell, :grammar, :stats, :style
|
|
134
147
|
end
|
|
148
|
+
|
|
149
|
+
class AfterTheDeadline::Exception < StandardError
|
|
150
|
+
def initialize(msg = "Something went wrong")
|
|
151
|
+
super
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: after_the_deadline
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael J. Sepcot
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|