acts_as_sdata is an implementation of SData (Sage Data) protocol in Ruby.
This repo contains examples of acts_as_sdata adoptions.
This application exposes the list of US presidents in SData way.
From client side it looks like this:
http://localhost:3000/presidents/!Wilson
<?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom"> <title>Wilson, Woodrow</title> <summary>Wilson, Woodrow (1856-1924)</summary> </entry>
http://localhost:3000/presidents
<?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> <title>List of US presidents</title> <updated>2009-11-17T10:55:28+06:00</updated> <link href="http://example.com/presidents"/> <author> <name>Sage</name> </author> <entry> <title>Washington, George</title> <summary>Washington, George (1732-1799)</summary> </entry> <entry> <title>Adams, John</title> <summary>Adams, John (1735-1826)</summary> </entry> .....
http://localhost:3000/presidents(born_at gt 1900)
(all presidents born in XX century)
<?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> <title>List of US presidents</title> <updated>2009-11-17T10:58:15+06:00</updated> <link href="http://example.com/presidents"/> <author> <name>Sage</name> </author> <entry> <title>Kennedy, John</title> <summary>Kennedy, John (1917-1963)</summary> </entry> <entry> <title>Johnson, Lyndon</title> <summary>Johnson, Lyndon (1908-1973)</summary> </entry> .....
Clone and set up modules:
$ git clone git://github.com/DanielVartanov/acts_as_sdata-examples.git
$ cd acts_as_sdata-examples
$ git submodule init
$ git submodule update
Then, run it:
$ script/server
If you see error “acts_as_sdata-examples/presidents/vendor/rails/activesupport/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)”
$ gem update --system 1.5.3
If you see error: “src/rails/acts_as_sdata-examples/presidents/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:in `requirement’: undefined local variable or method `version_requirements’ for # (NameError)”
In config/environment.rb after line
require File.join(File.dirname(__FILE__), 'boot')
Add the following code:
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
r = super
(r == Gem::Requirement.default) ? nil : r
end
end
end
end
Also need to install the following gems:
$ gem install atom
$ gem install fuzzy_hash
$ gem install sqlite3