gengo / gengo-ruby Goto Github PK
View Code? Open in Web Editor NEWA Ruby library to interface with the Gengo API for translation.
Home Page: http://gengo.com/api/
A Ruby library to interface with the Gengo API for translation.
Home Page: http://gengo.com/api/
Hi,
When posting a test job with data:
data = {
:jobs=>
{
:job_1=>
{
:type=>"text",
:slug=>"Single :: English to Japanese",
:body_src=>"Testing Gengo API library calls.",
:lc_src=>"en",
:lc_tgt=>"ja",
:tier=>"machine",
:auto_approve=>1,
:comment=>"Instructions for translators on this specific job go here",
:custom_data=>"your optional custom data, limited to 1kb.",
:force=>0, :use_preferred=>0
}
}
}
With a gengo client as follows:
gengo = Gengo::API.new({
:public_key => 'my_public_key',
:private_key => 'my_private_key',
:sandbox => true
})
Running a postTranslationJob as follows returns a 500:
2.3.3 :068 > gengo.postTranslationJobs(data)
Net::HTTPFatalError: 500 "Internal Server Error"
from /some_path/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/net/http/response.rb:120:in `error!'
from /path_to_project/gems/gengo-0.2.1/lib/gengo-ruby/api_handler.rb:180:in `send_to_gengo'
from /path_to_project/gems/gengo-0.2.1/lib/gengo-ruby/api_handler.rb:293:in `postTranslationJobs'
Debug information yields the following:
=> #<Gengo::API:0x007fe879242ef8 @opts={:public_key=>"my_public_key", :private_key=>"my_private_key", :access_token=>"", :api_version=>"2", :sandbox=>true, :user_agent=>"Gengo Ruby Library; Version 0.2.1; Ruby Version ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]; http://gengo.com/;", :debug=>true}, @debug=true, @api_host="api.sandbox.gengo.com", @client_info={"VERSION"=>"0.2.1"}>
2.3.3 :081 > gengo.postTranslationJobs(data)
opening connection to api.sandbox.gengo.com:443...
opened
starting SSL for api.sandbox.gengo.com:443...
SSL established
<- "POST /v2/translate/jobs HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*, application/json\r\nUser-Agent: Ruby, Gengo Ruby Library; Version 0.2.1; Ruby Version ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]; http://gengo.com/;\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: close\r\nHost: api.sandbox.gengo.com\r\nContent-Length: 645\r\n\r\n"
<- "api_sig=086edd8852afbca640339a0e8fe3f1a6b1f1aa95&api_key=censored&data=%7B%22jobs%22%3A%7B%22job_1%22%3A%7B%22type%22%3A%22text%22%2C%22slug%22%3A%22Single+%3A%3A+English+to+Japanese%22%2C%22body_src%22%3A%22Testing+Gengo+API+library+calls.%22%2C%22lc_src%22%3A%22en%22%2C%22lc_tgt%22%3A%22ja%22%2C%22tier%22%3A%22machine%22%2C%22auto_approve%22%3A1%2C%22comment%22%3A%22Instructions+for+translators+on+this+specific+job+go+here%22%2C%22custom_data%22%3A%22your+optional+custom+data%2C+limited+to+1kb.%22%2C%22force%22%3A0%2C%22use_preferred%22%3A0%7D%7D%7D&ts=1496061465"
-> "HTTP/1.1 500 Internal Server Error\r\n"
-> "Content-Type: text/html; charset=UTF-8\r\n"
-> "Date: Mon, 29 May 2017 12:37:47 GMT\r\n"
-> "Server: openresty/1.7.10.2\r\n"
-> "Content-Length: 277\r\n"
-> "Connection: Close\r\n"
-> "\r\n"
reading 277 bytes...
-> "\nFatal error: Class 'SimpleXMLElement' not found in /srv/customer-api/vendor/matthiasnoback/microsoft-translator/src/MatthiasNoback/MicrosoftTranslator/ApiCall/AbstractMicrosoftTranslatorApiCall.php on line 29\n{\"opstat\":\"error\",\"err\":{\"msg\":\"Internal Server Error\",\"code\":500}}"
read 277 bytes
Conn close
Net::HTTPFatalError: 500 "Internal Server Error"
Any assistance would be great, not sure where to start. Retrieval of the language lists etc. seems to work fine. My assumption is something has been updated/deleted by mistake.
I get this on several calls. It's pretty clear in the code that set_debug_output
is occurring after the start
, e.g. api_handler.rb
lines 90 and 92.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.