Skip to content

Instantly share code, notes, and snippets.

@kenton
Created April 18, 2012 16:07
Show Gist options
  • Save kenton/2414582 to your computer and use it in GitHub Desktop.
Save kenton/2414582 to your computer and use it in GitHub Desktop.
>> dropoff_coords = "37.3716, -121.921"
=> "37.3716, -121.921"
>> pickup_coords = "37.3741595214844, -121.925221923828"
=> "37.3741595214844, -121.925221923828"
>> quote = Ondemand::Pricing::Ride::QuoteRide.new_from_rate_card(:dropoff_latlng => dropoff_coords, :pickup_latlng => pickup_coords)
{"rows":[{"elements":[{"status":"ZERO_RESULTS"}]}],"destination_addresses":["37.368,-42.2769"],"status":"OK","origin_addresses":["37.3769933814132,-42.2951683058561"]}
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/google_distance_matrix_api/request.rb:94:in `perform'
from /Users/kentonnewby/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/protocol.rb:135:in `each_with_index'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/google_distance_matrix_api/request.rb:74:in `each'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/google_distance_matrix_api/request.rb:74:in `each_with_index'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/google_distance_matrix_api/request.rb:74:in `perform'
from /Users/kentonnewby/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/protocol.rb:135:in `each_with_index'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/google_distance_matrix_api/request.rb:73:in `each'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/google_distance_matrix_api/request.rb:73:in `each_with_index'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/google_distance_matrix_api/request.rb:73:in `perform'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/lazy_route_lookup.rb:110:in `perform_request'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/lazy_route_lookup.rb:82:in `request'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/routes/lazy_route_lookup.rb:24:in `find'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/ride/abstract_ride.rb:69:in `initialize'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/ride/quote_ride.rb:32:in `new'
from /Users/kentonnewby/dev/limos/lib/ondemand/pricing/ride/quote_ride.rb:32:in `new_from_rate_card'
from (irb):3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment