What does "errors" of Twitter API's error response mean - twitter

Twitter API's error response is something like this.
{"errors":[{"message":"Sorry, that page does not exist","code":34}]}
But I don't know why the key name (errors) is plural form and the value is an array.
I have never seen multiple errors are listed on this array.
Are there any case? If it be, tell me how you send a request.
https://dev.twitter.com/docs/error-codes-responses

The error above usually means the user/object you called the API on does not exist. Occasionally, it's a transient error but mostly it's because the object has been deleted.
As for seeing "errors", I've seen it in quite a few places. Twitter error handling seems to be all over the map. Twitter usually, not always, returns JSON in content in error cases , which provides more data.
Copy-pasting part of python code (in progress) dealing with some "errors". Please ignore the RR_XXX since those are mappings to internal error codes for my app.
status = resp['status']
if not status == '200':
errJson = json.loads(content) //Handle "ValueError" with try-except
if 'error' in errJson:
# HTTP-401: {"request":"...", "error":"Not authorized"}
err_code = RR_TWITERR_NOT_AUTHORIZED
elif 'errors' in errJson:
errors = errJson['errors']
sub_code = errors[0]['code']
if sub_code == 88:
# HTTP-429: {"errors":[{"message":"Rate limit exceeded","code":88}]}
err_code = RR_TWITERR_RATELIMIT_EXCEEDED
elif sub_code == 130:
# HTTP-503: {"errors":[{"message":"Over capacity","code":130}]}
err_code = RR_TWITERR_OVER_CAPACITY
**elif sub_code == 34:
# HTTP-404: {"errors":[{"message":"Sorry, that page does not exist","code":34}]}**
err_code = RR_TWITERR_NOT_FOUND
elif sub_code == 32:
# HTTP-401:[{u'message': u'Could not authenticate you', u'code': 32}]
err_code = RR_TWITERR_NOT_AUTHENTICATED
elif sub_code == 63:
# HTTP 403:{"errors":[{"code":63,"message":"User has been suspended."}]}
err_code = RR_TWITERR_USER_SUSPENDED
elif sub_code == 131:
# HTTP-500:{"errors":[{"message":"Internal error","code":131}]}
err_code = RR_TWITERR_INTERNAL_ERROR
else:
err_code = RR_TWITERR_UNKNOWN
else:
err_code = RR_TWITERR_UNKNOWN
return err_code

Related

the io.input() method of lua did'nt work for user input

I still coding my project, and to got the user input I used io.input("*l") method to this
and worked very well, but for some reason it didn't work anymore.
The error message say:
C:\Program Files (x86)\Lua\5.1\lua.exe: .\nexus\guilogin.lua:16: bad argument #1 to 'input' (*l: Invalid argument)
I tryied search about it and I don't find anything about this error or how to fix this
the source of the script I still having this issue
strx = require 'pl.stringx'
wv = require 'src.nxwvinit'
ntutils = require 'src.nativeutils'
filesys = require 'src.nxfilesys'
workspace = require 'nexus.workspace'
local read = 1
login = {}
wvsrc = "nexus/windview/"
function login.init()
active = 1
while active == 1 do
userLogin = io.input("*l")
if userLogin ~= nil or userLogin ~= "" then
if checkUserExist(userLogin) ~= nil then
workspace.init()
else
print("Eat shit")
end
else
print("insert valid username")
end
end
end
-- check if user folder exists
function checkUserExist(username)
directory = "users"
curDir = io.popen("dir " .. directory .. "/b /ad")
dirLines = curDir:lines()
for dir in dirLines do
if string.find(dir, username) then
return username
else
return nil
end
end
end
return login
You are using wrong function.
io.input expects a filename.
You probably need io.read to read a line of input text.

Rails thread secure variables

I'm having an issue about thread secure variables. I have a controller method which sends sms to given numbers. But if users makes request at the same time variables are being overwritten.
I know RoR s not thread-secure and i have to make it but i couldnt do it with live response. If i would take all data from user and do it in a background job, it would be easier.
For example lets say first user tries to send sms to x number with the content a and the second user tries to send sms y number with the content b. If they make the requests at the exactly same moment x number getting two sms with content a and b.
def create
success = false
message = nil
status = 422
if params[:receivers].present? && params[:title].present? && params[:content].present?
if params[:is_future_sms].present? && params[:is_future_sms].to_s == 'true' && !params[:send_date].present?
render json: {success: false, message: 'Insufficient Parameter'}
else
sms = #account.sms_objects.new(sms_object_params)
sms.sms_title_id = set_sms_title_id
sms.receivers = sms.receivers.to_s
receivers = NumberOperations.sanitize_receivers_with_hash(sms.receivers)
if receivers.count > 0
total_count = sms.credit(sms.content)
sms_balance = sms.balance(sms.content)
receivers.map{|r| r[:balance] = sms_balance}
sms_balance = receivers.count * total_count
if #account.can_afford_sms?(sms_balance)
if sms.save
SendSmsJob.perform_later(sms.id, receivers)
success = true
message = 'Messages created successfully'
status = 201
else
success = false
message = sms.errors.full_messages.to_sentence
status = 422
end
else
success = false
message = 'Insufficient Credit'
status = 422
end
else
success = false
message = 'No valid number'
status = 422
end
end
else
success = false
message = 'Insufficient Parameter'
status = 422
end
render json: { success: success, message: message }, status: status
end
I guess i can solve the problem with mutex and Thread.new but when i use it it doesnt give the response to user.
def create
th = Thread.new do
# all code here
end
th.join
end
this works well but doesnt response at the end.
Yeyyy! I found the solution.
I've changed my server from puma to unicorn. And it works properly now.

Yahoo Fantasy Sports API routing/post errors

As a quick background: I've already successfully set up a small application that will connect to Yahoo's API and set my lineups on a daily basis using PUT requests on my team's roster per the Yahoo Developer's Guide.
Specifically, where I'm having problems now:
POST
Using POST, players can be added and/or dropped from a team, or trades
can be proposed. The URI for POSTing to transactions collection is:
http://fantasysports.yahooapis.com/fantasy/v2/league//transactions
The input XML format for a POST request to the transactions API for
replacing one player with another player in a team is:
<fantasy_content>
<transaction>
<type>add/drop</type>
<players>
<player>
<player_key>{player_key}</player_key>
<transaction_data>
<type>add</type>
<destination_team_key>{team_key}</destination_team_key>
</transaction_data>
</player>
<player>
<player_key>{player_key}</player_key>
<transaction_data>
<type>drop</type>
<source_team_key>{team_key}</source_team_key>
</transaction_data>
</player>
</players>
</transaction>
</fantasy_content>
My method for making a request is as follows:
def self.make_signed_request(address, method, user_id, input_file=nil )
# format http method and return false if not accepted API method
method = method.upcase
return false if ( method != "GET" ) && ( method != "POST" ) && ( method != "PUT")
# find user
user = User.find(user_id)
if ( user.yahoo_access_token_expiration.nil? || user.yahoo_access_token_expiration < Time.now )
# expired token, so renew
YahooOAuth.renew_token(user_id)
user.reload
end
# normalize text HMAC-SHA1
digest = OpenSSL::Digest.new('sha1')
nonce = rand(10 ** 30).to_s.rjust(30,'0')
timestamp = Time.now.to_i
text = method + "&" + CGI.escape("#{address}") + "&" + CGI.escape("oauth_consumer_key=#{YAHOO_OAUTH_API[:CLIENT_ID]}&oauth_nonce=#{nonce}&oauth_signature_method=HMAC-SHA1&oauth_timestamp=#{timestamp}&oauth_token=#{CGI.escape(user.yahoo_access_token)}&oauth_version=1.0")
# create key for HMAC-SHA1
key = CGI.escape("#{YAHOO_OAUTH_API[:CLIENT_SECRET]}")+ "&" + CGI.escape("#{user.yahoo_access_token_secret}")
# create HMAC-SHA1 signature for api request
hmac = OpenSSL::HMAC.digest(digest, key, text)
signature_sha1 = CGI.escape(Base64.strict_encode64(hmac))
# make API request
response = nil
if method == "GET"
response = Curl.get("#{address}?oauth_consumer_key=#{YAHOO_OAUTH_API[:CLIENT_ID]}&oauth_nonce=#{nonce}&oauth_signature_method=HMAC-SHA1&oauth_timestamp=#{timestamp}&oauth_token=#{CGI.escape(user.yahoo_access_token)}&oauth_version=1.0&oauth_signature=#{signature_sha1}")
elsif method == "POST"
# return "Not implemented"
response = Curl.post("#{address}?oauth_consumer_key=#{YAHOO_OAUTH_API[:CLIENT_ID]}&oauth_nonce=#{nonce}&oauth_signature_method=HMAC-SHA1&oauth_timestamp=#{timestamp}&oauth_token=#{CGI.escape(user.yahoo_access_token)}&oauth_version=1.0&oauth_signature=#{signature_sha1}", input_file) do |http|
http.headers['Accept'] = 'application/xml'
http.headers['Content-Type'] = 'application/xml'
end
elsif method == "PUT"
response = Curl.put("#{address}?oauth_consumer_key=#{YAHOO_OAUTH_API[:CLIENT_ID]}&oauth_nonce=#{nonce}&oauth_signature_method=HMAC-SHA1&oauth_timestamp=#{timestamp}&oauth_token=#{CGI.escape(user.yahoo_access_token)}&oauth_version=1.0&oauth_signature=#{signature_sha1}", input_file) do |http|
http.headers['Accept'] = 'application/xml'
http.headers['Content-Type'] = 'application/xml'
end
end
# return raw XML result
return response.body
end
When I make my request --
def add_drop(players)
# players are added in [{player_key}, {add/drop}, {faab_bid (or nil if not FAAB)}] form
url = "http://fantasysports.yahooapis.com/fantasy/v2/league/#{self.league.league_key}/transactions"
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.fantasy_content {
xml.transaction {
xml.type "add/drop"
xml.faab_bid players[0][2] unless players[0][2].nil?
xml.players {
players.each do |player|
xml.player {
xml.player_key player[0]
xml.transaction_data {
xml.type player[1] # this will be "add" or "drop"
# adds use "destination_team_key," drops use "source_team_key"
if player[1] == "add"
xml.destination_team_key self.team_key
else
xml.source_team_key self.team_key
end
} # transaction_data
} # player
end
} # players
} # transaction
} # fantasy_content
end # builder
xml_input = builder.to_xml
YahooOAuth.make_signed_request(url, 'put', self.user.id, xml_input)
end
--the XML generated is shown below --
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<fantasy_content>\n <transaction>\n <type>add/drop</type>\n <players>\n <player>\n <player_key>357.p.10171</player_key>\n <transaction_data>\n <type>add</type>\n <destination_team_key>370.l.4801.t.7</destination_team_key>\n </transaction_data>\n </player>\n <player>\n <player_key>357.p.9317</player_key>\n <transaction_data>\n <type>drop</type>\n <source_team_key>370.l.4801.t.7</source_team_key>\n </transaction_data>\n </player>\n </players>\n </transaction>\n</fantasy_content>\n"
-- and the two responses I'll get from Yahoo are:
> <?xml version="1.0" encoding="UTF-8"?> <error xml:lang="en-us"
> yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/league/370.l.4801/transactions/?oauth_consumer_key=dj0yJmk9dHBIa0h4ekhTSVBnJmQ9WVdrOVlUZHFkMnhMTXpJbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--&amp;oauth_nonce=892057444475304460343340318332&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1492097395&amp;oauth_token=A%3D2.86iTDxtT4nQ.wxTcn33mgnA8dm3AeME87YRjNthVjxiwfhqKr_oWt0HBgbBeS2DC_dNObN72m0ucgi7CsSFaRjpc5IcnZ_bpJNTC3pUXc37bgH8f0S4irpyXLz8s9ONAYYB.LIDT0sOUvdTgk_lPDnlr1GlPhCe7u54Sq.m_vwq1JQlNUzEVrEs3kOW9wiXk17BditA9OGaVE.tuepvpthDRVBhOye8qjb_ic7UZtT.lvccoGEdgvcShHSyg.YYcnShl7ks23G01hAcXrfGveEk0UncWKNmma42cYbg7bzSOY9ZZj3_hvU5rK3SjB1ADPe8bsIEe_Ba9KBhYxlWd9iyyAR_bloL9n0eeL_OQ6PoR4uGJ6VMUDn9n_ovDGvfgAfvtJs15pCcXPhYusuo1S7SJF1O3fLtR8TitmU1qW88x3SenY2U50dlRG9Y73iNUdnyYBpIHLg._pPkms26QhnuxSFfqpXcGleGXOuZ0.TNOE3Cp8VbLEOEIg6QkavgGLKyFetYhSQ879T4rfhfeEoWvwkjsO1BL2Y3n4Hp9cgfU4y3wZvT.b8qhP7QY0UTYtZkyYH.sydFUXUCec.yVGm29S.s.2N96tfr4qWaI0qntRE.X5MVdwfbhz94n9JshmduqurjKRLlMYVWnLZ_Yderm0HDvT7dnowjyUwBx2UxUKJooauQnNU67QQECmh.HZqcm_OBysLABvdtTtaPhnvJ1QViN_UUjslToVPOs1oyxoTNRbL0VL8yxJc&amp;oauth_version=1.0&amp;oauth_signature=UVmcj2S8c5vqkRgAxsdQ3MQZI54%3D"
> xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
> xmlns="http://www.yahooapis.com/v1/base.rng">
> <description>subresource 'transactions' not supported.</description>
> <detail/> </error>
and
> <?xml version="1.0" encoding="UTF-8"?> <error xml:lang="en-us"
> yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/league/370.l.4801/transactions?oauth_consumer_key=dj0yJmk9dHBIa0h4ekhTSVBnJmQ9WVdrOVlUZHFkMnhMTXpJbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNQ--&amp;oauth_nonce=503128074504907304111221170641&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1492097198&amp;oauth_token=A%3D2.86iTDxtT4nQ.wxTcn33mgnA8dm3AeME87YRjNthVjxiwfhqKr_oWt0HBgbBeS2DC_dNObN72m0ucgi7CsSFaRjpc5IcnZ_bpJNTC3pUXc37bgH8f0S4irpyXLz8s9ONAYYB.LIDT0sOUvdTgk_lPDnlr1GlPhCe7u54Sq.m_vwq1JQlNUzEVrEs3kOW9wiXk17BditA9OGaVE.tuepvpthDRVBhOye8qjb_ic7UZtT.lvccoGEdgvcShHSyg.YYcnShl7ks23G01hAcXrfGveEk0UncWKNmma42cYbg7bzSOY9ZZj3_hvU5rK3SjB1ADPe8bsIEe_Ba9KBhYxlWd9iyyAR_bloL9n0eeL_OQ6PoR4uGJ6VMUDn9n_ovDGvfgAfvtJs15pCcXPhYusuo1S7SJF1O3fLtR8TitmU1qW88x3SenY2U50dlRG9Y73iNUdnyYBpIHLg._pPkms26QhnuxSFfqpXcGleGXOuZ0.TNOE3Cp8VbLEOEIg6QkavgGLKyFetYhSQ879T4rfhfeEoWvwkjsO1BL2Y3n4Hp9cgfU4y3wZvT.b8qhP7QY0UTYtZkyYH.sydFUXUCec.yVGm29S.s.2N96tfr4qWaI0qntRE.X5MVdwfbhz94n9JshmduqurjKRLlMYVWnLZ_Yderm0HDvT7dnowjyUwBx2UxUKJooauQnNU67QQECmh.HZqcm_OBysLABvdtTtaPhnvJ1QViN_UUjslToVPOs1oyxoTNRbL0VL8yxJc&amp;oauth_version=1.0&amp;oauth_signature=oNaLute5djkIryUEKq0zF6prVFU%3D"
> xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
> xmlns="http://www.yahooapis.com/v1/base.rng">
> <description>Invalid XML POSTed. Error code 25 at line 3, column 0 of input XML.</description>
> <detail/> </error>
I'm honestly not sure what differentiates between the two responses, as I've gotten both responses with what I'm pretty sure are the same XML inputs and POST parameters.
Does anybody have any insight?
Just ran into the same issue, and this Stack Overflow article was the only relevant link I found on the web. Decided it was time I gave back to this community...
The problem is that one of the sample XMLs on Yahoo's transaction page is wrong. The sample with the { } placeholders and without the <faab_bid> node is correct, but the FAAB example below it has <destination_team_key> instead of <source_team_key> as part of the "drop" transaction. When I made sure to use "source_team_key" instead of "destination_team_key" for the drop set of nodes, the transaction started working.
I'm guessing that Error Code 25 is a generic error indicating that some part of the XML is wrong or unexpected. If this doesn't resolve your issue, try starting with the first add/drop sample XML and filling in values one by one.
Hope this helps.
-Igor

undefined method `[]' for nil:NilClass Rails 4

I am working on a weather app using the Weather Underground API. Everything almost appears to be working fine in my web app. Except for one thing. When ever I start up my server and head to my index page, in this case, the main page. I get the following error message: undefined method []' for nil:NilClass. Checking my logs, I see the following message: NoMethodError (undefined method '[]' for nil:NilClass):app/controllers/welcome_controller.rb:14 in index.
now my controller looks like this:
class WelcomeController < ApplicationController
def index
#states will need to be defined and then #states.sort will sort all of them on the form.
#states = %w(HI AK CA OR WA ID UT NV AZ NM CO WY MT ND SD NE KS OK TX LA AR
MO IA MN WI IL IN MI OH KY TN MS AL GA FL SC NC VA WV DE MD PA NY NJ CT RI
MA VT NH ME DC PR)
#states.sort!
#Here is the call to the API
response = HTTParty.get("http://api.wunderground.com/api/#
{ENV['wunderground_api_key']}/geolookup/conditions/q/#{params[:state]}/#
{params[:city]}.json")
#location = response['location']['city']
#temp_f = response['current_observation']['temp_f']
#temp_c = response['current_observation']['temp_c']
#weather_icon = response['current_observation']['icon_url']
#weather_words = response['current_observation']['weather']
#forecast_link = response['current_observation']['forecast_url']
#real_feel = response['current_observation']['feelslike_f']
#This part of the code will change the background depending on what
#weather_words is.
#Head over to the views/layouts/application.html.erb file to see more.
if #weather_words == "Partly Cloudy" || #weather_words == "Mostly Cloudy"
#body_class = "partly-cloudy"
elsif #weather_words == "Cloudy" || #weather_words == "Scattered Clouds" || #weather_words == "Overcast"
#body_class = "partly-cloudy"
elsif #weather_words == "Clear"
#body_class = "sunny"
elsif #weather_words == "snow"
#body_class = "snow"
elsif #weather_words == "Rain"
#body_class = "rain"
elsif #weather_words == "Fog"
#body_class = "fog"
elsif #weather_words == "Thunderstorms and Rain" || #weather_words == "Thunderstorms"
#body_class = "thunder"
end
end
Now, I have tracked down the problem, I believe, to the params :state and :city not being filled in when I load the page. If I delete this part of the code:
#location = response['location']['city']
#temp_f = response['current_observation']['temp_f']
#temp_c = response['current_observation']['temp_c']
#weather_icon = response['current_observation']['icon_url']
#weather_words = response['current_observation']['weather']
#forecast_link = response['current_observation']['forecast_url']
#real_feel = response['current_observation']['feelslike_f']
Then load the page, everything will work fine if I select a state and city, then add the above deleted code-it will pull it up. Except I cannot start my server and go directly to my index page or else it will crash. I also tried placing the following in:
params[:state] = "MA"
params[:city] = "Boston"
and that will load the page just fine except I am stuck on Boston! Finally, Here are my routes:
#The index page gets two routes:
#The get route for when we initially come to the page
get 'index' => 'welcome#index'
#And then a post route for when we come back to the index page after
# submitting the form
post 'index' => 'welcome#index'
Any help will be great! I also have all of my code posted at github, username is ravenusmc. Again, thank you for the help.
One or more fields of response are probably nil. This is a very common mistake; you should always check if the variable is nil or empty before trying to access nested hash keys or array positions. e.g., insted of #location = response['location']['city'], use something like:
#location = response['location'] ? response['location']['city'] : nil
Do the same for the rest of the #location = response... attributions.
If you're using ruby 2.3.0, you can use the dig method:
#location = response.dig('location', 'city')
Which handles nil values for you. See the difference:
2.3.0 :004 > response = {}
# => {}
2.3.0 :005 > response.dig('location', 'city')
# => nil
2.3.0 :006 > response['location']['city']
NoMethodError: undefined method `[]' for nil:NilClass
from (irb):6
from /home/lbrito/.rvm/rubies/ruby-2.3.0/bin/irb:11:in `<main>'

RubyAmf and Rails 3

I have recently been trying to upgrade my app form Rails 2.3.8 to newly-releases Rails 3.
After going through fixing some Rails 3 RubyAMF doesn't seem to work:
>>>>>>>> RubyAMF >>>>>>>>> #<RubyAMF::Actions::PrepareAction:0x1649924> took: 0.00017 secs
The action '#<ActionDispatch::Request:0x15c0cf0>' could not be found for DaysController
/Users/tammam56/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/base.rb:114:in `process'
/Users/tammam56/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/rendering.rb:40:in `process'
It doesn't seem to be able to find the proper controller. Might have to do with new changes in Rails 3 Router. Do you know how to go about finding the root cause of the problem and/or trying to fix it?
I'm pasting code from RubyAMF where this is happening (Exception happens at the line: #service.process(req, res)):
#invoke the service call
def invoke
begin
# RequestStore.available_services[#amfbody.service_class_name] ||=
#service = #amfbody.service_class_name.constantize.new #handle on service
rescue Exception => e
puts e.message
puts e.backtrace
raise RUBYAMFException.new(RUBYAMFException.UNDEFINED_OBJECT_REFERENCE_ERROR, "There was an error loading the service class #{#amfbody.service_class_name}")
end
if #service.private_methods.include?(#amfbody.service_method_name.to_sym)
raise RUBYAMFExc
eption.new(RUBYAMFException.METHOD_ACCESS_ERROR, "The method {#{#amfbody.service_method_name}} in class {#{#amfbody.service_class_file_path}} is declared as private, it must be defined as public to access it.")
elsif !#service.public_methods.include?(#amfbody.service_method_name.to_sym)
raise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, "The method {#{#amfbody.service_method_name}} in class {#{#amfbody.service_class_file_path}} is not declared.")
end
#clone the request and response and alter it for the target controller/method
req = RequestStore.rails_request.clone
res = RequestStore.rails_response.clone
#change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!
controller = #amfbody.service_class_name.gsub("Controller","").underscore
action = #amfbody.service_method_name
req.parameters['controller'] = req.request_parameters['controller'] = req.path_parameters['controller'] = controller
req.parameters['action'] = req.request_parameters['action'] = req.path_parameters['action'] = action
req.env['PATH_INFO'] = req.env['REQUEST_PATH'] = req.env['REQUEST_URI'] = "#{controller}/#{action}"
req.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s
#set conditional helper
#service.is_amf = true
#service.is_rubyamf = true
#process the request
rubyamf_params = #service.rubyamf_params = {}
if #amfbody.value && !#amfbody.value.empty?
#amfbody.value.each_with_index do |item,i|
rubyamf_params[i] = item
end
end
# put them by default into the parameter hash if they opt for it
rubyamf_params.each{|k,v| req.parameters[k] = v} if ParameterMappings.always_add_to_params
begin
#One last update of the parameters hash, this will map custom mappings to the hash, and will override any conflicting from above
ParameterMappings.update_request_parameters(#amfbody.service_class_name, #amfbody.service_method_name, req.parameters, rubyamf_params, #amfbody.value)
rescue Exception => e
raise RUBYAMFException.new(RUBYAMFException.PARAMETER_MAPPING_ERROR, "There was an error with your parameter mappings: {#{e.message}}")
end
#service.process(req, res)
#unset conditional helper
#service.is_amf = false
#service.is_rubyamf = false
#service.rubyamf_params = rubyamf_params # add the rubyamf_args into the controller to be accessed
result = RequestStore.render_amf_results
#handle FaultObjects
if result.class.to_s == 'FaultObject' #catch returned FaultObjects - use this check so we don't have to include the fault object module
e = RUBYAMFException.new(result['code'], result['message'])
e.payload = result['payload']
raise e
end
#amf3
#amfbody.results = result
if #amfbody.special_handling == 'RemotingMessage'
#wrapper = generate_acknowledge_object(#amfbody.get_meta('messageId'), #amfbody.get_meta('clientId'))
#wrapper["body"] = result
#amfbody.results = #wrapper
end
#amfbody.success! #set the success response uri flag (/onResult)
end
The best suggestion is to try rails3-amf. It currently is severely lacking in features in comparison to RubyAMF, but it does work and I'm adding new features as soon as they are requested or I have time.

Resources