API documentation available at: developer.trademe.co.nz
gem "trademe"
In your Gemfile should do the trick.
Note that there is currently an issue with the Ruby OAuth library that may cause you to get 404 responses from token requests. You can fix that by adding the following to your Gemfile:
gem "oauth", :git => "git://github.com/nikz/oauth-ruby.git"
You can disable this when/if github.com/oauth/oauth-ruby/pull/65 gets applied.
gateway.search “property/residential”, :search_string => “flash apartment”, :date_from => 4.hours.ago
This will return the parsed JSON response
gateway = Trademe::Gateway.new(consumer_key, consumer_secret) authorize_url = gateway.generate_request_token(callback_url) 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!
Authentication allows you a rate limit of 1000 requests per hour (see developer.trademe.co.nz/api-overview/rate-limiting/ for more information)
You can specify a logger using:
gateway.logger = Trademe::Loggers::FileLogger.new(log_filename)
The bundled loggers are a FileLogger, RedisCountLogger and MultipleLogger.
FileLogger is a thin wrapper over Ruby’s Logger class.
RedisCountLogger is useful for rate limiting, it increments a Redis key for each call you make within an hour.
MultipleLogger allows you to use multiple loggers at once.
If you want to push a patch, please fork the project, commit the patch to the fork and submit a pull request.
Original code by github.com/clarketus.
This code is free to use under the terms of the MIT license.