Sha256: 30ccb771335426b1025b78398adb2ee661143ff03d9f7d660f74b8911f9b9c23

Contents?: true

Size: 1.6 KB

Versions: 17

Compression:

Stored size: 1.6 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/map'
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

17 entries across 17 versions & 4 rubygems

Version Path
benjaminkrause-restful-0.2.8 lib/restful.rb
moviepilot-restful-0.2.18 lib/restful.rb
moviepilot-restful-0.2.19 lib/restful.rb
moviepilot-restful-0.2.20 lib/restful.rb
purzelrakete-restful-0.2.10 lib/restful.rb
purzelrakete-restful-0.2.11 lib/restful.rb
purzelrakete-restful-0.2.12 lib/restful.rb
purzelrakete-restful-0.2.13 lib/restful.rb
purzelrakete-restful-0.2.14 lib/restful.rb
purzelrakete-restful-0.2.15 lib/restful.rb
purzelrakete-restful-0.2.16 lib/restful.rb
purzelrakete-restful-0.2.17 lib/restful.rb
purzelrakete-restful-0.2.18 lib/restful.rb
purzelrakete-restful-0.2.7 lib/restful.rb
purzelrakete-restful-0.2.8 lib/restful.rb
purzelrakete-restful-0.2.9 lib/restful.rb
restful-0.2.20 lib/restful.rb