Phew! What a week.
I’ve started at Bam, and I’m trying to get all of my outstanding contracts completed and trying to organise the WA Web Awards (I’m the sub-committee chairperson).
A few quick announcments:
- WA Web Awards entries are open. It’s $25 for Port80 members, $10 for Student Members, and $35 for non-members.
- 88 Miles is but days away from having a full web-service API released. It’s all working, I’m just finishing up the unit tests.
- Port80 Melbourne is starting up next week. It is piggy-backing on a Ruby on Rails user group meeting. Go and see Miles’ blog for details.
- There has been some interest in starting a Ruby on Rails special interest group on the back of Port80 over here, so I’m seriously looking in to that. Miles’ suggestion for a name was caboose. I like it
End
I’ve been working on setting up web services in Ruby on Rails for 88 Miles and have discovered somethings that may be useful to other users. It may save someone some time, as the documentation for this particular area is a little sparse.
1. Putting a colon(:) in front of a return type indicates a primative - i.e an integer or string. If you want to return a complex type, leave off the colon
-
api_method :find, :expects => [ { :id => :int }, { :user_name => :string }, { :password => :string } ], :returns => [ Shift ]
This will return the “Shift” Object. You can return Arrays by using two square brackets:
-
api_method :find_all, :expects => [ { :project_id => :int }, { :user_name => :string }, { :password => :string } ], :returns => [[ Shift ]]
This will return an array of “Shift” objects.
2. Raising an exception with only a message invokes a SOAPException (and probably a XML-RPC error too - haven’t tried that yet), which is a much better way of handling errors than returning integers or strings (For those playing at home, check out the “fault” body of the SOAP message)
-
raise Exception, “This is the string that gets returned”
3. If you are trying to access the webservices via WDSL, simply add /wsdl at the end of the URL
http://yoursite/controller/wdsl
4. You can generate the scaffolds for a webservice using the generate script:
# script/generate web_service controller_name
Well, Miles has finally managed to do it - today I signed on as the “Development Team Leader” at Bam Creative. Bam Creative is one of the coolest and most respected boutique web companies in Perth and it is an honour to become part of the team.
I’ve done quite a bit of contract work for them in the past and I think we will be a good match. There is of course that whole issue of having two Miles/Myles’ in the office. I don’t think there are too many companies that can boast that combination!
So what does this mean for MadPilot Productions? Not a great deal - I will still be actively working on 88 Miles and a some other yet-to-be-released systems (watch this space!), but I won’t be taking on any freelance contract work.