fanyi 0.0.1

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.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1 -0
  3. data/bin/fanyi.rb +30 -0
  4. data/fanyi.gemspec +20 -0
  5. data/lib/version.rb +3 -0
  6. metadata +50 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ab864ea75b117b1a309ccf8fa30ded33637a8ebba42dc526ee6465b22cab559c
4
+ data.tar.gz: 0a6bad25c555e7c58f92903b168a736b352ac780a50340bf6cd40f2a9c134cda
5
+ SHA512:
6
+ metadata.gz: dc7afe10af6e35c005ba45c82924b589f029026d844129c62f7d5f1b7ffbca363155f3a1b4cfb42ae6273213fdd42dab8135b7d10b3ef82a3cc3c4a9f10e2edd
7
+ data.tar.gz: 32166df2179553b43f45ed627b7445a49e77f89c430dc8274f54d1ff1092671bf1e3115f7cd38ffa2e943ca0cf4a9db83e40f538d4b2d3646389b20e080dc3a3
@@ -0,0 +1 @@
1
+ # Fanyi
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/http'
3
+ require 'json'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'version'
7
+
8
+ def putsHelp
9
+ puts "Commands:"
10
+ puts " fanyi [word]"
11
+ end
12
+
13
+ argv = ARGV
14
+ if argv.length == 0
15
+ putsHelp()
16
+ exit
17
+ end
18
+
19
+ a = argv[0]
20
+
21
+ unless ENV["GOOGLE_API_KEY_FANYI"]
22
+ puts "please setting GOOGLE_API_KEY_FANYI"
23
+ exit
24
+ end
25
+
26
+ word = URI.escape(a)
27
+ uri = URI("https://www.googleapis.com/language/translate/v2?key="+ENV["GOOGLE_API_KEY_FANYI"]+"&source=en&target=ja&q="+word)
28
+ response = Net::HTTP.get uri
29
+ output = JSON.parse response
30
+ puts output["data"]["translations"]
@@ -0,0 +1,20 @@
1
+ require File.expand_path('../lib/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Dongri Jin"]
5
+ gem.email = ["dongrify@gmail.com"]
6
+ gem.description = %q{Command.}
7
+ gem.summary = %q{Command.}
8
+ gem.homepage = "https://github.com/dongri/fanyi"
9
+ gem.files = `git ls-files`.split($\)
10
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
11
+ gem.name = "fanyi"
12
+ gem.version = FANYI::VERSION
13
+ gem.date = %q{2019-04-25}
14
+ gem.rdoc_options = ["--charset=UTF-8"]
15
+ gem.bindir = "bin"
16
+ gem.required_ruby_version = '>= 1.9.0'
17
+ gem.extra_rdoc_files = [
18
+ "README.md"
19
+ ]
20
+ end
@@ -0,0 +1,3 @@
1
+ module FANYI
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fanyi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dongri Jin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Command.
14
+ email:
15
+ - dongrify@gmail.com
16
+ executables:
17
+ - fanyi.rb
18
+ extensions: []
19
+ extra_rdoc_files:
20
+ - README.md
21
+ files:
22
+ - README.md
23
+ - bin/fanyi.rb
24
+ - fanyi.gemspec
25
+ - lib/version.rb
26
+ homepage: https://github.com/dongri/fanyi
27
+ licenses: []
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options:
31
+ - "--charset=UTF-8"
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: 1.9.0
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.7.3
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Command.
50
+ test_files: []