I'm new to Ruby and Rails and am to develop and write a simple connector to use an API Service for my Rails APP. I have a connector which uses CGI class with RUby. Now I want to implement the same on rails platform. How will it go? What are the alternative classes (or gems) that provide similar functionality as of CGI for rails
As for instance I have this code :
cgi = CGI.new
if cgi.params['jsonString']!=""
data=cgi.params['jsonString'].to_s
data.delete! '\\'
data.delete! '['
data.delete! ']'
data=data[1..-1]
data=data[0..-2]
shieldsquare_service_url = 'http://' + $_ss2_domain + '/getss2data'
shieldsquare_request = JSON.parse(CGI::unescape(data))
shieldsquare_request["sid"] = $_sid
shieldsquare_request["host"] = ENV[$_ipaddress]
shieldsquare_post_data = JSON.generate(shieldsquare_request)
if $_async_http_post== true
error_code=shieldsquare_post_async shieldsquare_service_url, shieldsquare_post_data,$_timeout_value.to_s
else
error_code=shieldsquare_post_sync shieldsquare_service_url, shieldsquare_post_data, $_timeout_value
end
end
Please Guide me on this topic
Aucun commentaire:
Enregistrer un commentaire