[RPS] merge-service-request

Edward Cho zerokarmaleft at gmail.com
Wed Jul 27 01:37:55 EDT 2005

This patch does the following things; some of which I outlined last
week, and some of which I stumbled upon along the way:

1) merges the web service calls in Request into Service
2) renames Service -> Connection and only publicly exposes wrapped web
service calls (and is also the sole interface for making remote calls)
3) creates a new Request object whose responsibility is to build
proper url strings from the api_key, method string, and pagination
4) adds a member instance of Request and Response to Connection
5) moves Response.more() to Connection
6) renames more() to get_next_page(), which returns an array
containing objects of the same type as the last web service call

Implementing new web service calls remains trivial:

def get_entry(id)
  # private helper method abstracts creating the http connections

  # set a flag for pagination purposes
  @response_klass = Entry

  # return the response

The interface for paging methods is clean:

connection = R43::Connection.new(1234)
goals = connection.search_goals("ruby")
goals += connection.get_next_page()
some_ruby_goals_tags = []
goals.each { |goal| goal.tags.each { |tag| some_ruby_goals_tags.push(tag) } }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: merge-request-service.patch
Type: text/x-patch
Size: 24750 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/therps-discuss/attachments/20050727/24057503/merge-request-service-0001.bin

More information about the Therps-discuss mailing list