backlog 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Rakefile +2 -1
- data/app/controllers/application.rb +55 -8
- data/app/controllers/groups_controller.rb +62 -0
- data/app/controllers/periods_controller.rb +13 -55
- data/app/controllers/tasks_controller.rb +9 -5
- data/app/controllers/works_controller.rb +43 -6
- data/app/helpers/application_helper.rb +20 -2
- data/app/helpers/groups_helper.rb +2 -0
- data/app/models/backlog.rb +19 -10
- data/app/models/estimate.rb +2 -1
- data/app/models/group.rb +11 -0
- data/app/models/party.rb +3 -0
- data/app/models/period.rb +43 -6
- data/app/models/task.rb +27 -14
- data/app/models/user.rb +37 -8
- data/app/models/work.rb +4 -6
- data/app/views/backlogs/_name_list.rhtml +5 -0
- data/app/views/backlogs/show.rhtml +4 -4
- data/app/views/groups/_form.rhtml +7 -0
- data/app/views/groups/edit.rhtml +31 -0
- data/app/views/groups/list.rhtml +27 -0
- data/app/views/groups/new.rhtml +8 -0
- data/app/views/layouts/wide.rhtml +2 -2
- data/app/views/periods/_burn_down_chart.rhtml +1 -1
- data/app/views/periods/_form.rhtml +13 -9
- data/app/views/periods/_show_active.rhtml +6 -12
- data/app/views/periods/_title.rhtml +4 -5
- data/app/views/periods/edit.rhtml +1 -1
- data/app/views/periods/new.rhtml +1 -1
- data/app/views/periods/show.rhtml +10 -6
- data/app/views/tasks/_backlog_header.rhtml +22 -0
- data/app/views/tasks/_description_list.rhtml +5 -0
- data/app/views/tasks/_form.rhtml +26 -7
- data/app/views/tasks/_task.rhtml +4 -4
- data/app/views/tasks/edit.rhtml +2 -3
- data/app/views/tasks/list_started.rhtml +1 -0
- data/app/views/tasks/new.rhtml +2 -2
- data/app/views/works/_buttons.rhtml +3 -0
- data/app/views/works/_form.rhtml +15 -10
- data/app/views/works/daily_work_sheet.rhtml +30 -18
- data/app/views/works/edit.rhtml +4 -4
- data/app/views/works/list.rhtml +2 -2
- data/app/views/works/new.rhtml +3 -2
- data/app/views/works/weekly_work_sheet.rhtml +2 -2
- data/bin/backlog +2 -0
- data/bin/backlog_init.d_kubosch_production +27 -0
- data/bin/copy_production2development.rb +33 -0
- data/config/database.yml +13 -7
- data/config/deploy_kubosch.rb +1 -0
- data/config/environment.rb +2 -0
- data/config/environments/development_mysql.rb +27 -0
- data/config/environments/kubosch_production_mysql.rb +21 -0
- data/config/routes.rb +1 -1
- data/db/migrate/{001_tasks.rb → 001_create_tasks.rb} +1 -1
- data/db/migrate/{002_backlogs.rb → 002_create_backlogs.rb} +2 -2
- data/db/migrate/003_add_estimation_points.rb +1 -1
- data/db/migrate/004_add_period.rb +2 -2
- data/db/migrate/013_create_estimates.rb +1 -1
- data/db/migrate/015_add_user_option.rb +9 -5
- data/db/migrate/017_insert_datek_projects.rb +13 -10
- data/db/migrate/018_create_groups.rb +115 -0
- data/db/schema.rb +72 -12
- data/lang/en.yaml +7 -0
- data/lang/no.yaml +7 -0
- data/lib/big_decimal_yaml_fix.rb +27 -0
- data/lib/class_table_inheritance.rb +163 -0
- data/lib/tasks/backup.rake +92 -0
- data/public/images/person.org.png +0 -0
- data/public/images/person.png +0 -0
- data/public/stylesheets/backlog.css +3 -1
- data/public/stylesheets/mwrt002.css +1 -1
- data/test/fixtures/groups.yml +6 -0
- data/test/fixtures/parties.yml +31 -0
- data/test/fixtures/periods.yml +2 -2
- data/test/fixtures/tasks.yml +2 -0
- data/test/fixtures/users.yml +6 -6
- data/test/functional/backlogs_controller_test.rb +1 -1
- data/test/functional/groups_controller_test.rb +120 -0
- data/test/functional/periods_controller_test.rb +1 -1
- data/test/functional/tasks_controller_test.rb +16 -1
- data/test/functional/user_controller_test.rb +8 -2
- data/test/test_helper.rb +5 -0
- data/test/unit/big_decimal_yaml_fix_test.rb +14 -0
- data/test/unit/estimate_test.rb +1 -1
- data/test/unit/group_test.rb +10 -0
- data/test/unit/user_test.rb +56 -44
- data/tmp/sessions/ruby_sess.22dec3e9df47fb4e +0 -0
- data/tmp/sessions/ruby_sess.8037e0ab58cbcf1a +0 -0
- data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +35 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
- data/vendor/rails/{actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml → railties/configs/empty.log} +0 -0
- metadata +36 -105
- data/backlog.gemspec +0 -21
- data/vendor/rails/actionwebservice/CHANGELOG +0 -265
- data/vendor/rails/actionwebservice/MIT-LICENSE +0 -21
- data/vendor/rails/actionwebservice/README +0 -364
- data/vendor/rails/actionwebservice/Rakefile +0 -171
- data/vendor/rails/actionwebservice/TODO +0 -32
- data/vendor/rails/actionwebservice/examples/googlesearch/README +0 -143
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +0 -57
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +0 -108
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/search_controller.rb +0 -7
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/search_controller.rb +0 -58
- data/vendor/rails/actionwebservice/examples/metaWeblog/README +0 -17
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +0 -60
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +0 -34
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +0 -67
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +0 -48
- data/vendor/rails/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +0 -16
- data/vendor/rails/actionwebservice/install.rb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service.rb +0 -66
- data/vendor/rails/actionwebservice/lib/action_web_service/api.rb +0 -301
- data/vendor/rails/actionwebservice/lib/action_web_service/base.rb +0 -42
- data/vendor/rails/actionwebservice/lib/action_web_service/casting.rb +0 -138
- data/vendor/rails/actionwebservice/lib/action_web_service/client.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/client/base.rb +0 -28
- data/vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb +0 -113
- data/vendor/rails/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +0 -58
- data/vendor/rails/actionwebservice/lib/action_web_service/container.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb +0 -93
- data/vendor/rails/actionwebservice/lib/action_web_service/container/delegated_container.rb +0 -86
- data/vendor/rails/actionwebservice/lib/action_web_service/container/direct_container.rb +0 -69
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher.rb +0 -2
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +0 -207
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +0 -379
- data/vendor/rails/actionwebservice/lib/action_web_service/invocation.rb +0 -202
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol.rb +0 -4
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/abstract.rb +0 -112
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/discovery.rb +0 -37
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +0 -176
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +0 -235
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +0 -122
- data/vendor/rails/actionwebservice/lib/action_web_service/scaffolding.rb +0 -283
- data/vendor/rails/actionwebservice/lib/action_web_service/struct.rb +0 -68
- data/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +0 -26
- data/vendor/rails/actionwebservice/lib/action_web_service/support/signature_types.rb +0 -226
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb +0 -65
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb +0 -6
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb +0 -29
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/test_invoke.rb +0 -110
- data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +0 -9
- data/vendor/rails/actionwebservice/setup.rb +0 -1379
- data/vendor/rails/actionwebservice/test/abstract_client.rb +0 -183
- data/vendor/rails/actionwebservice/test/abstract_dispatcher.rb +0 -551
- data/vendor/rails/actionwebservice/test/abstract_unit.rb +0 -45
- data/vendor/rails/actionwebservice/test/api_test.rb +0 -102
- data/vendor/rails/actionwebservice/test/apis/auto_load_api.rb +0 -3
- data/vendor/rails/actionwebservice/test/apis/broken_auto_load_api.rb +0 -2
- data/vendor/rails/actionwebservice/test/base_test.rb +0 -42
- data/vendor/rails/actionwebservice/test/casting_test.rb +0 -86
- data/vendor/rails/actionwebservice/test/client_soap_test.rb +0 -153
- data/vendor/rails/actionwebservice/test/client_xmlrpc_test.rb +0 -152
- data/vendor/rails/actionwebservice/test/container_test.rb +0 -73
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_soap_test.rb +0 -137
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +0 -59
- data/vendor/rails/actionwebservice/test/fixtures/db_definitions/mysql.sql +0 -8
- data/vendor/rails/actionwebservice/test/fixtures/users.yml +0 -12
- data/vendor/rails/actionwebservice/test/gencov +0 -3
- data/vendor/rails/actionwebservice/test/invocation_test.rb +0 -185
- data/vendor/rails/actionwebservice/test/run +0 -6
- data/vendor/rails/actionwebservice/test/scaffolded_controller_test.rb +0 -146
- data/vendor/rails/actionwebservice/test/struct_test.rb +0 -52
- data/vendor/rails/actionwebservice/test/test_invoke_test.rb +0 -112
@@ -1,32 +0,0 @@
|
|
1
|
-
= Post-1.0
|
2
|
-
- Document/Literal SOAP support
|
3
|
-
- URL-based dispatching, URL identifies method
|
4
|
-
|
5
|
-
- Add :rest dispatching mode, a.l.a. Backpack API. Clean up dispatching
|
6
|
-
in general. Support vanilla XML-format as a "Rails" protocol?
|
7
|
-
XML::Simple deserialization into params?
|
8
|
-
|
9
|
-
web_service_dispatching_mode :rest
|
10
|
-
|
11
|
-
def method1(params)
|
12
|
-
end
|
13
|
-
|
14
|
-
def method2(params)
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
/ws/method1
|
19
|
-
<xml>
|
20
|
-
/ws/method2
|
21
|
-
<yaml>
|
22
|
-
|
23
|
-
- Allow locking down a controller to only accept messages for a particular
|
24
|
-
protocol. This will allow us to generate fully conformant error messages
|
25
|
-
in cases where we currently fudge it if we don't know the protocol.
|
26
|
-
|
27
|
-
- Allow AWS user to participate in typecasting, so they can centralize
|
28
|
-
workarounds for buggy input in one place
|
29
|
-
|
30
|
-
= Refactoring
|
31
|
-
- Don't have clean way to go from SOAP Class object to the xsd:NAME type
|
32
|
-
string -- NaHi possibly looking at remedying this situation
|
@@ -1,143 +0,0 @@
|
|
1
|
-
= Google Service example
|
2
|
-
|
3
|
-
This example shows how one would implement an API like Google
|
4
|
-
Search that uses lots of structured types.
|
5
|
-
|
6
|
-
There are examples for "Direct" and "Delegated" dispatching
|
7
|
-
modes.
|
8
|
-
|
9
|
-
There is also an example for API definition file autoloading.
|
10
|
-
|
11
|
-
|
12
|
-
= Running the examples
|
13
|
-
|
14
|
-
1. Add the files to an Action Web Service enabled Rails project.
|
15
|
-
|
16
|
-
"Direct" example:
|
17
|
-
|
18
|
-
* Copy direct/search_controller.rb to "app/controllers"
|
19
|
-
in a Rails project.
|
20
|
-
* Copy direct/google_search_api.rb to "app/apis"
|
21
|
-
in a Rails project
|
22
|
-
|
23
|
-
"Delegated" example:
|
24
|
-
|
25
|
-
* Copy delegated/search_controller.rb to "app/controllers"
|
26
|
-
in a Rails project.
|
27
|
-
* Copy delegated/google_search_service.rb to "lib"
|
28
|
-
in a Rails project.
|
29
|
-
|
30
|
-
"Autoloading" example:
|
31
|
-
|
32
|
-
* Copy autoloading/google_search_api.rb to "app/apis" (create the directory
|
33
|
-
if it doesn't exist) in a Rails project.
|
34
|
-
|
35
|
-
* Copy autoloading/google_search_controller.rb "app/controllers"
|
36
|
-
in a Rails project.
|
37
|
-
|
38
|
-
|
39
|
-
2. Go to the WSDL url in a browser, and check that it looks correct.
|
40
|
-
|
41
|
-
"Direct" and "Delegated" examples:
|
42
|
-
http://url_to_project/search/wsdl
|
43
|
-
|
44
|
-
"Autoloading" example:
|
45
|
-
http://url_to_project/google_search/wsdl
|
46
|
-
|
47
|
-
You can compare it to Google's hand-coded WSDL at http://api.google.com/GoogleSearch.wsdl
|
48
|
-
and see how close (or not) the generated version is.
|
49
|
-
|
50
|
-
Note that I used GoogleSearch as the canonical "best practice"
|
51
|
-
interoperable example when implementing WSDL/SOAP support, which might
|
52
|
-
explain extreme similarities :)
|
53
|
-
|
54
|
-
|
55
|
-
3. Test that it works with .NET (Mono in this example):
|
56
|
-
|
57
|
-
$ wget WSDL_URL
|
58
|
-
$ mv wsdl GoogleSearch.wsdl
|
59
|
-
$ wsdl -out:GoogleSearch.cs GoogleSearch.wsdl
|
60
|
-
|
61
|
-
Add these lines to the GoogleSearchService class body (be mindful of the
|
62
|
-
wrapping):
|
63
|
-
|
64
|
-
public static void Main(string[] args)
|
65
|
-
{
|
66
|
-
GoogleSearchResult result;
|
67
|
-
GoogleSearchService service;
|
68
|
-
|
69
|
-
service = new GoogleSearchService();
|
70
|
-
result = service.doGoogleSearch("myApiKey", "my query", 10, 30, true, "restrict", false, "lr", "ie", "oe");
|
71
|
-
System.Console.WriteLine("documentFiltering: {0}", result.documentFiltering);
|
72
|
-
System.Console.WriteLine("searchComments: {0}", result.searchComments);
|
73
|
-
System.Console.WriteLine("estimatedTotalResultsCount: {0}", result.estimatedTotalResultsCount);
|
74
|
-
System.Console.WriteLine("estimateIsExact: {0}", result.estimateIsExact);
|
75
|
-
System.Console.WriteLine("resultElements:");
|
76
|
-
foreach (ResultElement element in result.resultElements) {
|
77
|
-
System.Console.WriteLine("\tsummary: {0}", element.summary);
|
78
|
-
System.Console.WriteLine("\tURL: {0}", element.URL);
|
79
|
-
System.Console.WriteLine("\tsnippet: {0}", element.snippet);
|
80
|
-
System.Console.WriteLine("\ttitle: {0}", element.title);
|
81
|
-
System.Console.WriteLine("\tcachedSize: {0}", element.cachedSize);
|
82
|
-
System.Console.WriteLine("\trelatedInformationPresent: {0}", element.relatedInformationPresent);
|
83
|
-
System.Console.WriteLine("\thostName: {0}", element.hostName);
|
84
|
-
System.Console.WriteLine("\tdirectoryCategory: {0}", element.directoryCategory.fullViewableName);
|
85
|
-
System.Console.WriteLine("\tdirectoryTitle: {0}", element.directoryTitle);
|
86
|
-
}
|
87
|
-
System.Console.WriteLine("searchQuery: {0}", result.searchQuery);
|
88
|
-
System.Console.WriteLine("startIndex: {0}", result.startIndex);
|
89
|
-
System.Console.WriteLine("endIndex: {0}", result.endIndex);
|
90
|
-
System.Console.WriteLine("searchTips: {0}", result.searchTips);
|
91
|
-
System.Console.WriteLine("directoryCategories:");
|
92
|
-
foreach (DirectoryCategory cat in result.directoryCategories) {
|
93
|
-
System.Console.WriteLine("\t{0} ({1})", cat.fullViewableName, cat.specialEncoding);
|
94
|
-
}
|
95
|
-
System.Console.WriteLine("searchTime: {0}", result.searchTime);
|
96
|
-
}
|
97
|
-
|
98
|
-
Now compile and run:
|
99
|
-
|
100
|
-
$ mcs -reference:System.Web.Services GoogleSearch.cs
|
101
|
-
$ mono GoogleSearch.exe
|
102
|
-
|
103
|
-
|
104
|
-
If you had the application running (on the same host you got
|
105
|
-
the WSDL from), you should see something like this:
|
106
|
-
|
107
|
-
|
108
|
-
documentFiltering: True
|
109
|
-
searchComments:
|
110
|
-
estimatedTotalResultsCount: 322000
|
111
|
-
estimateIsExact: False
|
112
|
-
resultElements:
|
113
|
-
summary: ONlamp.com: Rolling with Ruby on Rails
|
114
|
-
URL: http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html
|
115
|
-
snippet: Curt Hibbs shows off Ruby on Rails by building a simple ...
|
116
|
-
title: Teh Railz0r
|
117
|
-
cachedSize: Almost no lines of code!
|
118
|
-
relatedInformationPresent: True
|
119
|
-
hostName: rubyonrails.com
|
120
|
-
directoryCategory: Web Development
|
121
|
-
directoryTitle:
|
122
|
-
searchQuery: http://www.google.com/search?q=ruby+on+rails
|
123
|
-
startIndex: 10
|
124
|
-
endIndex: 40
|
125
|
-
searchTips: "on" is a very common word and was not included in your search [details]
|
126
|
-
directoryCategories:
|
127
|
-
Web Development (UTF-8)
|
128
|
-
Programming (US-ASCII)
|
129
|
-
searchTime: 1E-06
|
130
|
-
|
131
|
-
|
132
|
-
Also, if an API method throws an exception, it will be sent back to the
|
133
|
-
caller in the protocol's exception format, so they should get an exception
|
134
|
-
thrown on their side with a meaningful error message.
|
135
|
-
|
136
|
-
If you don't like this behaviour, you can do:
|
137
|
-
|
138
|
-
class MyController < ActionController::Base
|
139
|
-
web_service_exception_reporting false
|
140
|
-
end
|
141
|
-
|
142
|
-
4. Crack open a beer. Publishing APIs for working with the same model as
|
143
|
-
your Rails web app should be easy from now on :)
|
@@ -1,50 +0,0 @@
|
|
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
|
data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
class GoogleSearchController < ApplicationController
|
2
|
-
wsdl_service_name 'GoogleSearch'
|
3
|
-
|
4
|
-
def doGetCachedPage
|
5
|
-
"<html><body>i am a cached page. my key was %s, url was %s</body></html>" % [@params['key'], @params['url']]
|
6
|
-
end
|
7
|
-
|
8
|
-
def doSpellingSuggestion
|
9
|
-
"%s: Did you mean '%s'?" % [@params['key'], @params['phrase']]
|
10
|
-
end
|
11
|
-
|
12
|
-
def doGoogleSearch
|
13
|
-
resultElement = ResultElement.new
|
14
|
-
resultElement.summary = "ONlamp.com: Rolling with Ruby on Rails"
|
15
|
-
resultElement.URL = "http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html"
|
16
|
-
resultElement.snippet = "Curt Hibbs shows off Ruby on Rails by building a simple application that requires " +
|
17
|
-
"almost no Ruby experience. ... Rolling with Ruby on Rails. ..."
|
18
|
-
resultElement.title = "Teh Railz0r"
|
19
|
-
resultElement.cachedSize = "Almost no lines of code!"
|
20
|
-
resultElement.relatedInformationPresent = true
|
21
|
-
resultElement.hostName = "rubyonrails.com"
|
22
|
-
resultElement.directoryCategory = category("Web Development", "UTF-8")
|
23
|
-
|
24
|
-
result = GoogleSearchResult.new
|
25
|
-
result.documentFiltering = @params['filter']
|
26
|
-
result.searchComments = ""
|
27
|
-
result.estimatedTotalResultsCount = 322000
|
28
|
-
result.estimateIsExact = false
|
29
|
-
result.resultElements = [resultElement]
|
30
|
-
result.searchQuery = "http://www.google.com/search?q=ruby+on+rails"
|
31
|
-
result.startIndex = @params['start']
|
32
|
-
result.endIndex = @params['start'] + @params['maxResults']
|
33
|
-
result.searchTips = "\"on\" is a very common word and was not included in your search [details]"
|
34
|
-
result.searchTime = 0.000001
|
35
|
-
|
36
|
-
# For Mono, we have to clone objects if they're referenced by more than one place, otherwise
|
37
|
-
# the Ruby SOAP collapses them into one instance and uses references all over the
|
38
|
-
# place, confusing Mono.
|
39
|
-
#
|
40
|
-
# This has recently been fixed:
|
41
|
-
# http://bugzilla.ximian.com/show_bug.cgi?id=72265
|
42
|
-
result.directoryCategories = [
|
43
|
-
category("Web Development", "UTF-8"),
|
44
|
-
category("Programming", "US-ASCII"),
|
45
|
-
]
|
46
|
-
|
47
|
-
result
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
def category(name, encoding)
|
52
|
-
cat = DirectoryCategory.new
|
53
|
-
cat.fullViewableName = name.dup
|
54
|
-
cat.specialEncoding = encoding.dup
|
55
|
-
cat
|
56
|
-
end
|
57
|
-
end
|
@@ -1,108 +0,0 @@
|
|
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
|
@@ -1,50 +0,0 @@
|
|
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
|