Sha256: aca633da9e17bf535614a3fa6e7291386cd2d75c205c933dfdd7de46dd762b7a

Contents?: true

Size: 1.57 KB

Versions: 6

Compression:

Stored size: 1.57 KB

Contents

require 'restful/rails'
require 'restful/rails/active_record/configuration'
require 'restful/rails/active_record/metadata_tools'
require 'restful/rails/action_controller'
require 'restful/converters/active_record'
require 'restful/apimodel/resource'
require 'restful/apimodel/attribute'
require 'restful/apimodel/collection'
require 'restful/apimodel/link'
require 'restful/serializers/xml_serializer'
require 'restful/serializers/json_serializer'
require 'restful/serializers/atom_like_serializer'
require 'restful/serializers/params_serializer'
require 'restful/serializers/hash_serializer'

module Restful
    
  MAJOR = 0
  MINOR = 1
  REVISION = 2
  VERSION = [MAJOR, MINOR, REVISION].join(".")
  
  #
  #  Restful.from_xml, #from_atom_like. Methods correspond with
  #  resgistered serializers. 
  #
  def self.method_missing(method, *args, &block)
    if method.to_s.match(/^from_(.*)$/)
      if serializer_clazz = Restful::Serializers::Base.serializers[type = $1.to_sym]
        s = serializer_clazz.new
        s.deserialize(args.first)
      else
        super
      end
    else
      super
    end
  end
  
  #
  #  Shortcuts past the namespaces
  #
  
  def self.cfg(*options)
    Restful::Rails::ActiveRecord::Configuration::Config.new(*options)
  end
  
  def self.attr(*options)
    Restful::ApiModel::Attribute.new(*options)    
  end
  
  def self.link(*options)
    Restful::ApiModel::Link.new(*options)
  end
  
  def self.collection(*options)
    Restful::ApiModel::Collection.new(*options)
  end
  
  def self.resource(*options)
    Restful::ApiModel::Resource.new(*options)
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
purzelrakete-restful-0.2.1 lib/restful.rb
purzelrakete-restful-0.2.2 lib/restful.rb
purzelrakete-restful-0.2.3 lib/restful.rb
purzelrakete-restful-0.2.4 lib/restful.rb
purzelrakete-restful-0.2.5 lib/restful.rb
purzelrakete-restful-0.2.6 lib/restful.rb