mygengo 1.8 → 1.9
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/README.md +1 -1
- data/lib/mygengo-ruby/api_handler.rb +232 -165
- data/lib/mygengo.rb +2 -2
- metadata +54 -6
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Question, Comments, Complaints, Praise?
|
|
23
23
|
If you have questions or comments and would like to reach us directly, please feel free to do
|
24
24
|
so at the following outlets. We love hearing from developers!
|
25
25
|
|
26
|
-
Email:
|
26
|
+
Email: api [at] mygengo dot com
|
27
27
|
Twitter: **[@mygengo_dev](http://twitter.com/mygengo_dev)**
|
28
28
|
|
29
29
|
If you come across any issues, please file them on the **[Github project issue tracker](https://github.com/myGengo/mygengo-ruby/issues)**. Thanks!
|
@@ -7,9 +7,11 @@ require 'cgi'
|
|
7
7
|
require 'json'
|
8
8
|
require 'openssl'
|
9
9
|
require 'time'
|
10
|
+
require 'net/http/post/multipart'
|
11
|
+
require 'mime/types'
|
10
12
|
|
11
13
|
module MyGengo
|
12
|
-
|
14
|
+
|
13
15
|
# The only real class that ever needs to be instantiated.
|
14
16
|
class API
|
15
17
|
attr_accessor :api_host
|
@@ -63,16 +65,16 @@ module MyGengo
|
|
63
65
|
def get_from_mygengo(endpoint, params = {})
|
64
66
|
# Do this small check here...
|
65
67
|
is_delete = params.delete(:is_delete)
|
66
|
-
|
68
|
+
|
67
69
|
# The first part of the object we're going to encode and use in our request to myGengo. The signing process
|
68
70
|
# is a little annoying at the moment, so bear with us...
|
69
71
|
query = {
|
70
72
|
:api_key => @opts[:public_key],
|
71
73
|
:ts => Time.now.gmtime.to_i.to_s
|
72
74
|
}
|
73
|
-
|
75
|
+
|
74
76
|
endpoint << "?api_sig=" + signature_of(query[:ts])
|
75
|
-
endpoint << '&' + query.map { |k, v| "#{k}=#{urlencode(v)}" }.join('&')
|
77
|
+
endpoint << '&' + query.map { |k, v| "#{k}=#{urlencode(v)}" }.join('&')
|
76
78
|
|
77
79
|
uri = "/v#{@opts[:api_version]}/" + endpoint
|
78
80
|
headers = {
|
@@ -109,10 +111,10 @@ module MyGengo
|
|
109
111
|
# <tt>endpoint</tt> - String/URL to post data to.
|
110
112
|
# <tt>params</tt> - Data necessary for request (keys, etc). Generally taken care of by the requesting instance.
|
111
113
|
def send_to_mygengo(endpoint, params = {})
|
112
|
-
|
114
|
+
|
113
115
|
# Check if this is a put
|
114
116
|
is_put = params.delete(:is_put)
|
115
|
-
|
117
|
+
|
116
118
|
query = {
|
117
119
|
:api_key => @opts[:public_key],
|
118
120
|
:data => params.to_json.gsub('"', '\"'),
|
@@ -126,7 +128,7 @@ module MyGengo
|
|
126
128
|
else
|
127
129
|
request = Net::HTTP::Post.new(url.path)
|
128
130
|
end
|
129
|
-
|
131
|
+
|
130
132
|
request.add_field('Accept', 'application/json')
|
131
133
|
request.add_field('User-Agent', @opts[:user_agent])
|
132
134
|
|
@@ -137,7 +139,7 @@ module MyGengo
|
|
137
139
|
"data" => urlencode(params.to_json.gsub('\\', '\\\\')),
|
138
140
|
"ts" => Time.now.gmtime.to_i.to_s
|
139
141
|
}.map { |k, v| "#{k}=#{v}" }.flatten.join('&')
|
140
|
-
|
142
|
+
|
141
143
|
if @debug
|
142
144
|
http.set_debug_output($stdout)
|
143
145
|
end
|
@@ -159,179 +161,244 @@ module MyGengo
|
|
159
161
|
end
|
160
162
|
end
|
161
163
|
|
162
|
-
#
|
164
|
+
# The "UPLOAD" method; handles sending a file to the quote method
|
163
165
|
#
|
164
166
|
# Options:
|
165
|
-
# <tt>
|
166
|
-
|
167
|
-
|
168
|
-
end
|
167
|
+
# <tt>endpoint</tt> - String/URL to post data to.
|
168
|
+
# <tt>params</tt> - Data necessary for request (keys, etc). Generally taken care of by the requesting instance.
|
169
|
+
def upload_to_mygengo(endpoint, params = {})
|
169
170
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
171
|
+
# prepare the file_hash and append file_key to each job payload
|
172
|
+
files_hash = params[:jobs].each_value.reduce({}) do |hash_thus_far, job_values|
|
173
|
+
job_mime_type = MIME::Types.type_for(job_values[:file_path]).first.content_type
|
174
|
+
file_hash_key = "file_#{hash_thus_far.length.to_s}".to_sym
|
175
|
+
job_values[:file_key] = file_hash_key
|
176
|
+
hash_thus_far[file_hash_key] = UploadIO.new(File.open(job_values[:file_path]), job_mime_type, File.basename(job_values[:file_path]))
|
177
|
+
hash_thus_far
|
178
|
+
end
|
177
179
|
|
178
|
-
|
179
|
-
# successful or not. Param list is quite expansive here, pay attention...
|
180
|
-
#
|
181
|
-
# Options:
|
182
|
-
# <tt>job</tt> - A job is a hash of data describing what you want translated. See the examples included for
|
183
|
-
# more information on what this should be. (type/slug/body_src/lc_src/lc_tgt/tier/auto_approve/comment/callback_url/custom_data)
|
184
|
-
def postTranslationJob(params = {})
|
185
|
-
self.send_to_mygengo('translate/job', params)
|
186
|
-
end
|
180
|
+
url = URI.parse("http://#{@api_host}/v#{@opts[:api_version]}/#{endpoint}")
|
187
181
|
|
188
|
-
|
189
|
-
#
|
190
|
-
# Options:
|
191
|
-
# <tt>jobs</tt> - "Jobs" is a hash containing further hashes; each further hash is a job. This is best seen in the example code.
|
192
|
-
def postTranslationJobs(params = {})
|
193
|
-
self.send_to_mygengo('translate/jobs', params)
|
194
|
-
end
|
182
|
+
http = Net::HTTP.new(url.host, url.port)
|
195
183
|
|
196
|
-
|
197
|
-
#
|
198
|
-
# Options:
|
199
|
-
# <tt>id</tt> - The ID of a job to update.
|
200
|
-
# <tt>action</tt> - A hash describing the update to this job. See the examples for further documentation.
|
201
|
-
def updateTranslationJob(params = {})
|
202
|
-
params[:is_put] = true
|
203
|
-
self.send_to_mygengo('translate/job/:id'.gsub(':id', params.delete(:id).to_s), params)
|
204
|
-
end
|
184
|
+
call_timestamp = Time.now.gmtime.to_i.to_s
|
205
185
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
params[:is_put] = true
|
213
|
-
self.send_to_mygengo('translate/jobs', {:jobs => params[:jobs], :action => params[:action]})
|
214
|
-
end
|
186
|
+
the_hash = files_hash.merge({
|
187
|
+
"api_sig" => signature_of(call_timestamp),
|
188
|
+
"api_key" => @opts[:public_key],
|
189
|
+
"data" =>params.to_json.gsub('\\', '\\\\'),
|
190
|
+
"ts" => call_timestamp
|
191
|
+
})
|
215
192
|
|
216
|
-
|
217
|
-
#
|
218
|
-
# <tt>id</tt> - The ID of a job to check.
|
219
|
-
# <tt>pre_mt</tt> - Optional, get a machine translation if the human translation is not done.
|
220
|
-
def getTranslationJob(params = {})
|
221
|
-
self.get_from_mygengo('translate/job/:id'.gsub(':id', params.delete(:id).to_s), params)
|
222
|
-
end
|
193
|
+
request = Net::HTTP::Post::Multipart.new(url.path, the_hash, {'Accept' => 'application/json', 'User-Agent' => @opts[:user_agent] })
|
223
194
|
|
224
|
-
|
225
|
-
|
226
|
-
# <tt>status</tt> - Optional. "unpaid", "available", "pending", "reviewable", "approved", "rejected", or "canceled".
|
227
|
-
# <tt>timestamp_after</tt> - Optional. Epoch timestamp from which to filter submitted jobs.
|
228
|
-
# <tt>count</tt> - Optional. Defaults to 10.
|
229
|
-
def getTranslationJobs(params = {})
|
230
|
-
if params[:ids] and params[:ids].kind_of?(Array)
|
231
|
-
params[:ids] = params[:ids].map { |i| i.to_s() }.join(',')
|
232
|
-
self.get_from_mygengo('translate/jobs/:ids'.gsub(':ids', params.delete(:ids)))
|
233
|
-
else
|
234
|
-
self.get_from_mygengo('translate/jobs', params)
|
195
|
+
if @debug
|
196
|
+
http.set_debug_output($stdout)
|
235
197
|
end
|
236
|
-
end
|
237
|
-
|
238
|
-
# Pulls a group of jobs that were previously submitted together.
|
239
|
-
#
|
240
|
-
# <tt>id</tt> - Required, the ID of a job that you want the batch/group of.
|
241
|
-
def getTranslationJobBatch(params = {})
|
242
|
-
self.get_from_mygengo('translate/jobs/group/:group_id'.gsub(':group_id', params.delete(:group_id).to_s), params)
|
243
|
-
end
|
244
|
-
|
245
|
-
# Mirrors the bulk Translation call, but just returns an estimated cost.
|
246
|
-
def determineTranslationCost(params = {})
|
247
|
-
self.send_to_mygengo('translate/service/quote', params)
|
248
|
-
end
|
249
|
-
|
250
|
-
# Post a comment for a translator or myGengo on a job.
|
251
|
-
#
|
252
|
-
# Options:
|
253
|
-
# <tt>id</tt> - The ID of the job you're commenting on.
|
254
|
-
# <tt>comment</tt> - The comment to put on the job.
|
255
|
-
def postTranslationJobComment(params = {})
|
256
|
-
self.send_to_mygengo('translate/job/:id/comment'.gsub(':id', params.delete(:id).to_s), params)
|
257
|
-
end
|
258
198
|
|
259
|
-
|
260
|
-
#
|
261
|
-
# Options:
|
262
|
-
# <tt>id</tt> - The ID of the job to get comments for.
|
263
|
-
def getTranslationJobComments(params = {})
|
264
|
-
self.get_from_mygengo('translate/job/:id/comments'.gsub(':id', params.delete(:id).to_s), params)
|
265
|
-
end
|
266
|
-
|
267
|
-
# Returns the feedback you've submitted for a given job.
|
268
|
-
#
|
269
|
-
# Options:
|
270
|
-
# <tt>id</tt> - The ID of the translation job you're retrieving comments from.
|
271
|
-
def getTranslationJobFeedback(params = {})
|
272
|
-
self.get_from_mygengo('translate/job/:id/feedback'.gsub(':id', params.delete(:id).to_s), params)
|
273
|
-
end
|
274
|
-
|
275
|
-
# Gets a list of the revision resources for a job. Revisions are created each time a translator updates the text.
|
276
|
-
#
|
277
|
-
# Options:
|
278
|
-
# <tt>id</tt> - The ID of the translation job you're getting revisions from.
|
279
|
-
def getTranslationJobRevisions(params = {})
|
280
|
-
self.get_from_mygengo('translate/job/:id/revisions'.gsub(':id', params.delete(:id).to_s), params)
|
281
|
-
end
|
282
|
-
|
283
|
-
# Get a specific revision to a job.
|
284
|
-
#
|
285
|
-
# Options:
|
286
|
-
# <tt>id</tt> - The ID of the translation job you're getting revisions from.
|
287
|
-
# <tt>rev_id</tt> - The ID of the revision you're looking up.
|
288
|
-
def getTranslationJobRevision(params = {})
|
289
|
-
self.get_from_mygengo('translate/job/:id/revisions/:revision_id'.gsub(':id', params.delete(:id).to_s).gsub(':revision_id', params.delete(:rev_id).to_s), params)
|
290
|
-
end
|
199
|
+
resp = http.request(request)
|
291
200
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
# <tt>id</tt> - The ID of the job you want a preview image of.
|
296
|
-
def getTranslationJobPreviewImage(params = {})
|
297
|
-
self.get_from_mygengo('translate/job/:id/preview'.gsub(':id', params.delete(:id).to_s), params)
|
298
|
-
end
|
201
|
+
case resp
|
202
|
+
when Net::HTTPSuccess, Net::HTTPRedirection
|
203
|
+
json = JSON.parse(resp.body)
|
299
204
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
# <tt>id</tt> - The ID of the job you want to delete.
|
304
|
-
def deleteTranslationJob(params = {})
|
305
|
-
params[:is_delete] = true
|
306
|
-
self.get_from_mygengo('translate/job/:id'.gsub(':id', params.delete(:id).to_s), params)
|
307
|
-
end
|
205
|
+
if json['opstat'] != 'ok'
|
206
|
+
raise MyGengo::Exception.new(json['opstat'], json['err']['code'].to_i, json['err']['msg'])
|
207
|
+
end
|
308
208
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
def deleteTranslationJobs(params = {})
|
314
|
-
if params[:ids] and params[:ids].kind_of?(Array)
|
315
|
-
params[:job_ids] = params[:ids].map { |i| i.to_s() }.join(',')
|
316
|
-
params.delete(:ids)
|
209
|
+
# Return it if there are no problems, nice...
|
210
|
+
json
|
211
|
+
else
|
212
|
+
resp.error!
|
317
213
|
end
|
318
|
-
|
319
|
-
params[:is_delete] = true
|
320
|
-
self.get_from_mygengo('translate/jobs', params)
|
321
214
|
end
|
322
215
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
216
|
+
# Returns a Ruby-hash of the stats for the current account. No arguments required!
|
217
|
+
#
|
218
|
+
# Options:
|
219
|
+
# <tt>None</tt> - N/A
|
220
|
+
def getAccountStats(params = {})
|
221
|
+
self.get_from_mygengo('account/stats', params)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Returns a Ruby-hash of the balance for the authenticated account. No args required!
|
225
|
+
#
|
226
|
+
# Options:
|
227
|
+
# <tt>None</tt> - N/A
|
228
|
+
def getAccountBalance(params = {})
|
229
|
+
self.get_from_mygengo('account/balance', params)
|
230
|
+
end
|
231
|
+
|
232
|
+
# Posts a translation job over to myGengo, returns a response indicating whether the submission was
|
233
|
+
# successful or not. Param list is quite expansive here, pay attention...
|
234
|
+
#
|
235
|
+
# Options:
|
236
|
+
# <tt>job</tt> - A job is a hash of data describing what you want translated. See the examples included for
|
237
|
+
# more information on what this should be. (type/slug/body_src/lc_src/lc_tgt/tier/auto_approve/comment/callback_url/custom_data)
|
238
|
+
def postTranslationJob(params = {})
|
239
|
+
self.send_to_mygengo('translate/job', params)
|
240
|
+
end
|
241
|
+
|
242
|
+
# Much like the above, but takes a hash titled "jobs" that is multiple jobs, each with their own unique key.
|
243
|
+
#
|
244
|
+
# Options:
|
245
|
+
# <tt>jobs</tt> - "Jobs" is a hash containing further hashes; each further hash is a job. This is best seen in the example code.
|
246
|
+
def postTranslationJobs(params = {})
|
247
|
+
self.send_to_mygengo('translate/jobs', params)
|
248
|
+
end
|
249
|
+
|
250
|
+
# Updates an already submitted job.
|
251
|
+
#
|
252
|
+
# Options:
|
253
|
+
# <tt>id</tt> - The ID of a job to update.
|
254
|
+
# <tt>action</tt> - A hash describing the update to this job. See the examples for further documentation.
|
255
|
+
def updateTranslationJob(params = {})
|
256
|
+
params[:is_put] = true
|
257
|
+
self.send_to_mygengo('translate/job/:id'.gsub(':id', params.delete(:id).to_s), params)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Updates a group of already submitted jobs.
|
261
|
+
#
|
262
|
+
# Options:
|
263
|
+
# <tt>jobs</tt> - An Array of job objects to update (job objects or ids)
|
264
|
+
# <tt>action</tt> - A String describing the update to this job. "approved", "rejected", etc - see myGengo docs.
|
265
|
+
def updateTranslationJobs(params = {})
|
266
|
+
params[:is_put] = true
|
267
|
+
self.send_to_mygengo('translate/jobs', {:jobs => params[:jobs], :action => params[:action]})
|
268
|
+
end
|
269
|
+
|
270
|
+
# Given an ID, pulls down information concerning that job from myGengo.
|
271
|
+
#
|
272
|
+
# <tt>id</tt> - The ID of a job to check.
|
273
|
+
# <tt>pre_mt</tt> - Optional, get a machine translation if the human translation is not done.
|
274
|
+
def getTranslationJob(params = {})
|
275
|
+
self.get_from_mygengo('translate/job/:id'.gsub(':id', params.delete(:id).to_s), params)
|
276
|
+
end
|
277
|
+
|
278
|
+
# Pulls down a list of recently submitted jobs, allows some filters.
|
279
|
+
#
|
280
|
+
# <tt>status</tt> - Optional. "unpaid", "available", "pending", "reviewable", "approved", "rejected", or "canceled".
|
281
|
+
# <tt>timestamp_after</tt> - Optional. Epoch timestamp from which to filter submitted jobs.
|
282
|
+
# <tt>count</tt> - Optional. Defaults to 10.
|
283
|
+
def getTranslationJobs(params = {})
|
284
|
+
if params[:ids] and params[:ids].kind_of?(Array)
|
285
|
+
params[:ids] = params[:ids].map { |i| i.to_s() }.join(',')
|
286
|
+
self.get_from_mygengo('translate/jobs/:ids'.gsub(':ids', params.delete(:ids)))
|
287
|
+
else
|
288
|
+
self.get_from_mygengo('translate/jobs', params)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
# Pulls a group of jobs that were previously submitted together.
|
293
|
+
#
|
294
|
+
# <tt>id</tt> - Required, the ID of a job that you want the batch/group of.
|
295
|
+
def getTranslationJobBatch(params = {})
|
296
|
+
self.get_from_mygengo('translate/jobs/group/:group_id'.gsub(':group_id', params.delete(:group_id).to_s), params)
|
297
|
+
end
|
298
|
+
|
299
|
+
# Pulls a group of jobs that were previously submitted together.
|
300
|
+
#
|
301
|
+
# <tt>id</tt> - Required, the ID of a job that you want the batch/group of.
|
302
|
+
def getTranslationOrderJobs(params = {})
|
303
|
+
self.get_from_mygengo('translate/order/:order_id'.gsub(':order_id', params.delete(:order_id).to_s), params)
|
304
|
+
end
|
305
|
+
|
306
|
+
# Mirrors the bulk Translation call, but just returns an estimated cost.
|
307
|
+
def determineTranslationCost(params = {})
|
308
|
+
is_upload = params.delete(:is_upload)
|
309
|
+
|
310
|
+
if is_upload
|
311
|
+
self.upload_to_mygengo('translate/service/quote/file', params)
|
312
|
+
else
|
313
|
+
self.send_to_mygengo('translate/service/quote', params)
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
# Post a comment for a translator or myGengo on a job.
|
318
|
+
#
|
319
|
+
# Options:
|
320
|
+
# <tt>id</tt> - The ID of the job you're commenting on.
|
321
|
+
# <tt>comment</tt> - The comment to put on the job.
|
322
|
+
def postTranslationJobComment(params = {})
|
323
|
+
self.send_to_mygengo('translate/job/:id/comment'.gsub(':id', params.delete(:id).to_s), params)
|
324
|
+
end
|
325
|
+
|
326
|
+
# Get all comments (the history) from a given job.
|
327
|
+
#
|
328
|
+
# Options:
|
329
|
+
# <tt>id</tt> - The ID of the job to get comments for.
|
330
|
+
def getTranslationJobComments(params = {})
|
331
|
+
self.get_from_mygengo('translate/job/:id/comments'.gsub(':id', params.delete(:id).to_s), params)
|
332
|
+
end
|
333
|
+
|
334
|
+
# Returns the feedback you've submitted for a given job.
|
335
|
+
#
|
336
|
+
# Options:
|
337
|
+
# <tt>id</tt> - The ID of the translation job you're retrieving comments from.
|
338
|
+
def getTranslationJobFeedback(params = {})
|
339
|
+
self.get_from_mygengo('translate/job/:id/feedback'.gsub(':id', params.delete(:id).to_s), params)
|
340
|
+
end
|
341
|
+
|
342
|
+
# Gets a list of the revision resources for a job. Revisions are created each time a translator updates the text.
|
343
|
+
#
|
344
|
+
# Options:
|
345
|
+
# <tt>id</tt> - The ID of the translation job you're getting revisions from.
|
346
|
+
def getTranslationJobRevisions(params = {})
|
347
|
+
self.get_from_mygengo('translate/job/:id/revisions'.gsub(':id', params.delete(:id).to_s), params)
|
348
|
+
end
|
349
|
+
|
350
|
+
# Get a specific revision to a job.
|
351
|
+
#
|
352
|
+
# Options:
|
353
|
+
# <tt>id</tt> - The ID of the translation job you're getting revisions from.
|
354
|
+
# <tt>rev_id</tt> - The ID of the revision you're looking up.
|
355
|
+
def getTranslationJobRevision(params = {})
|
356
|
+
self.get_from_mygengo('translate/job/:id/revisions/:revision_id'.gsub(':id', params.delete(:id).to_s).gsub(':revision_id', params.delete(:rev_id).to_s), params)
|
357
|
+
end
|
358
|
+
|
359
|
+
# Returns a preview image for a job.
|
360
|
+
#
|
361
|
+
# Options:
|
362
|
+
# <tt>id</tt> - The ID of the job you want a preview image of.
|
363
|
+
def getTranslationJobPreviewImage(params = {})
|
364
|
+
self.get_from_mygengo('translate/job/:id/preview'.gsub(':id', params.delete(:id).to_s), params)
|
365
|
+
end
|
366
|
+
|
367
|
+
# Deletes a job.
|
368
|
+
#
|
369
|
+
# Options:
|
370
|
+
# <tt>id</tt> - The ID of the job you want to delete.
|
371
|
+
def deleteTranslationJob(params = {})
|
372
|
+
params[:is_delete] = true
|
373
|
+
self.get_from_mygengo('translate/job/:id'.gsub(':id', params.delete(:id).to_s), params)
|
374
|
+
end
|
375
|
+
|
376
|
+
# Deletes multiple jobs.
|
377
|
+
#
|
378
|
+
# Options:
|
379
|
+
# <tt>ids</tt> - An Array of job IDs you want to delete.
|
380
|
+
def deleteTranslationJobs(params = {})
|
381
|
+
if params[:ids] and params[:ids].kind_of?(Array)
|
382
|
+
params[:job_ids] = params[:ids].map { |i| i.to_s() }.join(',')
|
383
|
+
params.delete(:ids)
|
384
|
+
end
|
385
|
+
|
386
|
+
params[:is_delete] = true
|
387
|
+
self.get_from_mygengo('translate/jobs', params)
|
388
|
+
end
|
389
|
+
|
390
|
+
# Gets information about currently supported language pairs.
|
391
|
+
#
|
392
|
+
# Options:
|
393
|
+
# <tt>lc_src</tt> - Optional language code to filter on.
|
394
|
+
def getServiceLanguagePairs(params = {})
|
395
|
+
self.get_from_mygengo('translate/service/language_pairs', params)
|
396
|
+
end
|
397
|
+
|
398
|
+
# Pulls down currently supported languages.
|
399
|
+
def getServiceLanguages(params = {})
|
400
|
+
self.get_from_mygengo('translate/service/languages', params)
|
401
|
+
end
|
402
|
+
end
|
336
403
|
|
337
404
|
end
|
data/lib/mygengo.rb
CHANGED
@@ -7,10 +7,10 @@ module MyGengo
|
|
7
7
|
module Config
|
8
8
|
# API url endpoints; replace the version at function call time to
|
9
9
|
# allow for function-by-function differences in versioning.
|
10
|
-
API_HOST = 'api.
|
10
|
+
API_HOST = 'api.gengo.com'
|
11
11
|
SANDBOX_API_HOST = 'api.sandbox.mygengo.com'
|
12
12
|
|
13
13
|
# Pretty self explanatory.
|
14
|
-
VERSION = '1.
|
14
|
+
VERSION = '1.9'
|
15
15
|
end
|
16
16
|
end
|
metadata
CHANGED
@@ -1,23 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mygengo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.9'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Ryan McGrath
|
8
|
+
- Ryan McGrath
|
9
9
|
- Matthew Romaine
|
10
10
|
- Kim Alhstrom
|
11
11
|
- Lloyd Chan
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-
|
16
|
-
dependencies:
|
15
|
+
date: 2012-07-11 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: json
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: multipart-post
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: mime-types
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
17
65
|
description: myGengo is a service that offers various translation APIs, both machine
|
18
66
|
and high quality human-sourced. The mygengo gem lets you interface with the myGengo
|
19
67
|
REST API (http://mygengo.com/services/api/dev-docs/).
|
20
|
-
email:
|
68
|
+
email: api@gengo.com
|
21
69
|
executables: []
|
22
70
|
extensions: []
|
23
71
|
extra_rdoc_files: []
|
@@ -48,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
96
|
version: '0'
|
49
97
|
requirements: []
|
50
98
|
rubyforge_project:
|
51
|
-
rubygems_version: 1.8.
|
99
|
+
rubygems_version: 1.8.24
|
52
100
|
signing_key:
|
53
101
|
specification_version: 3
|
54
102
|
summary: A library for interfacing with the myGengo Translation API.
|