termit 2.10.2 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cad13ce3f8193e47ab3a742c41ec87543f8f16b
4
- data.tar.gz: e17bb61c4d5b3585660455f5dbebe6d09f678d9f
3
+ metadata.gz: e801b2df22a65c85d74d0cc636f3624a9105f35b
4
+ data.tar.gz: 967a0136118123279d6a8f138f8fa4e2e1e1e4d0
5
5
  SHA512:
6
- metadata.gz: ce5898844bb1ed10e2e23115353fdedefde1c47fcd750580d31a87e4f2c25fe201d4660df95eb868b37c02e9a7ba578b2719c8485a70d6c08a7b48f2ea1a530d
7
- data.tar.gz: d8632fba135a1641ff2c6d91e00266d2c92108b4db1b0043ae388c95b2197119bd0cbf9d51dd585cbb3310e641cb8a0f5778554ed8a68a212ab882bae3ebaf7c
6
+ metadata.gz: 2646fdfe03ec2a15660e691176e0f25a53aafad401f3dcf5e07e6bc849963b76fb235bce4275ab136e7835bc5812cece79caf4251bf803bc275d824be78829b8
7
+ data.tar.gz: c47f3ec5763e0eea0676aaefceaa23891bf6e59f672e5d6433899938a86410455b88f5c8610fe6e9916eb19ae33d11d15d873329b4fa275efbf58d13ccccbd6d
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  Termit is an easy way to use Google Translate in your terminal. You can check out its node.js npm version [normit](https://github.com/pawurb/normit)
5
5
 
6
-
7
6
  ## Installation
8
7
  ```ruby
9
8
  gem install termit
@@ -21,8 +21,10 @@ module Termit
21
21
  def send_request
22
22
  uri = URI.parse @url
23
23
  http = Net::HTTP.new(uri.host, uri.port)
24
- request = Net::HTTP::Post.new(uri.request_uri)
25
- request.set_form_data(text: @text)
24
+ query = "q=#{URI::encode(@text)}"
25
+ url = "#{uri.request_uri}&#{query}"
26
+ request = Net::HTTP::Get.new(url)
27
+ http.use_ssl = true
26
28
  http.request(request)
27
29
  rescue SocketError
28
30
  display_no_internet_msg
@@ -24,8 +24,8 @@ module Termit
24
24
 
25
25
  def extract_synonyms
26
26
  synonyms_data = @text.split("[[")[2].split("[")[1]
27
- length = synonyms_data.length
28
- if synonyms_available synonyms_data
27
+ length = synonyms_data && synonyms_data.length
28
+ if length && synonyms_available(synonyms_data)
29
29
  synonyms_data[0..(length-3)].delete("\"").gsub(/(,)/, ", ")
30
30
  else
31
31
  " ---"
@@ -1,7 +1,7 @@
1
1
  #encoding: UTF-8
2
2
  module Termit
3
3
  class UrlConstructor
4
- Host = "http://translate.google.com"
4
+ Host = "https://translate.google.com"
5
5
 
6
6
  def initialize options
7
7
  @options = options
@@ -14,11 +14,11 @@ module Termit
14
14
  private
15
15
 
16
16
  def construct_text_url
17
- "#{Host}/translate_a/t?client=t&sl=#{@options[:source_lang]}&tl=#{@options[:target_lang]}&hl=pl&sc=2&ie=UTF-8&oe=UTF-8&prev=enter&ssel=0&tsel=0&"
17
+ "#{Host}/translate_a/single?client=t&sl=#{@options[:source_lang]}&tl=#{@options[:target_lang]}&hl=pl&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&srcrom=1&ssel=3&tsel=6&kc=2&tk=522578|870062"
18
18
  end
19
19
 
20
20
  def construct_sound_url
21
- "#{Host}/translate_tts?tl=#{@options[:target_lang]}&ie=UTF-8&oe=UTF-8"
21
+ "#{Host}/translate_tts?ie=UTF-8&tl=#{@options[:target_lang]}&total=1&idx=0&textlen=5&tk=735012&client=t"
22
22
  end
23
23
  end
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module Termit
2
- VERSION = "2.10.2"
2
+ VERSION = "2.11.0"
3
3
  end
@@ -1,73 +1,66 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: post
5
- uri: http://translate.google.com/translate_a/t?client=t&hl=pl&ie=UTF-8&oe=UTF-8&prev=enter&sc=2&sl=en&ssel=0&tl=pl&tsel=0
4
+ method: get
5
+ uri: https://translate.google.com/translate_a/single?client=t&dt=at&hl=pl&ie=UTF-8&kc=2&oe=UTF-8&otf=2&q=hey%20cowboy%20where%20is%20your%20horse&sl=en&srcrom=1&ssel=3&tk=522578%7C870062&tl=pl&tsel=6
6
6
  body:
7
7
  encoding: US-ASCII
8
- string: text=hey+cowboy+where+is+your+horse
8
+ string: ''
9
9
  headers:
10
10
  Accept-Encoding:
11
11
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
12
  Accept:
13
- - '*/*'
13
+ - "*/*"
14
14
  User-Agent:
15
15
  - Ruby
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
16
  response:
19
17
  status:
20
18
  code: 200
21
19
  message: OK
22
20
  headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ Date:
24
+ - Tue, 25 Aug 2015 18:55:20 GMT
23
25
  Pragma:
24
26
  - no-cache
25
- Date:
26
- - Wed, 23 Oct 2013 15:15:36 GMT
27
27
  Expires:
28
- - Wed, 23 Oct 2013 15:15:36 GMT
28
+ - Fri, 01 Jan 1990 00:00:00 GMT
29
29
  Cache-Control:
30
- - private, max-age=600
30
+ - no-cache, no-store, must-revalidate
31
31
  Content-Type:
32
- - text/javascript; charset=UTF-8
33
- Content-Language:
34
- - pl
35
- Set-Cookie:
36
- - PREF=ID=59f956040e7bb9f8:TM=1382541336:LM=1382541336:S=8F7wmAjCUSXM3gWD; expires=Fri,
37
- 23-Oct-2015 15:15:36 GMT; path=/; domain=.google.com
32
+ - application/json; charset=UTF-8
38
33
  X-Content-Type-Options:
39
34
  - nosniff
40
35
  Content-Disposition:
41
- - attachment
36
+ - attachment; filename="f.txt"
42
37
  Server:
43
38
  - HTTP server (unknown)
44
39
  X-Xss-Protection:
45
40
  - 1; mode=block
46
- Alternate-Protocol:
47
- - 80:quic
48
41
  Transfer-Encoding:
49
42
  - chunked
50
43
  body:
51
44
  encoding: ASCII-8BIT
52
45
  string: !binary |-
53
- W1tbImhleSBjb3dib3kgZ2R6aWU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NlXSxbImtvbmlhIiwwLHRydWUsZmFsc2VdLFsia29u
62
+ aW93aSIsMCx0cnVlLGZhbHNlXV0sW1syMCwzMF1dLCw1LDddXSwwLjE3NTQ0
63
+ NDU3LCxbWyJlbiJdLCxbMC4xNzU0NDQ1N11dXQ==
71
64
  http_version:
72
- recorded_at: Wed, 23 Oct 2013 15:15:36 GMT
73
- recorded_with: VCR 2.5.0
65
+ recorded_at: Tue, 25 Aug 2015 18:55:20 GMT
66
+ recorded_with: VCR 2.9.3
@@ -1,67 +1,193 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: post
5
- uri: http://translate.google.com/translate_a/t?client=t&hl=pl&ie=UTF-8&oe=UTF-8&prev=enter&sc=2&sl=en&ssel=0&tl=pl&tsel=0
4
+ method: get
5
+ uri: https://translate.google.com/translate_a/single?client=t&dt=at&hl=pl&ie=UTF-8&kc=2&oe=UTF-8&otf=2&q=ass&sl=en&srcrom=1&ssel=3&tk=522578%7C870062&tl=pl&tsel=6
6
6
  body:
7
7
  encoding: US-ASCII
8
- string: text=ass
8
+ string: ''
9
9
  headers:
10
10
  Accept-Encoding:
11
11
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
12
  Accept:
13
- - '*/*'
13
+ - "*/*"
14
14
  User-Agent:
15
15
  - Ruby
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
16
  response:
19
17
  status:
20
18
  code: 200
21
19
  message: OK
22
20
  headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ Date:
24
+ - Tue, 25 Aug 2015 18:55:20 GMT
23
25
  Pragma:
24
26
  - no-cache
25
- Date:
26
- - Wed, 23 Oct 2013 15:15:36 GMT
27
27
  Expires:
28
- - Wed, 23 Oct 2013 15:15:36 GMT
28
+ - Fri, 01 Jan 1990 00:00:00 GMT
29
29
  Cache-Control:
30
- - private, max-age=600
30
+ - no-cache, no-store, must-revalidate
31
31
  Content-Type:
32
- - text/javascript; charset=UTF-8
33
- Content-Language:
34
- - pl
35
- Set-Cookie:
36
- - PREF=ID=fd55461f0472f8d6:TM=1382541336:LM=1382541336:S=l-ad-xPtXXlsORED; expires=Fri,
37
- 23-Oct-2015 15:15:36 GMT; path=/; domain=.google.com
32
+ - application/json; charset=UTF-8
38
33
  X-Content-Type-Options:
39
34
  - nosniff
40
35
  Content-Disposition:
41
- - attachment
36
+ - attachment; filename="f.txt"
42
37
  Server:
43
38
  - HTTP server (unknown)
44
39
  X-Xss-Protection:
45
40
  - 1; mode=block
46
- Alternate-Protocol:
47
- - 80:quic
48
41
  Transfer-Encoding:
49
42
  - chunked
50
43
  body:
51
44
  encoding: ASCII-8BIT
52
45
  string: !binary |-
53
- W1tbInR5xYJlayIsImFzcyIsIiIsIiJdXSxbWyJyemVjem93bmlrIixbIm9z
54
- aW/FgiIsInR5xYJlayIsImR1cGEiLCJ6YWRlayJdLFtbIm9zaW/FgiIsWyJh
55
- c3MiLCJkb25rZXkiLCJqYWNrYXNzIiwiYnVycm8iLCJtb2tlIiwic3R1cGlk
56
- Il0sLDFdLFsidHnFgmVrIixbImJhY2tzaWRlIiwiYm90dG9tIiwiYnVtIiwi
57
- YmVoaW5kIiwiYnV0dG9ja3MiLCJhcnNlIl0sLDAuMjc3Njg5OTY0XSxbImR1
58
- cGEiLFsiYXNzIiwiZmFubnkiLCJhcnNlIl0sLDAuMTEyMTk2ODkyXSxbInph
59
- ZGVrIixbImJ1bSIsImFzcyIsImJhY2tzaWRlIiwiYnV0dG9ja3MiLCJib3R0
60
- b20iLCJmYW5ueSJdLCwwLjAwMTQzNDU5MTcyXV0sImFzcyIsMV1dLCJlbiIs
61
- LFtbInR5xYJlayIsWzRdLDEsMCw3NjUsMCwxLDBdXSxbWyJhc3MiLDQsW1si
62
- dHnFgmVrIiw3NjUsMSwwXSxbImR1cGEiLDIzMSwxLDBdLFsib3Npb8WCIiwy
63
- LDEsMF0sWyJvc8WCYSIsMCwxLDBdLFsiYXNzIiwwLDEsMF1dLFtbMCwzXV0s
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_with: VCR 2.5.0
192
+ recorded_at: Tue, 25 Aug 2015 18:55:20 GMT
193
+ recorded_with: VCR 2.9.3
@@ -7,7 +7,7 @@ describe Termit::TextTranslator do
7
7
  VCR.use_cassette('google_1') do
8
8
  translator = Termit::TextTranslator.new source_lang: :en, target_lang: :pl, text: 'hey cowboy where is your horse'
9
9
  translator.call
10
- expect(translator.text).to eq 'hey cowboy gdzie jest twój koń'
10
+ expect(translator.text).to eq 'hej kowbojem , gdzie jest twój koń'
11
11
  end
12
12
  end
13
13
  end
@@ -6,7 +6,7 @@ describe Termit::UrlConstructor do
6
6
  context "when talk flag is set to false" do
7
7
  it "returns correctly formatted url" do
8
8
  url_formatter = Termit::UrlConstructor.new source_lang: :en, target_lang: :fr, text: 'your mother', talk: false
9
- url = "http://translate.google.com/translate_a/t?client=t&sl=en&tl=fr&hl=pl&sc=2&ie=UTF-8&oe=UTF-8&prev=enter&ssel=0&tsel=0&"
9
+ url = "https://translate.google.com/translate_a/single?client=t&sl=en&tl=fr&hl=pl&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&srcrom=1&ssel=3&tsel=6&kc=2&tk=522578|870062"
10
10
 
11
11
  expect(url_formatter.url).to eq(url)
12
12
  end
@@ -15,7 +15,7 @@ describe Termit::UrlConstructor do
15
15
  context "when talk flag is set to true" do
16
16
  it "returns correctly formatted url" do
17
17
  url_formatter = Termit::UrlConstructor.new target_lang: :fr, text: 'your mother', talk: true
18
- url = "http://translate.google.com/translate_tts?tl=fr&ie=UTF-8&oe=UTF-8"
18
+ url = "https://translate.google.com/translate_tts?ie=UTF-8&tl=fr&total=1&idx=0&textlen=5&tk=735012&client=t"
19
19
  expect(url_formatter.url).to eq(url)
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.2
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-15 00:00:00.000000000 Z
11
+ date: 2015-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: delegate_it
@@ -142,7 +142,6 @@ files:
142
142
  - spec/fixtures/text_response_with_synonyms
143
143
  - spec/fixtures/text_response_without_synonyms
144
144
  - spec/spec_helper.rb
145
- - spec/termit/data_fetcher_spec.rb
146
145
  - spec/termit/main_spec.rb
147
146
  - spec/termit/output_manager_spec.rb
148
147
  - spec/termit/sound_response_handler_spec.rb
@@ -182,7 +181,6 @@ test_files:
182
181
  - spec/fixtures/text_response_with_synonyms
183
182
  - spec/fixtures/text_response_without_synonyms
184
183
  - spec/spec_helper.rb
185
- - spec/termit/data_fetcher_spec.rb
186
184
  - spec/termit/main_spec.rb
187
185
  - spec/termit/output_manager_spec.rb
188
186
  - spec/termit/sound_response_handler_spec.rb
@@ -1,20 +0,0 @@
1
- #encoding: UTF-8
2
- require 'spec_helper'
3
-
4
- describe Termit::DataFetcher do
5
- describe "data method" do
6
- let(:url) { "http://translate.google.com/?tl=fr&sl=en&ie=UTF-8&oe=UTF-8" }
7
- let(:text) { "it would require two large integer variables to store her weight, else she would cause a buffer overflow." }
8
- it "should send the correct POST request" do
9
- fetcher = Termit::DataFetcher.new url, text
10
- Net::HTTP.should_receive(:new)
11
- request = double 'fake_request'
12
- http = double 'fake_http', request: :good_response
13
- Net::HTTP::Post.stub(:new) { request }
14
- Net::HTTP::stub(:new) { http }
15
- http.should_receive(:request).with(request)
16
- request.should_receive(:set_form_data).with(text: text)
17
- fetcher.data.should eq :good_response
18
- end
19
- end
20
- end