autostats
Autostats is a simple gem that can be used to easily get a long list of information about a car, from aol autos. Create a car object like so: car = Car.new(“2012”,“Ford”,“Mustang”). Since cars come in a variety of trim packages and variations, the car object has an array of trims composed of all its statistics. As an example, you could get the engine information of the first trim of a car like this: car.trims.engine
Example Use:
ruby-1.9.2-p290 :001 > require ‘autostats’
=> true
ruby-1.9.2-p290 :002 > car = Car.new(“2012”,“Ford”,“Mustang”) Getting specs: 100% |oooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
=> #<Car:0x007fb95b2b0590 @make="Ford", @model="Mustang", @model_year="2012", @base_url="http://autos.aol.com/cars-Ford-Mustang-2012", @overview_url="http://autos.aol.com/cars-Ford-Mustang-2012/overview", @trims_url="http://autos.aol.com/cars-Ford-Mustang-2012/available-trims/", @specs_url="http://autos.aol.com/cars-Ford-Mustang-2012/specs", @mpg_url="http://autos.aol.com/cars-Ford-Mustang-2012/specs/mpg", @trims=[V6 2dr Coupe, V6 Premium 2dr Coupe, GT 2dr
Coupe, GT Premium 2dr Coupe, Boss 302 2dr Coupe, V6 2dr Convertible, V6 Premium 2dr Convertible, GT 2dr Convertible, GT Premium 2dr Convertible], @overview="\n\t\t\t\tThe Mustang
remains one of the most widely recognized, respected and desired nameplates in the automobile business. It may be retro inspired, but the Mustang is a thoroughly modern car. Today's
Mustang still delivers the bold styling, rear-drive performance and affordability that have been Mustang hallmarks for decades.\n\t\t\t\t\tThe Mustang is available either as a coupe or
convertible. Each is available with a 305-hp 3.7-liter V6 or a 412-hp 5.0-liter V8 engine. A six-speed manual transmission is standard; a six-speed automatic is optional. A 302 Boss or
Laguna Seca coupe with a 444-hp 5.0-liter V8 with six-speed manual is also available. Standard safety features include electronic stability control, traction control, four-wheel
anti-lock disc brakes, side-impact airbags and LED sequential tail lamps. The Mustang can be equipped with alloy wheels, automatic headlights, heated power leather seats, satellite
radio, navigation system and more.\n\t\t\t\t\tThe big news for 2012 is the addition of the Boss 302 and Laguna Seca - both with a revised version of the five-liter that revs higher and
has more horsepower than the GT.\n\t\t\t\t\t">
ruby-1.9.2-p290 :003 > car.trims.available_stats performance.base_engine_type performance.horsepower performance.horsepower_rpm performance.torque performance.torque_rpm performance.maximum_towing_capacity performance.drive_type performance.turning_radius interior.rear_head_room interior.front_shoulder_room interior.rear_shoulder_room interior.front_hip_room interior.rear_hip_room interior.front_leg_room interior.rear_leg_room interior.luggage_capacity interior.maximum_cargo_capacity interior.standard_seating exterior.length exterior.body_width exterior.body_height exterior.wheelbase exterior.curb fuel_economy.fuel_tank_capacity fuel_economy.epa_mileage_estimates
=> [:fuel_tank_capacity, :epa_mileage_estimates]
ruby-1.9.2-p290 :004 > car.trims.engine
V-6 - with 305 hp at 6,500rpm and 280 lb-ft. of torque at 4,250rpm
=> nil
ruby-1.9.2-p290 :005 > car.trims.mpg_combined
=> 24
Contributing to autostats
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright
Copyright © 2012 Conner Wingard. See LICENSE.txt for further details.