mcmire/address_standardization — Issue #9: @http variable is nil in Mechanize
Author: ghedsouza
Created: 2011-12-12 19:02:54+00:00
State: open

I'm getting an error when trying to use the MelissaData service:

I traced it back a bit, and it's happening due to @http being nil in Mechanize::HTTP::Agent, but I haven't looked any further.

ruby-1.9.2-p180 :001 > require 'address_standardization'
=> true
ruby-1.9.2-p180 :002 > AddressStandardization::MelissaData.standardize_address(:city => "New York")
NoMethodError: undefined method `request' for nil:NilClass
from /Users/ed/.rvm/gems/ruby-1.9.2-p180@gaggleup/gems/mechanize-2.0.1/lib/mechanize/http/agent.rb:204:in `fetch'
from /Users/ed/.rvm/gems/ruby-1.9.2-p180@gaggleup/gems/mechanize-2.0.1/lib/mechanize.rb:386:in `get'
from /Users/ed/.rvm/gems/ruby-1.9.2-p180@gaggleup/gems/address_standardization-0.4.1/lib/address_standardization/melissa_data.rb:27:in `block in get_live_response'
from /Users/ed/.rvm/gems/ruby-1.9.2-p180@gaggleup/gems/mechanize-2.0.1/lib/mechanize.rb:312:in `initialize'
from /Users/ed/.rvm/gems/ruby-1.9.2-p180@gaggleup/gems/address_standardization-0.4.1/lib/address_standardization/melissa_data.rb:25:in `new'
from /Users/ed/.rvm/gems/ruby-1.9.2-p180@gaggleup/gems/address_standardization-0.4.1/lib/address_standardization/melissa_data.rb:25:in `get_live_response'
from /Users/ed/.rvm/gems/ruby-1.9.2-p180@gaggleup/gems/address_standardization-0.4.1/lib/address_standardization/abstract_service.rb:12:in `standardize_address'
from (irb):2
from /Users/ed/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `

'
ruby-1.9.2-p180 :003 > ^D