bing_translator 4.2.1 → 4.3.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 +5 -13
  2. data/lib/bing_translator.rb +10 -3
  3. metadata +6 -5
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MmRkZDUyODlmN2Y3ZTgzNDc4NWJiOWM2OTkwZDA3OGQ2ODhlZGJhZA==
5
- data.tar.gz: !binary |-
6
- NGJmZDExNTgxOWZlNDZhNDhlZWIzMmYwMjEyYTEyNTk4MmM3ZTE0MA==
2
+ SHA1:
3
+ metadata.gz: bfe0dc8d0cc5ca1c5a1a2d3112efd7f07cf56664
4
+ data.tar.gz: 9d6ac148cafbbb516a2faa87b154aa0a243dd0c5
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YTBiOTFjMjY3ZmQ1MTYzYzJmYzAzN2VhMDUyMzFhMThiM2JlMThlYzViOWU3
10
- NjA3NWU0YzQ2MjZkZjcwNGE4NzM4ZjU0NGRjYmI1ODczMmRlNzg0NjY5M2Nj
11
- YzVjYjViNzg3OWQzMzNkMmU1ODkzYmQ2YzA0NjM1YzViNDdiYTU=
12
- data.tar.gz: !binary |-
13
- NTIwMDZlM2U2M2Q3MzdkZGQxMTJhYzE3MTY3MjdjN2MxZTU0YTIxZGM4M2U4
14
- N2M3MWRkYmU2NzQ2ZmZhNmViNGVmYThmMzNmOGI5OTg1NzgwMGE5Y2IzNzMy
15
- ODEzOGQ1Y2RkY2ZkYzBlOTgxZGQ0MGZmYzhjN2UxYjllNDJlZDU=
6
+ metadata.gz: 548613d4c84b7738be93b5c35f059c3d8d667dabfac829596afaf93ed538ea34eef31712fb5cfd3b1d0dc23cceed687bdd5f18fda042ad9590f5676d39cb54c5
7
+ data.tar.gz: eaa639622451b57c77c21dd8375fe2ae4ad19bfaa3bd0b9a80df3224aaa75b995ac5718c4acd9dab71f0c984c4c13c333b10e3e8ee4a699772ad289e0472fbff
@@ -51,7 +51,7 @@ class BingTranslator
51
51
  'language' => '',
52
52
  }
53
53
 
54
- result = result(:detect, params).body[:detect_response][:detect_result].to_sym
54
+ result(:detect, params).body[:detect_response][:detect_result].to_sym
55
55
  end
56
56
 
57
57
  # format: 'audio/wav' [default] or 'audio/mp3'
@@ -88,6 +88,13 @@ class BingTranslator
88
88
  result(:get_languages_for_translate).body[:get_languages_for_translate_response][:get_languages_for_translate_result][:string]
89
89
  end
90
90
 
91
+ def language_names(codes, locale = 'en')
92
+ response = result(:get_language_names, locale: locale, languageCodes: {'a:string' => codes}) do
93
+ attributes 'xmlns:a' => 'http://schemas.microsoft.com/2003/10/Serialization/Arrays'
94
+ end
95
+
96
+ response.body[:get_language_names_response][:get_language_names_result][:string]
97
+ end
91
98
 
92
99
  def balance
93
100
  datasets["d"]["results"].each do |result|
@@ -114,11 +121,11 @@ private
114
121
  end
115
122
 
116
123
  # Public: performs actual request to Bing Translator SOAP API
117
- def result(action, params={})
124
+ def result(action, params = {}, &block)
118
125
  # Specify SOAP namespace in tag names (see https://github.com/savonrb/savon/issues/340 )
119
126
  params = Hash[params.map{|k,v| ["v2:#{k}", v]}]
120
127
  begin
121
- soap_client.call(action, message: params)
128
+ soap_client.call(action, message: params, &block)
122
129
  rescue AuthenticationException
123
130
  raise
124
131
  rescue StandardError => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bing_translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.3.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: 2013-12-22 00:00:00.000000000 Z
11
+ date: 2014-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -70,18 +70,19 @@ 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.1.11
83
+ rubygems_version: 2.0.3
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Translate using the Bing HTTP API
87
87
  test_files: []
88
+ has_rdoc: