google_web_translate 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7223fdbd591202fc83a78b390c03e29cc48e6de
4
- data.tar.gz: 8c00a999400be1a01f40e69d9fbc0786232c2288
3
+ metadata.gz: a801716622f94a6f87ac50ea1e348d0c9d91e155
4
+ data.tar.gz: 4913fdab2c0ee17de89447b7292d13d1730ddf87
5
5
  SHA512:
6
- metadata.gz: aeb626c15ad4c175a9f83cdedd78ee60918fd5641555fee7f99d7370d0d8d7ce3ef8667f918f552ab3939f23f6e746a91328446884bd5dd8f31bb118bb6694d4
7
- data.tar.gz: 61899a7e320e66ab08b1170699856e7ccd1255f734b63e6166972b04d41fbd2d604796e7807b9a082985f1770843d28730fed577c9126df8d7126c7febe0f309
6
+ metadata.gz: 8741be3763bc8f09111bf2f9fd7fb7dc00c75b6304ce9fe4e447a29fabba1d3c3553b7019e9012269d80ea88ab7d49ef51c1744c65d1b8b7f1a76da1063cc2cf
7
+ data.tar.gz: 7c440c5f7fb0a4f21efb82b4cd0bcc6322ad3ed003713b0650f7b2864a0fd712830a97eac637aa9517a84be1e8e10960d4d2cc028f5c6bb0e8a862a578214598
data/.gitignore CHANGED
@@ -1,14 +1,14 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /generated.js
10
- /spec.out
11
- /Gemfile.lock
12
-
13
- # rspec failure tracking
14
- .rspec_status
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /generated.js
10
+ /spec.out
11
+ /Gemfile.lock
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - 'Rakefile'
4
+ - '**/*.rake'
5
+ - 'spec/**/*.rb'
6
+
7
+ Style/MixinUsage:
8
+ Exclude:
9
+ - 'spec/**/*.rb'
data/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.16.1
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2
5
+ - 2.3
6
+ - 2.4
7
+ before_install: gem install bundler -v 1.16.1
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,74 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at sobakasu@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at sobakasu@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Andrew
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Andrew
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,49 +1,53 @@
1
- # GoogleWebTranslate
2
-
3
- Translates text using the Google translate web interface.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'google_web_translate'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install google_web_translate
20
-
21
- ## Usage
22
-
23
- ### Command line
24
-
25
- google_web_translate "Hello" en de
26
-
27
- ### API
28
-
29
- api = GoogleWebTranslate::API.new
30
- result = api.translate("Hello", "en", "de")
31
- puts result.translation
32
-
33
- ## Development
34
-
35
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
-
37
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
-
39
- ## Contributing
40
-
41
- Bug reports and pull requests are welcome on GitHub at https://github.com/sobakasu/google_web_translate. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
42
-
43
- ## License
44
-
45
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
-
47
- ## Code of Conduct
48
-
49
- Everyone interacting in the GoogleWebTranslate project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sobakasu/google_web_translate/blob/master/CODE_OF_CONDUCT.md).
1
+ [![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/google_web_translate)
2
+ [![Gem Version](https://badge.fury.io/rb/google_web_translate.svg)](https://badge.fury.io/rb/google_web_translate)
3
+ [![Build Status](https://travis-ci.org/sobakasu/google_web_translate.svg?branch=master)](https://travis-ci.org/sobakasu/google_web_translate)
4
+
5
+ # GoogleWebTranslate
6
+
7
+ Translates text using the Google translate web interface.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'google_web_translate'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install google_web_translate
24
+
25
+ ## Usage
26
+
27
+ ### Command line
28
+
29
+ google_web_translate "Hello" en de
30
+
31
+ ### API
32
+
33
+ api = GoogleWebTranslate::API.new
34
+ result = api.translate("Hello", "en", "de")
35
+ puts result.translation
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sobakasu/google_web_translate. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
46
+
47
+ ## License
48
+
49
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
50
+
51
+ ## Code of Conduct
52
+
53
+ Everyone interacting in the GoogleWebTranslate project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sobakasu/google_web_translate/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
File without changes
@@ -26,6 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'webmock'
27
27
 
28
28
  spec.add_dependency 'execjs'
29
- spec.add_dependency 'rest-client'
30
29
  spec.add_dependency 'thor'
31
30
  end
@@ -1,14 +1,14 @@
1
1
  require 'execjs'
2
2
  require 'json'
3
- require 'rest-client'
4
3
 
5
4
  module GoogleWebTranslate
5
+ # interface to the google web translation api
6
6
  class API
7
7
  def initialize(options = {})
8
8
  @dt = options[:dt] || DEFAULT_DT
9
9
  @token_ttl = options[:token_ttl] || DEFAULT_TOKEN_TTL
10
10
  @debug = options[:debug]
11
- @user_agent = options[:user_agent] || DEFAULT_USER_AGENT
11
+ @http_client = options[:http_client] || HTTPClient.new(options)
12
12
  end
13
13
 
14
14
  def translate(string, from, to)
@@ -22,7 +22,6 @@ module GoogleWebTranslate
22
22
  URL_TRANSLATE_1 = URL_MAIN + '/translate_a/single'.freeze
23
23
  DEFAULT_DT = %w[at bd ex ld md qca rw rm ss t].freeze
24
24
  DEFAULT_TOKEN_TTL = 3600
25
- DEFAULT_USER_AGENT = "GoogleWebTranslate #{VERSION}".freeze
26
25
 
27
26
  def fetch_translation(string, from, to)
28
27
  json = fetch_url_body(translate_url(string, from, to))
@@ -31,7 +30,7 @@ module GoogleWebTranslate
31
30
  end
32
31
 
33
32
  def fetch_url_response(url)
34
- RestClient.get(url.to_s)
33
+ @http_client.get(url.to_s)
35
34
  end
36
35
 
37
36
  def fetch_url_body(url)
@@ -95,13 +94,13 @@ module GoogleWebTranslate
95
94
  end
96
95
 
97
96
  def extract_tkk(html)
98
- raise 'TKK not found' unless html =~ /TKK=.*?\{(.*?)\}/
97
+ raise 'TKK not found' unless html =~ /TKK=eval\('(.*?)'\);/
99
98
  tkk_code = Regexp.last_match(1)
100
99
  # tkk_code = Translatomatic::StringEscaping.unescape(tkk_code)
101
100
  tkk_code = StringEscaping.unescape(tkk_code)
102
101
  debug("tkk code unescaped: #{tkk_code}")
103
- context = ExecJS.compile(tkk_code)
104
- tkk = context.call(nil)
102
+ tkk = ExecJS.eval(tkk_code)
103
+ # tkk = context.call(nil)
105
104
  debug("evaluated tkk: #{tkk}")
106
105
  tkk
107
106
  end
@@ -110,20 +109,10 @@ module GoogleWebTranslate
110
109
  tk = tk(string)
111
110
  debug("tk: #{tk}")
112
111
  query = {
113
- sl: from,
114
- tl: to,
115
- ie: 'UTF-8',
116
- oe: 'UTF-8',
117
- q: string,
118
- dt: @dt,
119
- tk: tk,
112
+ sl: from, tl: to, ie: 'UTF-8', oe: 'UTF-8',
113
+ q: string, dt: @dt, tk: tk,
120
114
  # not sure what these are for
121
- client: 't',
122
- hl: 'en',
123
- otf: 1,
124
- ssel: 4,
125
- tsel: 6,
126
- kc: 5
115
+ client: 't', hl: 'en', otf: 1, ssel: 4, tsel: 6, kc: 5
127
116
  }
128
117
  url = URI.parse(URL_TRANSLATE_1)
129
118
  url.query = URI.encode_www_form(query)
@@ -1,6 +1,8 @@
1
1
  require 'thor'
2
+ require 'pp'
2
3
 
3
4
  module GoogleWebTranslate
5
+ # Command line interface
4
6
  class CLI < Thor
5
7
  desc 'string from to', 'translate a string from one language to another'
6
8
  method_option :dt, type: :array, desc: 'data types'
@@ -10,7 +12,7 @@ module GoogleWebTranslate
10
12
 
11
13
  api = API.new(api_options)
12
14
  result = api.translate(string, from, to)
13
- p result.to_h
15
+ pp result.to_h
14
16
  end
15
17
  end
16
18
  end
@@ -0,0 +1,26 @@
1
+ require 'net/http'
2
+
3
+ module GoogleWebTranslate
4
+ # HTTP client functionality
5
+ class HTTPClient
6
+ def self.user_agent
7
+ gem_version = "GoogleWebTranslate/#{VERSION}"
8
+ platform_version = "(#{RUBY_PLATFORM}) #{RUBY_ENGINE}/#{RUBY_VERSION}"
9
+ gem_version + ' ' + platform_version
10
+ end
11
+
12
+ def initialize(options = {})
13
+ @user_agent = options[:user_agent] || self.class.user_agent
14
+ end
15
+
16
+ def get(url)
17
+ uri = URI.parse(url)
18
+ request = Net::HTTP::Get.new(uri)
19
+ request['User-Agent'] = @user_agent
20
+ options = { use_ssl: uri.scheme == 'https' }
21
+ Net::HTTP.start(uri.host, uri.port, options) do |http|
22
+ http.request(request)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,24 +1,30 @@
1
1
  module GoogleWebTranslate
2
+ # Translation results
2
3
  class Result
3
4
  attr_reader :raw
4
5
 
5
- attr_reader :translation
6
- attr_reader :alternatives
7
- attr_reader :dictionary
8
- attr_reader :examples
6
+ # @private
7
+ DATA_INDICES = {
8
+ translation: [0, 0, 0], # dt:t
9
+ alternatives: [5, 0, 2], # dt:at
10
+ dictionary: [1], # dt: bd
11
+ synonyms: [11], # dt:ss
12
+ definitions: [12, 0], # dt:md
13
+ examples: [13, 0], # dt:ex
14
+ see_also: [14, 0], # dt:rw
15
+ }.freeze
16
+
17
+ DATA_INDICES.each_key { |key| attr_reader key }
9
18
 
10
19
  def initialize(data)
11
20
  @raw = data
12
21
  @keys = []
13
22
  @properties = {}
14
23
 
15
- extract_data(:translation, 0, 0, 0) # dt:t
16
- extract_data(:alternatives, 5, 0, 2) # dt:at
17
- extract_data(:dictionary, 1) # dt: bd
18
- extract_data(:synonyms, 11) # dt:ss
19
- extract_data(:definitions, 12, 0) # dt:md
20
- extract_data(:examples, 13, 0) # dt:ex
21
- extract_data(:see_also, 14, 0) # dt:rw
24
+ DATA_INDICES.each do |key, indices|
25
+ indices = indices.dup
26
+ extract_data(key, *indices)
27
+ end
22
28
 
23
29
  @alternatives = @alternatives.collect { |i| i[0] } if @alternatives
24
30
  @keys.each { |key| @properties[key] = instance_variable_get("@#{key}") }
File without changes
@@ -1,3 +1,3 @@
1
1
  module GoogleWebTranslate
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'google_web_translate/version.rb'
2
2
  require 'google_web_translate/string_escaping.rb'
3
+ require 'google_web_translate/http_client.rb'
3
4
  require 'google_web_translate/result.rb'
4
5
  require 'google_web_translate/api.rb'
data/lib/js/window.js CHANGED
@@ -1,17 +1,17 @@
1
- var window = {
2
- jstiming: {
3
- load: {
4
- tick: function() {}
5
- }
6
- }
7
- };
8
- var navigator = {};
9
- var document = {};
10
-
11
- function setWindowProperty(key, value) {
12
- window[key] = value;
13
- }
14
- function generateToken(string, tkk) {
15
- setWindowProperty("TKK", tkk);
16
- return wq(string);
17
- }
1
+ var window = {
2
+ jstiming: {
3
+ load: {
4
+ tick: function() {}
5
+ }
6
+ }
7
+ };
8
+ var navigator = {};
9
+ var document = {};
10
+
11
+ function setWindowProperty(key, value) {
12
+ window[key] = value;
13
+ }
14
+ function generateToken(string, tkk) {
15
+ setWindowProperty("TKK", tkk);
16
+ return wq(string);
17
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_web_translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rest-client
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: thor
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -132,6 +118,7 @@ extra_rdoc_files: []
132
118
  files:
133
119
  - ".gitignore"
134
120
  - ".rspec"
121
+ - ".rubocop.yml"
135
122
  - ".travis.yml"
136
123
  - CODE_OF_CONDUCT.md
137
124
  - Gemfile
@@ -145,6 +132,7 @@ files:
145
132
  - lib/google_web_translate.rb
146
133
  - lib/google_web_translate/api.rb
147
134
  - lib/google_web_translate/cli.rb
135
+ - lib/google_web_translate/http_client.rb
148
136
  - lib/google_web_translate/result.rb
149
137
  - lib/google_web_translate/string_escaping.rb
150
138
  - lib/google_web_translate/version.rb
@@ -169,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
157
  version: '0'
170
158
  requirements: []
171
159
  rubyforge_project:
172
- rubygems_version: 2.6.14
160
+ rubygems_version: 2.6.11
173
161
  signing_key:
174
162
  specification_version: 4
175
163
  summary: Text translation using the google web interface