mygengo 1.9 → 1.10

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.
@@ -65,6 +65,7 @@ module MyGengo
65
65
  def get_from_mygengo(endpoint, params = {})
66
66
  # Do this small check here...
67
67
  is_delete = params.delete(:is_delete)
68
+ is_get_preview = params.delete(:get_preview_image)
68
69
 
69
70
  # The first part of the object we're going to encode and use in our request to myGengo. The signing process
70
71
  # is a little annoying at the moment, so bear with us...
@@ -92,14 +93,18 @@ module MyGengo
92
93
  http.request(req)
93
94
  end
94
95
 
95
- json = JSON.parse(resp.body)
96
+ if is_get_preview.nil?
97
+ json = JSON.parse(resp.body)
98
+ if json['opstat'] != 'ok'
99
+ raise MyGengo::Exception.new(json['opstat'], json['err']['code'].to_i, json['err']['msg'])
100
+ end
96
101
 
97
- if json['opstat'] != 'ok'
98
- raise MyGengo::Exception.new(json['opstat'], json['err']['code'].to_i, json['err']['msg'])
99
- end
102
+ # Return it if there are no problems, nice...
103
+ return json
104
+ else
105
+ return resp.body
106
+ end
100
107
 
101
- # Return it if there are no problems, nice...
102
- json
103
108
  end
104
109
 
105
110
  # The "POST" method; handles shuttling up encoded job data to myGengo
@@ -361,6 +366,7 @@ module MyGengo
361
366
  # Options:
362
367
  # <tt>id</tt> - The ID of the job you want a preview image of.
363
368
  def getTranslationJobPreviewImage(params = {})
369
+ params[:get_preview_image] = true
364
370
  self.get_from_mygengo('translate/job/:id/preview'.gsub(':id', params.delete(:id).to_s), params)
365
371
  end
366
372
 
data/lib/mygengo.rb CHANGED
@@ -11,6 +11,6 @@ module MyGengo
11
11
  SANDBOX_API_HOST = 'api.sandbox.mygengo.com'
12
12
 
13
13
  # Pretty self explanatory.
14
- VERSION = '1.9'
14
+ VERSION = '1.10'
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mygengo
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.9'
4
+ version: '1.10'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-07-11 00:00:00.000000000 Z
15
+ date: 2012-07-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: json
@@ -62,9 +62,9 @@ dependencies:
62
62
  - - ! '>='
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
- description: myGengo is a service that offers various translation APIs, both machine
66
- and high quality human-sourced. The mygengo gem lets you interface with the myGengo
67
- REST API (http://mygengo.com/services/api/dev-docs/).
65
+ description: Gengo is a service that offers various translation APIs, both machine
66
+ and high quality human-sourced. The Gengo gem lets you interface with the Gengo
67
+ REST API (http://gengo.com/services/api/dev-docs/).
68
68
  email: api@gengo.com
69
69
  executables: []
70
70
  extensions: []
@@ -76,7 +76,7 @@ files:
76
76
  - licenses/LICENSE.txt
77
77
  - Rakefile
78
78
  - README.md
79
- homepage: http://mygengo.com/services/api/dev-docs/
79
+ homepage: http://gengo.com/services/api/dev-docs/
80
80
  licenses: []
81
81
  post_install_message:
82
82
  rdoc_options: []
@@ -99,5 +99,5 @@ rubyforge_project:
99
99
  rubygems_version: 1.8.24
100
100
  signing_key:
101
101
  specification_version: 3
102
- summary: A library for interfacing with the myGengo Translation API.
102
+ summary: A library for interfacing with the Gengo Translation API.
103
103
  test_files: []