Skip to content

Instantly share code, notes, and snippets.

@texel
Created August 15, 2010 22:34
Show Gist options
  • Select an option

  • Save texel/526030 to your computer and use it in GitHub Desktop.

Select an option

Save texel/526030 to your computer and use it in GitHub Desktop.
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