bonniecheung/OrdrInMapper — comment on commit 1186c1186f5e7f41d759f6126803b531acd744ed
File: app/models/location.rb line 2
By jduff:

Taken from your controller

``` ruby
def ordrin_address
OrdrIn::Address.new(street, city, zip, street2, state, phone, nick)
end

# Returns an array of hashes. Each hash has a restaurant name and address of a
# restaurant that will deliver to this location asap.

def delivery_list
date_time = OrdrIn::DT.new # would be nice if you could just do OrderIn::DT.new(:asap => true)
date_time.asap = true
r = OrdrIn::Restaurant.new
# Really you shouldn't need to do the json parsing,
# the OrderIn library should take care of that
@delivery_list ||= JSON.parse(r.delivery_list(date_time, place)).collect do |restaurant|
{:name => restaurant['na'], :address => restaurant['ad']}
end
end
```