aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/examples/metaWeblog/blog_controller.rb
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-03-10 11:53:29 +0000
committerLeon Breedt <bitserf@gmail.com>2005-03-10 11:53:29 +0000
commit4f2f408ba1a7dd976a1ec5061d05ef0439e5f942 (patch)
treed681ffebeda753c1df5450fef68bb298a27f3137 /actionwebservice/examples/metaWeblog/blog_controller.rb
parent4e8ca35defa317d22a0b7916f20a4725c235b90c (diff)
downloadrails-4f2f408ba1a7dd976a1ec5061d05ef0439e5f942.tar.gz
rails-4f2f408ba1a7dd976a1ec5061d05ef0439e5f942.tar.bz2
rails-4f2f408ba1a7dd976a1ec5061d05ef0439e5f942.zip
allow 0, 1, '0' or '1' to be cast to the appropriate values for boolean
values. update XML-RPC example to work in :layered mode. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@883 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/examples/metaWeblog/blog_controller.rb')
-rw-r--r--actionwebservice/examples/metaWeblog/blog_controller.rb127
1 files changed, 0 insertions, 127 deletions
diff --git a/actionwebservice/examples/metaWeblog/blog_controller.rb b/actionwebservice/examples/metaWeblog/blog_controller.rb
deleted file mode 100644
index e575203311..0000000000
--- a/actionwebservice/examples/metaWeblog/blog_controller.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-# point your client at http://project_url/blog/api to test
-# this
-
-# structures as defined by the metaWeblog/blogger
-# specifications.
-module Blog
- class Enclosure < ActionWebService::Struct
- member :url, :string
- member :length, :int
- member :type, :string
- end
-
- class Source < ActionWebService::Struct
- member :url, :string
- member :name, :string
- end
-
- class Post < ActionWebService::Struct
- member :title, :string
- member :link, :string
- member :description, :string
- member :author, :string
- member :category, :string
- member :comments, :string
- member :enclosure, Enclosure
- member :guid, :string
- member :pubDate, :string
- member :source, Source
- end
-
- class Blog < ActionWebService::Struct
- member :url, :string
- member :blogid, :string
- member :blogName, :string
- end
-end
-
-# skeleton metaWeblog API
-class MetaWeblogAPI < ActionWebService::API::Base
- inflect_names false
-
- api_method :newPost, :returns => [:string], :expects => [
- {:blogid=>:string},
- {:username=>:string},
- {:password=>:string},
- {:struct=>Blog::Post},
- {:publish=>:bool},
- ]
-
- api_method :editPost, :returns => [:bool], :expects => [
- {:postid=>:string},
- {:username=>:string},
- {:password=>:string},
- {:struct=>Blog::Post},
- {:publish=>:bool},
- ]
-
- api_method :getPost, :returns => [Blog::Post], :expects => [
- {:postid=>:string},
- {:username=>:string},
- {:password=>:string},
- ]
-
- api_method :getUsersBlogs, :returns => [[Blog::Blog]], :expects => [
- {:appkey=>:string},
- {:username=>:string},
- {:password=>:string},
- ]
-
- api_method :getRecentPosts, :returns => [[Blog::Post]], :expects => [
- {:blogid=>:string},
- {:username=>:string},
- {:password=>:string},
- {:numberOfPosts=>:int},
- ]
-end
-
-class BlogController < ApplicationController
- web_service_api MetaWeblogAPI
-
- def initialize
- @postid = 0
- end
-
- def newPost
- $stderr.puts 'Creating post: username=%s password=%s struct=%s' % [
- @params['username'],
- @params['password'],
- @params['struct'].inspect
- ]
- (@postid += 1).to_s
- end
-
- def editPost
- $stderr.puts 'Editing post: username=%s password=%s struct=%s' % [
- @params['username'],
- @params['password'],
- @params['struct'].inspect
- ]
- true
- end
-
- def getUsersBlogs
- $stderr.puts "Returning user %s's blogs" % @params['username']
- blog = Blog::Blog.new(
- :url =>'http://blog.xeraph.org',
- :blogid => 'sttm',
- :blogName => 'slave to the machine'
- )
- [blog]
- end
-
- def getRecentPosts
- $stderr.puts "Returning recent posts (%d requested)" % @params['numberOfPosts']
- post1 = Blog::Post.new(
- :title => 'first post!',
- :link => 'http://blog.xeraph.org/testOne.html',
- :description => 'this is the first post'
- )
- post2 = Blog::Post.new(
- :title => 'second post!',
- :link => 'http://blog.xeraph.org/testTwo.html',
- :description => 'this is the second post'
- )
- [post1, post2]
- end
-end