Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
updated some todos in the readme and some other possible usage examples
  • Loading branch information
pauldix committed Mar 3, 2009
1 parent 128fa12 commit d8cf4dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.textile
Expand Up @@ -46,6 +46,8 @@ h2. Next Steps

* Add support for error handling. Automatic retry, exponential back-off, queuing for later
* Add server test suite
* Add put support
* Add support to get to pass in params in the options hash (instead of just as part of the url)

h2. LICENSE

Expand Down
22 changes: 17 additions & 5 deletions examples/possible_usage.rb
@@ -1,5 +1,6 @@
# just a brainstorming area where I can play around with different looks for the API

# one example
results = HTTPMachine.service_access(:web_search => ["paul dix"], :web_search => ["ruby", "nyc"])
results[:web_search] # => [[return_results, pages], [return_results, pages]]

Expand All @@ -12,23 +13,34 @@ def self.web_search(*args)
return [return_results, pages]
end

# another example
@results = []
@pages = []
HTTPMachine.service_access do
YahooBOSS.web_search("paul dix") do |results|
results.each {|result| @result[result.id]}
@results += results

results.each do |result|
Page.get(result.url) {|page| @pages << page}
Page.get(result.url) {|page| @pages << page }
end
end

YahooBOSS.web_search("joe") do |results|
@results << results

@results += results
@
results.each do |result|
Page.get(result.url) {|page| @pages << page}
end
end
end

# yet another example
@results = []
HTTPMachine.service_access do
@results += YahooBOSS.web_search("paul dix").get_pages
@results += YahooBOSS.web_search("feedzirra").get_pages
end

HTTPMachine.service_access do
YahooBOSS.remote(:web_search, :params => {:q => "paul dix"})
end

0 comments on commit d8cf4dc

Please sign in to comment.