Assemble AMF request with Ruby RocketAMF -


i make amf request body same followings (charles log): enter image description here

as show in charles, has , "command" value object , "cclocalplayerchanges" value object. confused value such object, how can make them using rocketamf?

i have tried using hash such object:

data = [{           :method => "load",           :service => "start.game",           :player_delta => {:stamina => 0},           :sequence_num => self.sequence_num,           :transaction_time => time.now.to_i.to_s,           :icp => 0,         }]  env = rocketamf::envelope.new :amf_version => 3 env.messages << rocketamf::message.new('batchcontroller.authenticate_iphone', '/1', data) body = env.to_s res = restclient.post "http://localhost/amf", env.to_s, :content_type => 'application/x-amf' 

or classmapping:

class classcommand; attr_accessor :service, :sequence_num, :transaction_time, :icp; end; command_obj = classcommand.new command_obj.service = "start.game" command_obj.sequence_num = 0 command_obj.transaction_time = time.now.to_i.to_s command_obj.icp = 0 rocketamf::classmapper.define {|m| m.map :as => 'command', :ruby => 'classcommand'} data = [command_obj]  env = rocketamf::envelope.new :amf_version => 3 env.messages << rocketamf::message.new('batchcontroller.authenticate_iphone', '/1', data) body = env.to_s res = restclient.post "http://localhost/amf", env.to_s, :content_type => 'application/x-amf' 

but neither of them gives me value (as can see below, both objects' value empty charles):

enter image description here

i new amf, wondering matter if object value empty , how make them rocketamf gem.

one idea make life easier save 'charles' request, file.read in ruby use in post body.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -