Skip to content

Latest commit

 

History

History
48 lines (30 loc) · 1.58 KB

README.rdoc

File metadata and controls

48 lines (30 loc) · 1.58 KB

Ruby wrapper for the Trademe API

API available at: developer.trademe.co.nz

Sample usage:

gateway = Trademe::Gateway.new
authorize_url = gateway.generate_request_token(callback, key, secret)
session[:request_token] = gateway.request_token
redirect_to authorize_url

Upon return to callback url (with params set):

gateway = Trademe::Gateway.new
gateway.request_token = session[:request_token]
if gateway.get_access_token(params[:oauth_verifier])
  session[:access_token] = gateway.access_token
end

You are now verified!

Currently the OAuth system has been implemented so that searches are counted against the “Authenticated rate limit” as per the Trademe website. You can perform searches via the gateway if you have been authorized or not, but non authorized searches are limited to 60 requests per hour!

Perform API searches via:

gateway.search "property/residential", :search_string => "flash apartment", :date_from => 4.hours.ago

This will return the parsed JSON response

To come:

Planning to add these at some point:

  • Total API coverage

  • Requests for private data that needs authentication

  • Write requests

Contributions

Feel free to get in touch! It is very early days as the Trademe API was release a week ago. If you want to push a patch, please fork the project, commit the patch to the fork and submit a pull request.

For anything else, send me a me a message via Github github.com/clarketus

License

This code is free to use under the terms of the MIT license.