fy 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/fy/fanyi.rb +3 -5
- data/lib/fy/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2087a6328053fa6615105596c20d9c0b8e6e77e8
|
4
|
+
data.tar.gz: c2b709dd2d365b2a049dc7a18ae6da8fb56195a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60509e560c0a4e3fee3ef3cbdc1370b64ed26c27657a2edfa28874617718010d43222bf9e40eb60af40c40b25da91babe31eb2220afc1f34f63803c7e71508ea
|
7
|
+
data.tar.gz: f932f5139afb0b4c6534cdf197f53d6ce5b6f73d01b97db03b468fd793a8c34591b60911e2eeff0cb49cab6e269239255064d65a8a6baee8a1d3b6058cfbeb07
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Fy
|
2
|
+
[![Gem](https://img.shields.io/gem/v/fy.svg)](https://rubygems.org/gems/fy)
|
2
3
|
|
3
4
|
A translate tool in your command line, inspired by [Fanyi](https://github.com/afc163/fanyi).
|
4
5
|
|
5
|
-
![](http://dd-personal.qiniudn.com/Screenshot from
|
6
|
+
![](http://dd-personal.qiniudn.com/Screenshot from 2015-04-25 20:33:21.png)
|
6
7
|
|
7
8
|
---
|
8
9
|
|
data/lib/fy/fanyi.rb
CHANGED
@@ -4,6 +4,8 @@ require "json"
|
|
4
4
|
require "rainbow/ext/string"
|
5
5
|
|
6
6
|
module Fy
|
7
|
+
API_URL = "http://fanyi.youdao.com/openapi.do?keyfrom=JIANGDi&key=891853312&type=data&doctype=json&version=1.1&q="
|
8
|
+
|
7
9
|
class Fanyi
|
8
10
|
|
9
11
|
def initialize(input)
|
@@ -11,12 +13,8 @@ module Fy
|
|
11
13
|
query_for_hash
|
12
14
|
end
|
13
15
|
|
14
|
-
def api_url
|
15
|
-
"http://fanyi.youdao.com/openapi.do?keyfrom=JIANGDi&key=891853312&type=data&doctype=json&version=1.1&q="
|
16
|
-
end
|
17
|
-
|
18
16
|
def query_for_hash
|
19
|
-
query_url =
|
17
|
+
query_url = API_URL + URI.escape(@words.gsub(/ /, '+'))
|
20
18
|
result_json = Net::HTTP.get(URI(query_url))
|
21
19
|
@result_hash = JSON.parse(result_json)
|
22
20
|
end
|
data/lib/fy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JIANG Di
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,9 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.4.
|
92
|
+
rubygems_version: 2.4.5
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: A translate tool in your command line
|
96
96
|
test_files: []
|
97
|
-
has_rdoc: false
|