Created
August 15, 2010 22:34
-
-
Save texel/526030 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'active_support' | |
| class Geckobyte | |
| include HTTParty | |
| base_uri 'http://webservices.geckobyte.com' | |
| remote_methods = %w[bodies brands makes models options tire tires tires_by_brand_name tires_by_size | |
| tires_test tires_with_wheel vehicle wheel wheels_by_brand_name wheels_with_tire years] | |
| remote_methods.each do |m| | |
| class_eval %Q{ | |
| def #{m}(options = {}) | |
| options[:query] = {:op => "get#{m.to_s.camelize}"}.merge(options[:query] || {}) | |
| self.class.get(options) | |
| end | |
| def #{m}=(options = {}) | |
| end | |
| } | |
| end | |
| end | |
| req = Geckobyte.new | |
| req.tires |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment