Я использую Shippinglogic для извлечения данных с различных носителей.
Я хочу сохранить данные, которые перетащены в мою таблицу.
ИтакЯ пытаюсь сделать это так:
ups = Shippinglogic::UPS.new
self.attributes = ups.track(:tracking_number => number)
self.save
Вот что возвращает вызов ups.track
:
>> ups.track(:tracking_number => '1ZX2988X0386964132')
=> #<Shippinglogic::UPS::Track::Details:0x1093ba7e0 @origin_country="US", @service_type="GROUND", @destination_state="AL", @origin_state="KY", @signature_name=nil, @destination_city="BIRMINGHAM", @events=[#<Shippinglogic::UPS::Track::Details::Event:0x109383010 @country="US", @name="DELIVERED", @postal_code="35242", @city="BIRMINGHAM", @type="D", @state="AL", @occurred_at=Tue Aug 16 13:44:00 -0500 2011>, #<Shippinglogic::UPS::Track::Details::Event:0x109382d90 @country="US", @name="OUT FOR DELIVERY", @postal_code=nil, @city="BIRMINGHAM", @type="I", @state="AL", @occurred_at=Tue Aug 16 07:46:00 -0500 2011>, #<Shippinglogic::UPS::Track::Details::Event:0x1093b1dc0 @country="US", @name="ARRIVAL SCAN", @postal_code=nil, @city="BIRMINGHAM", @type="I", @state="AL", @occurred_at=Tue Aug 16 07:00:00 -0500 2011>, #<Shippinglogic::UPS::Track::Details::Event:0x109382c50 @country="US", @name="DEPARTURE SCAN", @postal_code=nil, @city="NASHVILLE", @type="I", @state="TN", @occurred_at=Tue Aug 16 03:45:00 -0500 2011>, #<Shippinglogic::UPS::Track::Details::Event:0x109382098 @country="US", @name="ARRIVAL SCAN", @postal_code=nil, @city="NASHVILLE", @type="I", @state="TN", @occurred_at=Tue Aug 16 00:19:00 -0500 2011>, #<Shippinglogic::UPS::Track::Details::Event:0x10937d0c0 @country="US", @name="DEPARTURE SCAN", @postal_code=nil, @city="LEXINGTON", @type="I", @state="KY", @occurred_at=Mon Aug 15 21:36:00 -0500 2011>, #<Shippinglogic::UPS::Track::Details::Event:0x109375e38 @country="US", @name="ORIGIN SCAN", @postal_code=nil, @city="LEXINGTON", @type="I", @state="KY", @occurred_at=Mon Aug 15 16:08:00 -0500 2011>, #<Shippinglogic::UPS::Track::Details::Event:0x109370bb8 @country="US", @name="BILLING INFORMATION RECEIVED", @postal_code=nil, @city=nil, @type="M", @state=nil, @occurred_at=Mon Aug 15 12:18:56 -0500 2011>], @origin_city="CAMPBELLSVILLE", @delivery_at=Tue Aug 16 13:44:00 -0500 2011, @status="DELIVERED", @destination_country="US">
Но объект, который возвращается Shippinglogic, не сохраняется вattributes
.
Как я могу это сделать?