bing_translator 4.5.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bing_translator.rb +16 -0
  3. metadata +13 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6aa2feb9308fe7f78b458c0d01040ec3ec5fc994
4
- data.tar.gz: a8167bc17eb99fc49e5250c7679801eca9fa8e4d
3
+ metadata.gz: 83055c8b2f4de7db9d0ce2d41f9a1b092290ff94
4
+ data.tar.gz: 62d0896420ce97c3afa5abdb079dd8d706e1e11a
5
5
  SHA512:
6
- metadata.gz: 4f28167678917a0e032342fbb1ecac5de2b76ecb11ee8c60bcd644254342252c039b8cbf14ff7309321c8d0bb36169479caa764da5091fc93cee0590539f46d7
7
- data.tar.gz: aeb5fd8baa22fe0756d5cfe0592b416601dad8d1b91f34f7417043c72bffd706c8c500ffdb08769d99e22e5088c75bdc7e5ec20399b8564b4763d23011dd920b
6
+ metadata.gz: 4f18af208585d0b875606628cdd0abff184312fad19f973d5fd0f7e47d7e95df19fe7f05c5d0b225257692c2c31948465165495a7928b4aef4a116fc7461e4d1
7
+ data.tar.gz: 12fc8ea90925e854acad94aee9a08b04b0506a5cd57c155815660c40a32800e36a11686f3cbda69f1f131fdeccfae8667c1bc23225d7cbee1c36efce1efddb2c
@@ -60,6 +60,22 @@ class BingTranslator
60
60
  array_wrap(result(:translate_array, params)[:translate_array_response]).map{|r| r[:translated_text]}
61
61
  end
62
62
 
63
+ def translate_array2(texts, params = {})
64
+ raise "Must provide :to." if params[:to].nil?
65
+
66
+ # Important notice: param order makes sense in SOAP. Do not reorder or delete!
67
+ params = {
68
+ 'texts' => { 'arr:string' => texts },
69
+ 'from' => params[:from].to_s,
70
+ 'to' => params[:to].to_s,
71
+ 'category' => 'general',
72
+ 'contentType' => params[:content_type] || 'text/plain'
73
+ }
74
+
75
+ array_wrap(result(:translate_array2, params)[:translate_array2_response]).map{|r| [r[:translated_text], r[:alignment]]}
76
+ end
77
+
78
+
63
79
  def detect(text)
64
80
  params = {
65
81
  'text' => text.to_s,
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bing_translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricky Elrod
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: savon
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: 2.10.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: 2.10.0
55
55
  description: Translate strings using the Bing HTTP API. Requires that you have a Client
56
56
  ID and Secret. See README.md for information.
57
57
  email: ricky@elrod.me
@@ -70,17 +70,17 @@ require_paths:
70
70
  - lib
71
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.0.3
83
+ rubygems_version: 2.4.8
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Translate using the Bing HTTP API