dict 0.0.1 → 0.0.2
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.
- data/bin/translate +15 -1
- data/lib/dict.rb +17 -3
- metadata +3 -2
data/bin/translate
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'dict'
|
4
|
-
|
4
|
+
|
5
|
+
if ARGV.empty?
|
6
|
+
puts "Please, enter the word to translate."
|
7
|
+
exit
|
8
|
+
end
|
9
|
+
|
10
|
+
temp = ARGV[0].dup
|
11
|
+
|
12
|
+
print temp << " translated: " << "\n"
|
13
|
+
puts Dict::Translation.getResponse(ARGV[0])
|
14
|
+
|
15
|
+
if ARGV[0] == "status"
|
16
|
+
print "Status API: "
|
17
|
+
print Dict::Translation.status
|
18
|
+
end
|
data/lib/dict.rb
CHANGED
@@ -1,7 +1,21 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
|
1
4
|
module Dict
|
2
|
-
class
|
3
|
-
def
|
4
|
-
|
5
|
+
class Translation
|
6
|
+
def initialize(word)
|
7
|
+
@word = ARGV[0]
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.status(adres = "http://dict-app-staging.shellyapp.com/")
|
11
|
+
uri = URI(adres)
|
12
|
+
res = Net::HTTP.get_response(uri)
|
13
|
+
puts res.message
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.getResponse(word)
|
17
|
+
uri = URI("http://dict-app-staging.shellyapp.com/#{word}")
|
18
|
+
puts Net::HTTP.get(uri)
|
5
19
|
end
|
6
20
|
end
|
7
21
|
end
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dict
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Aleksander Gozdek
|
9
|
+
- Mateusz Czerwinski
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
13
|
+
date: 2012-07-03 00:00:00.000000000 Z
|
13
14
|
dependencies: []
|
14
15
|
description:
|
15
16
|
email:
|