idiom 0.5.0 → 0.5.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
data/idiom.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "idiom"
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Coleman"]
@@ -7,12 +7,19 @@ class MicrosoftTranslator
7
7
  # "http://api.microsofttranslator.com/V2/Http.svc/Translate?to=#{code}&text=#{}&appId=2CEF8B6B9CA38C6C8355B154C760C28A66E4339F"
8
8
 
9
9
  appId = CONFIG["appId"]
10
- result = Net::HTTP.get(URI.parse("http://api.microsofttranslator.com/V2/Http.svc/Translate?to=#{code}&text=#{value}&appId=#{appId}"))
10
+ url = "http://api.microsofttranslator.com/V2/Http.svc/Translate?to=#{code}&text=#{value}&appId=#{appId}"
11
+ result = Net::HTTP.get(URI.parse(url))
11
12
 
12
13
  if result =~ /<string xmlns=\"http:\/\/schemas.microsoft.com\/2003\/10\/Serialization\/\">(.*)<\/string>/
13
14
  output = $1
14
15
  end
16
+ if result =~ /Message: (.*)/
17
+ $stdout.puts(result)
18
+ end
19
+ if result =~ /AppId is over the quota/
20
+ raise "AppId is over the quota"
21
+ end
15
22
  output.to_s
16
23
  end
17
24
  end
18
- end
25
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idiom
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Coleman