Giter Site home page Giter Site logo

rubyamf_plugin's Introduction

RubyAMF: Flash and Flex Remoting for Ruby on Rails

RubyAMF is an open source flash remoting gateway for Ruby on Rails.

Installation

$ ruby script/plugin install git://github.com/victorcoder/rubyamf_plugin.git

Rails 3:

$ rails plugin install git://github.com/victorcoder/rubyamf_plugin.git

Confirm correct installation and routing by browsing to:

localhost:[port]/rubyamf/gateway

You will see the rubyamf logo on a black background.

Configuration

Please read the documentation in rubyamf_config.rb. That file gets installed to config/rubyamf_config.rb when you use the rails installer.

Parameter mappings

Here’s how parameter mappings behave by default:

  • Every remoting parameter is available in the order it came - in the “params” hash. So if you sent over 2 parameters in your remoting call. You could access them like: params, and params.

  • You can toggle this behavior, RubyAMF has a property called “rubyamf_params”. This is useful if you don’t want every parameter coming into the “params” hash. Set “ParameterMappings.always_add_to_params” to false. Once set to false - parameters by index will only be put into “rubyamf_params” and not “params”

Here’s what happens when you go beyond that and setup some custom ParameterMappings:

  • When you setup ParameterMappings. They get put into the “params” hash, as well as the “rubyamf_params” hash for consistency.

How do I get data deeper in the object than just referencing the index it came in?

Because RubyAMF turns dynamic objects into hashes, you can use hash accessor like logic to get deeper into a parameter. Here’s a quick EX:

ParameterMappings.register({:controller => :MyController, :action => :myaction, :params => {:myproperty => “[0]” }})

Supported types

RubyAMF Supports AMF0, AMF3, and RemoteObject

AMF Type conversions

Flash 2 RubyAMF:

undefined -> nil null -> nil false -> false true -> true Number -> Fixnum int -> Integer String -> String XML -> String (cast in your service) Array -> Array MixexArray? -> Hash Object -> Hash Custom Class -> Ruby Class RubyAMF 2 Flash:

nil -> null false -> false true -> true Numeric -> Number String -> String BeautifulSoup? -> XML REXML::Doc -> xml Array -> Array Hash -> Object Ruby Class -> Custom Class

Generators

RubyAMF Code Generators and Helper Scripts

Introduction

RubyAMF currently has two generators

RubyAMF only scaffold generator Console printing ClassMapping? helper generator

Note: Currently the generators have not been upgraded to Rails 3 generators.

Details

$ script/generate rubyamf_scaffold <model> <attributes>

will produce a model, fixtures, tests, and a RubyAMF specific controller with actions that work only with incoming :amf formats.

$ script/generate rubyamf_mappings

will print class mapping entries for each model in app/models and below to the command line. This is designed to help easily add new class mappings to the rubyamf_config.rb configuration file.

Credits

© aaron smith www.rubyamf.org

rubyamf_plugin's People

Contributors

fosrias avatar rangsikitpho avatar vijaydev avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.