fdv-actionwebservice 2.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +320 -0
- data/MIT-LICENSE +21 -0
- data/README +381 -0
- data/Rakefile +180 -0
- data/TODO +32 -0
- data/examples/googlesearch/README +143 -0
- data/examples/googlesearch/autoloading/google_search_api.rb +50 -0
- data/examples/googlesearch/autoloading/google_search_controller.rb +57 -0
- data/examples/googlesearch/delegated/google_search_service.rb +108 -0
- data/examples/googlesearch/delegated/search_controller.rb +7 -0
- data/examples/googlesearch/direct/google_search_api.rb +50 -0
- data/examples/googlesearch/direct/search_controller.rb +58 -0
- data/examples/metaWeblog/README +17 -0
- data/examples/metaWeblog/apis/blogger_api.rb +60 -0
- data/examples/metaWeblog/apis/blogger_service.rb +34 -0
- data/examples/metaWeblog/apis/meta_weblog_api.rb +67 -0
- data/examples/metaWeblog/apis/meta_weblog_service.rb +48 -0
- data/examples/metaWeblog/controllers/xmlrpc_controller.rb +16 -0
- data/generators/web_service/USAGE +28 -0
- data/generators/web_service/templates/api_definition.rb +5 -0
- data/generators/web_service/templates/controller.rb +8 -0
- data/generators/web_service/templates/functional_test.rb +19 -0
- data/generators/web_service/web_service_generator.rb +29 -0
- data/lib/action_web_service.rb +66 -0
- data/lib/action_web_service/api.rb +297 -0
- data/lib/action_web_service/base.rb +38 -0
- data/lib/action_web_service/casting.rb +149 -0
- data/lib/action_web_service/client.rb +3 -0
- data/lib/action_web_service/client/base.rb +28 -0
- data/lib/action_web_service/client/soap_client.rb +113 -0
- data/lib/action_web_service/client/xmlrpc_client.rb +58 -0
- data/lib/action_web_service/container.rb +3 -0
- data/lib/action_web_service/container/action_controller_container.rb +93 -0
- data/lib/action_web_service/container/delegated_container.rb +86 -0
- data/lib/action_web_service/container/direct_container.rb +69 -0
- data/lib/action_web_service/dispatcher.rb +2 -0
- data/lib/action_web_service/dispatcher/abstract.rb +207 -0
- data/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +379 -0
- data/lib/action_web_service/invocation.rb +202 -0
- data/lib/action_web_service/protocol.rb +4 -0
- data/lib/action_web_service/protocol/abstract.rb +112 -0
- data/lib/action_web_service/protocol/discovery.rb +37 -0
- data/lib/action_web_service/protocol/soap_protocol.rb +176 -0
- data/lib/action_web_service/protocol/soap_protocol/marshaler.rb +242 -0
- data/lib/action_web_service/protocol/xmlrpc_protocol.rb +122 -0
- data/lib/action_web_service/scaffolding.rb +281 -0
- data/lib/action_web_service/struct.rb +64 -0
- data/lib/action_web_service/support/class_inheritable_options.rb +26 -0
- data/lib/action_web_service/support/signature_types.rb +226 -0
- data/lib/action_web_service/templates/scaffolds/layout.html.erb +65 -0
- data/lib/action_web_service/templates/scaffolds/methods.html.erb +6 -0
- data/lib/action_web_service/templates/scaffolds/parameters.html.erb +29 -0
- data/lib/action_web_service/templates/scaffolds/result.html.erb +30 -0
- data/lib/action_web_service/test_invoke.rb +110 -0
- data/lib/action_web_service/version.rb +9 -0
- data/lib/actionwebservice.rb +1 -0
- data/setup.rb +1379 -0
- data/test/abstract_client.rb +183 -0
- data/test/abstract_dispatcher.rb +548 -0
- data/test/abstract_unit.rb +43 -0
- data/test/api_test.rb +102 -0
- data/test/apis/auto_load_api.rb +3 -0
- data/test/apis/broken_auto_load_api.rb +2 -0
- data/test/base_test.rb +42 -0
- data/test/casting_test.rb +95 -0
- data/test/client_soap_test.rb +155 -0
- data/test/client_xmlrpc_test.rb +153 -0
- data/test/container_test.rb +73 -0
- data/test/dispatcher_action_controller_soap_test.rb +139 -0
- data/test/dispatcher_action_controller_xmlrpc_test.rb +59 -0
- data/test/fixtures/db_definitions/mysql.sql +8 -0
- data/test/fixtures/users.yml +12 -0
- data/test/gencov +3 -0
- data/test/invocation_test.rb +185 -0
- data/test/run +6 -0
- data/test/scaffolded_controller_test.rb +146 -0
- data/test/struct_test.rb +52 -0
- data/test/test_invoke_test.rb +112 -0
- metadata +166 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
class DirectoryCategory < ActionWebService::Struct
|
2
|
+
member :fullViewableName, :string
|
3
|
+
member :specialEncoding, :string
|
4
|
+
end
|
5
|
+
|
6
|
+
class ResultElement < ActionWebService::Struct
|
7
|
+
member :summary, :string
|
8
|
+
member :URL, :string
|
9
|
+
member :snippet, :string
|
10
|
+
member :title, :string
|
11
|
+
member :cachedSize, :string
|
12
|
+
member :relatedInformationPresent, :bool
|
13
|
+
member :hostName, :string
|
14
|
+
member :directoryCategory, DirectoryCategory
|
15
|
+
member :directoryTitle, :string
|
16
|
+
end
|
17
|
+
|
18
|
+
class GoogleSearchResult < ActionWebService::Struct
|
19
|
+
member :documentFiltering, :bool
|
20
|
+
member :searchComments, :string
|
21
|
+
member :estimatedTotalResultsCount, :int
|
22
|
+
member :estimateIsExact, :bool
|
23
|
+
member :resultElements, [ResultElement]
|
24
|
+
member :searchQuery, :string
|
25
|
+
member :startIndex, :int
|
26
|
+
member :endIndex, :int
|
27
|
+
member :searchTips, :string
|
28
|
+
member :directoryCategories, [DirectoryCategory]
|
29
|
+
member :searchTime, :float
|
30
|
+
end
|
31
|
+
|
32
|
+
class GoogleSearchAPI < ActionWebService::API::Base
|
33
|
+
inflect_names false
|
34
|
+
|
35
|
+
api_method :doGetCachedPage, :returns => [:string], :expects => [{:key=>:string}, {:url=>:string}]
|
36
|
+
api_method :doGetSpellingSuggestion, :returns => [:string], :expects => [{:key=>:string}, {:phrase=>:string}]
|
37
|
+
|
38
|
+
api_method :doGoogleSearch, :returns => [GoogleSearchResult], :expects => [
|
39
|
+
{:key=>:string},
|
40
|
+
{:q=>:string},
|
41
|
+
{:start=>:int},
|
42
|
+
{:maxResults=>:int},
|
43
|
+
{:filter=>:bool},
|
44
|
+
{:restrict=>:string},
|
45
|
+
{:safeSearch=>:bool},
|
46
|
+
{:lr=>:string},
|
47
|
+
{:ie=>:string},
|
48
|
+
{:oe=>:string}
|
49
|
+
]
|
50
|
+
end
|
51
|
+
|
52
|
+
class GoogleSearchService < ActionWebService::Base
|
53
|
+
web_service_api GoogleSearchAPI
|
54
|
+
|
55
|
+
def doGetCachedPage(key, url)
|
56
|
+
"<html><body>i am a cached page</body></html>"
|
57
|
+
end
|
58
|
+
|
59
|
+
def doSpellingSuggestion(key, phrase)
|
60
|
+
"Did you mean 'teh'?"
|
61
|
+
end
|
62
|
+
|
63
|
+
def doGoogleSearch(key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe)
|
64
|
+
resultElement = ResultElement.new
|
65
|
+
resultElement.summary = "ONlamp.com: Rolling with Ruby on Rails"
|
66
|
+
resultElement.URL = "http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html"
|
67
|
+
resultElement.snippet = "Curt Hibbs shows off Ruby on Rails by building a simple application that requires " +
|
68
|
+
"almost no Ruby experience. ... Rolling with Ruby on Rails. ..."
|
69
|
+
resultElement.title = "Teh Railz0r"
|
70
|
+
resultElement.cachedSize = "Almost no lines of code!"
|
71
|
+
resultElement.relatedInformationPresent = true
|
72
|
+
resultElement.hostName = "rubyonrails.com"
|
73
|
+
resultElement.directoryCategory = category("Web Development", "UTF-8")
|
74
|
+
|
75
|
+
result = GoogleSearchResult.new
|
76
|
+
result.documentFiltering = filter
|
77
|
+
result.searchComments = ""
|
78
|
+
result.estimatedTotalResultsCount = 322000
|
79
|
+
result.estimateIsExact = false
|
80
|
+
result.resultElements = [resultElement]
|
81
|
+
result.searchQuery = "http://www.google.com/search?q=ruby+on+rails"
|
82
|
+
result.startIndex = start
|
83
|
+
result.endIndex = start + maxResults
|
84
|
+
result.searchTips = "\"on\" is a very common word and was not included in your search [details]"
|
85
|
+
result.searchTime = 0.000001
|
86
|
+
|
87
|
+
# For Mono, we have to clone objects if they're referenced by more than one place, otherwise
|
88
|
+
# the Ruby SOAP collapses them into one instance and uses references all over the
|
89
|
+
# place, confusing Mono.
|
90
|
+
#
|
91
|
+
# This has recently been fixed:
|
92
|
+
# http://bugzilla.ximian.com/show_bug.cgi?id=72265
|
93
|
+
result.directoryCategories = [
|
94
|
+
category("Web Development", "UTF-8"),
|
95
|
+
category("Programming", "US-ASCII"),
|
96
|
+
]
|
97
|
+
|
98
|
+
result
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def category(name, encoding)
|
103
|
+
cat = DirectoryCategory.new
|
104
|
+
cat.fullViewableName = name.dup
|
105
|
+
cat.specialEncoding = encoding.dup
|
106
|
+
cat
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class DirectoryCategory < ActionWebService::Struct
|
2
|
+
member :fullViewableName, :string
|
3
|
+
member :specialEncoding, :string
|
4
|
+
end
|
5
|
+
|
6
|
+
class ResultElement < ActionWebService::Struct
|
7
|
+
member :summary, :string
|
8
|
+
member :URL, :string
|
9
|
+
member :snippet, :string
|
10
|
+
member :title, :string
|
11
|
+
member :cachedSize, :string
|
12
|
+
member :relatedInformationPresent, :bool
|
13
|
+
member :hostName, :string
|
14
|
+
member :directoryCategory, DirectoryCategory
|
15
|
+
member :directoryTitle, :string
|
16
|
+
end
|
17
|
+
|
18
|
+
class GoogleSearchResult < ActionWebService::Struct
|
19
|
+
member :documentFiltering, :bool
|
20
|
+
member :searchComments, :string
|
21
|
+
member :estimatedTotalResultsCount, :int
|
22
|
+
member :estimateIsExact, :bool
|
23
|
+
member :resultElements, [ResultElement]
|
24
|
+
member :searchQuery, :string
|
25
|
+
member :startIndex, :int
|
26
|
+
member :endIndex, :int
|
27
|
+
member :searchTips, :string
|
28
|
+
member :directoryCategories, [DirectoryCategory]
|
29
|
+
member :searchTime, :float
|
30
|
+
end
|
31
|
+
|
32
|
+
class GoogleSearchAPI < ActionWebService::API::Base
|
33
|
+
inflect_names false
|
34
|
+
|
35
|
+
api_method :doGetCachedPage, :returns => [:string], :expects => [{:key=>:string}, {:url=>:string}]
|
36
|
+
api_method :doGetSpellingSuggestion, :returns => [:string], :expects => [{:key=>:string}, {:phrase=>:string}]
|
37
|
+
|
38
|
+
api_method :doGoogleSearch, :returns => [GoogleSearchResult], :expects => [
|
39
|
+
{:key=>:string},
|
40
|
+
{:q=>:string},
|
41
|
+
{:start=>:int},
|
42
|
+
{:maxResults=>:int},
|
43
|
+
{:filter=>:bool},
|
44
|
+
{:restrict=>:string},
|
45
|
+
{:safeSearch=>:bool},
|
46
|
+
{:lr=>:string},
|
47
|
+
{:ie=>:string},
|
48
|
+
{:oe=>:string}
|
49
|
+
]
|
50
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class SearchController < ApplicationController
|
2
|
+
web_service_api :google_search
|
3
|
+
wsdl_service_name 'GoogleSearch'
|
4
|
+
|
5
|
+
def doGetCachedPage
|
6
|
+
"<html><body>i am a cached page. my key was %s, url was %s</body></html>" % [@params['key'], @params['url']]
|
7
|
+
end
|
8
|
+
|
9
|
+
def doSpellingSuggestion
|
10
|
+
"%s: Did you mean '%s'?" % [@params['key'], @params['phrase']]
|
11
|
+
end
|
12
|
+
|
13
|
+
def doGoogleSearch
|
14
|
+
resultElement = ResultElement.new
|
15
|
+
resultElement.summary = "ONlamp.com: Rolling with Ruby on Rails"
|
16
|
+
resultElement.URL = "http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html"
|
17
|
+
resultElement.snippet = "Curt Hibbs shows off Ruby on Rails by building a simple application that requires " +
|
18
|
+
"almost no Ruby experience. ... Rolling with Ruby on Rails. ..."
|
19
|
+
resultElement.title = "Teh Railz0r"
|
20
|
+
resultElement.cachedSize = "Almost no lines of code!"
|
21
|
+
resultElement.relatedInformationPresent = true
|
22
|
+
resultElement.hostName = "rubyonrails.com"
|
23
|
+
resultElement.directoryCategory = category("Web Development", "UTF-8")
|
24
|
+
|
25
|
+
result = GoogleSearchResult.new
|
26
|
+
result.documentFiltering = @params['filter']
|
27
|
+
result.searchComments = ""
|
28
|
+
result.estimatedTotalResultsCount = 322000
|
29
|
+
result.estimateIsExact = false
|
30
|
+
result.resultElements = [resultElement]
|
31
|
+
result.searchQuery = "http://www.google.com/search?q=ruby+on+rails"
|
32
|
+
result.startIndex = @params['start']
|
33
|
+
result.endIndex = @params['start'] + @params['maxResults']
|
34
|
+
result.searchTips = "\"on\" is a very common word and was not included in your search [details]"
|
35
|
+
result.searchTime = 0.000001
|
36
|
+
|
37
|
+
# For Mono, we have to clone objects if they're referenced by more than one place, otherwise
|
38
|
+
# the Ruby SOAP collapses them into one instance and uses references all over the
|
39
|
+
# place, confusing Mono.
|
40
|
+
#
|
41
|
+
# This has recently been fixed:
|
42
|
+
# http://bugzilla.ximian.com/show_bug.cgi?id=72265
|
43
|
+
result.directoryCategories = [
|
44
|
+
category("Web Development", "UTF-8"),
|
45
|
+
category("Programming", "US-ASCII"),
|
46
|
+
]
|
47
|
+
|
48
|
+
result
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def category(name, encoding)
|
53
|
+
cat = DirectoryCategory.new
|
54
|
+
cat.fullViewableName = name.dup
|
55
|
+
cat.specialEncoding = encoding.dup
|
56
|
+
cat
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= metaWeblog example
|
2
|
+
|
3
|
+
This example shows how one might begin to go about adding metaWeblog
|
4
|
+
(http://www.xmlrpc.com/metaWeblogApi) API support to a Rails-based
|
5
|
+
blogging application.
|
6
|
+
|
7
|
+
The example APIs are more verbose than you may want to make them, for documentation
|
8
|
+
reasons.
|
9
|
+
|
10
|
+
= Running
|
11
|
+
|
12
|
+
1. Copy the "apis" directory and its files into "app" in a Rails project.
|
13
|
+
|
14
|
+
2. Copy the "controllers" directory and its files into "app" in a Rails project
|
15
|
+
|
16
|
+
3. Fire up a desktop blogging application (such as w.bloggar, MarsEdit, or BloGTK),
|
17
|
+
point it at http://localhost:3000/xmlrpc/api, and try creating or editing blog posts.
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#
|
2
|
+
# see the blogger API spec at http://www.blogger.com/developers/api/1_docs/
|
3
|
+
# note that the method signatures are subtly different to metaWeblog, they
|
4
|
+
# are not identical. take care to ensure you handle the different semantics
|
5
|
+
# properly if you want to support blogger API too, to get maximum compatibility.
|
6
|
+
#
|
7
|
+
|
8
|
+
module Blog
|
9
|
+
class Blog < ActionWebService::Struct
|
10
|
+
member :url, :string
|
11
|
+
member :blogid, :string
|
12
|
+
member :blogName, :string
|
13
|
+
end
|
14
|
+
|
15
|
+
class User < ActionWebService::Struct
|
16
|
+
member :nickname, :string
|
17
|
+
member :userid, :string
|
18
|
+
member :url, :string
|
19
|
+
member :email, :string
|
20
|
+
member :lastname, :string
|
21
|
+
member :firstname, :string
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# blogger
|
27
|
+
#
|
28
|
+
class BloggerAPI < ActionWebService::API::Base
|
29
|
+
inflect_names false
|
30
|
+
|
31
|
+
api_method :newPost, :returns => [:string], :expects => [
|
32
|
+
{:appkey=>:string},
|
33
|
+
{:blogid=>:string},
|
34
|
+
{:username=>:string},
|
35
|
+
{:password=>:string},
|
36
|
+
{:content=>:string},
|
37
|
+
{:publish=>:bool}
|
38
|
+
]
|
39
|
+
|
40
|
+
api_method :editPost, :returns => [:bool], :expects => [
|
41
|
+
{:appkey=>:string},
|
42
|
+
{:postid=>:string},
|
43
|
+
{:username=>:string},
|
44
|
+
{:password=>:string},
|
45
|
+
{:content=>:string},
|
46
|
+
{:publish=>:bool}
|
47
|
+
]
|
48
|
+
|
49
|
+
api_method :getUsersBlogs, :returns => [[Blog::Blog]], :expects => [
|
50
|
+
{:appkey=>:string},
|
51
|
+
{:username=>:string},
|
52
|
+
{:password=>:string}
|
53
|
+
]
|
54
|
+
|
55
|
+
api_method :getUserInfo, :returns => [Blog::User], :expects => [
|
56
|
+
{:appkey=>:string},
|
57
|
+
{:username=>:string},
|
58
|
+
{:password=>:string}
|
59
|
+
]
|
60
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'blogger_api'
|
2
|
+
|
3
|
+
class BloggerService < ActionWebService::Base
|
4
|
+
web_service_api BloggerAPI
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@postid = 0
|
8
|
+
end
|
9
|
+
|
10
|
+
def newPost(key, id, user, pw, content, publish)
|
11
|
+
$stderr.puts "id=#{id} user=#{user} pw=#{pw}, content=#{content.inspect} [#{publish}]"
|
12
|
+
(@postid += 1).to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
def editPost(key, post_id, user, pw, content, publish)
|
16
|
+
$stderr.puts "id=#{post_id} user=#{user} pw=#{pw} content=#{content.inspect} [#{publish}]"
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def getUsersBlogs(key, user, pw)
|
21
|
+
$stderr.puts "getting blogs for #{user}"
|
22
|
+
blog = Blog::Blog.new(
|
23
|
+
:url =>'http://blog',
|
24
|
+
:blogid => 'myblog',
|
25
|
+
:blogName => 'My Blog'
|
26
|
+
)
|
27
|
+
[blog]
|
28
|
+
end
|
29
|
+
|
30
|
+
def getUserInfo(key, user, pw)
|
31
|
+
$stderr.puts "getting user info for #{user}"
|
32
|
+
Blog::User.new(:nickname => 'user', :email => 'user@test.com')
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#
|
2
|
+
# here lie structures, cousins of those on http://www.xmlrpc.com/metaWeblog
|
3
|
+
# but they don't necessarily the real world reflect
|
4
|
+
# so if you do, find that your client complains:
|
5
|
+
# please tell, of problems you suffered through
|
6
|
+
#
|
7
|
+
|
8
|
+
module Blog
|
9
|
+
class Post < ActionWebService::Struct
|
10
|
+
member :title, :string
|
11
|
+
member :link, :string
|
12
|
+
member :description, :string
|
13
|
+
member :author, :string
|
14
|
+
member :category, :string
|
15
|
+
member :comments, :string
|
16
|
+
member :guid, :string
|
17
|
+
member :pubDate, :string
|
18
|
+
end
|
19
|
+
|
20
|
+
class Category < ActionWebService::Struct
|
21
|
+
member :description, :string
|
22
|
+
member :htmlUrl, :string
|
23
|
+
member :rssUrl, :string
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# metaWeblog
|
29
|
+
#
|
30
|
+
class MetaWeblogAPI < ActionWebService::API::Base
|
31
|
+
inflect_names false
|
32
|
+
|
33
|
+
api_method :newPost, :returns => [:string], :expects => [
|
34
|
+
{:blogid=>:string},
|
35
|
+
{:username=>:string},
|
36
|
+
{:password=>:string},
|
37
|
+
{:struct=>Blog::Post},
|
38
|
+
{:publish=>:bool}
|
39
|
+
]
|
40
|
+
|
41
|
+
api_method :editPost, :returns => [:bool], :expects => [
|
42
|
+
{:postid=>:string},
|
43
|
+
{:username=>:string},
|
44
|
+
{:password=>:string},
|
45
|
+
{:struct=>Blog::Post},
|
46
|
+
{:publish=>:bool},
|
47
|
+
]
|
48
|
+
|
49
|
+
api_method :getPost, :returns => [Blog::Post], :expects => [
|
50
|
+
{:postid=>:string},
|
51
|
+
{:username=>:string},
|
52
|
+
{:password=>:string},
|
53
|
+
]
|
54
|
+
|
55
|
+
api_method :getCategories, :returns => [[Blog::Category]], :expects => [
|
56
|
+
{:blogid=>:string},
|
57
|
+
{:username=>:string},
|
58
|
+
{:password=>:string},
|
59
|
+
]
|
60
|
+
|
61
|
+
api_method :getRecentPosts, :returns => [[Blog::Post]], :expects => [
|
62
|
+
{:blogid=>:string},
|
63
|
+
{:username=>:string},
|
64
|
+
{:password=>:string},
|
65
|
+
{:numberOfPosts=>:int},
|
66
|
+
]
|
67
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'meta_weblog_api'
|
2
|
+
|
3
|
+
class MetaWeblogService < ActionWebService::Base
|
4
|
+
web_service_api MetaWeblogAPI
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@postid = 0
|
8
|
+
end
|
9
|
+
|
10
|
+
def newPost(id, user, pw, struct, publish)
|
11
|
+
$stderr.puts "id=#{id} user=#{user} pw=#{pw}, struct=#{struct.inspect} [#{publish}]"
|
12
|
+
(@postid += 1).to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
def editPost(post_id, user, pw, struct, publish)
|
16
|
+
$stderr.puts "id=#{post_id} user=#{user} pw=#{pw} struct=#{struct.inspect} [#{publish}]"
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def getPost(post_id, user, pw)
|
21
|
+
$stderr.puts "get post #{post_id}"
|
22
|
+
Blog::Post.new(:title => 'hello world', :description => 'first post!')
|
23
|
+
end
|
24
|
+
|
25
|
+
def getCategories(id, user, pw)
|
26
|
+
$stderr.puts "categories for #{user}"
|
27
|
+
cat = Blog::Category.new(
|
28
|
+
:description => 'Tech',
|
29
|
+
:htmlUrl => 'http://blog/tech',
|
30
|
+
:rssUrl => 'http://blog/tech.rss')
|
31
|
+
[cat]
|
32
|
+
end
|
33
|
+
|
34
|
+
def getRecentPosts(id, user, pw, num)
|
35
|
+
$stderr.puts "recent #{num} posts for #{user} on blog #{id}"
|
36
|
+
post1 = Blog::Post.new(
|
37
|
+
:title => 'first post!',
|
38
|
+
:link => 'http://blog.xeraph.org/testOne.html',
|
39
|
+
:description => 'this is the first post'
|
40
|
+
)
|
41
|
+
post2 = Blog::Post.new(
|
42
|
+
:title => 'second post!',
|
43
|
+
:link => 'http://blog.xeraph.org/testTwo.html',
|
44
|
+
:description => 'this is the second post'
|
45
|
+
)
|
46
|
+
[post1, post2]
|
47
|
+
end
|
48
|
+
end
|