mercredi 11 novembre 2015

How to solve no implicit conversion of String into Integer

how to solve this error. i want to get 'id' from this array. when i tried the below loop ,i got this error "no implicit conversion of String into Integer"

- @track['data']['tracking'].each do |check| id =check['id']

my controller

@track = AfterShip::V4::Tracking.get('ups', '1Z31Y1Y90490064644')

this is my checkpoint array

["id", "560b87b38c9079f272e98dfc"] ["created_at", "2015-09-30T06:56:51+00:00"] ["updated_at", "2015-09-30T06:56:55+00:00"] ["last_updated_at", "2015-09-30T06:56:55+00:00"] ["tracking_number", "1Z31Y1Y90490064644"] ["slug", "ups"] ["active", false] ["android", []] ["custom_fields", nil] ["customer_name", nil] ["delivery_time", 7] ["destination_country_iso3", "GBR"] ["emails", ["p@l.com"]] ["expected_delivery", nil] ["ios", []] ["note", nil] ["order_id", nil] ["order_id_path", nil] ["origin_country_iso3", "HKG"] ["shipment_package_count", 1] ["shipment_pickup_date", "2015-08-24T16:00:00"] ["shipment_delivery_date", "2015-09-01T14:22:00"] ["shipment_type", "UPS SAVER"] ["shipment_weight", 0.5] ["shipment_weight_unit", "kg"] ["signed_by", "MANTON (RESIDENTIAL)"] ["smses", []] ["source", "api"] ["tag", "Delivered"] ["title", "1Z31Y1Y90490064644"] ["tracked_count", 1] ["unique_token", "bkGcaTOJDe"] ["checkpoints", [{"slug"=>"ups", "city"=>nil, "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"HK", "country_name"=>"HK", "message"=>"BILLING INFORMATION RECEIVED", "country_iso3"=>"HKG", "tag"=>"InfoReceived", "checkpoint_time"=>"2015-08-25T23:05:47", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>nil, "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>nil, "country_name"=>nil, "message"=>"YOUR PACKAGE WAS RELEASED BY THE CLEARING AGENCY.", "country_iso3"=>nil, "tag"=>"InTransit", "checkpoint_time"=>"2015-08-27T16:57:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>nil, "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>nil, "country_name"=>nil, "message"=>"YOUR PACKAGE WAS RELEASED BY THE CLEARING AGENCY.", "country_iso3"=>nil, "tag"=>"InTransit", "checkpoint_time"=>"2015-08-27T17:07:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"NORTH RODE", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"NORTH RODE, GB", "country_name"=>"NORTH RODE, GB", "message"=>"THE RECEIVER MUST PAY THE DUTIES OR TAXES DUE ON THE PACKAGE.", "country_iso3"=>"GBR", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-27T20:17:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"KWAI CHUNG", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"KWAI CHUNG, HK", "country_name"=>"KWAI CHUNG, HK", "message"=>"ORIGIN SCAN", "country_iso3"=>"HKG", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-27T21:38:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"KWAI CHUNG", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"KWAI CHUNG, HK", "country_name"=>"KWAI CHUNG, HK", "message"=>"DEPARTURE SCAN", "country_iso3"=>"HKG", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-28T00:02:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"CHEK LAP KOK", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"CHEK LAP KOK, HK", "country_name"=>"CHEK LAP KOK, HK", "message"=>"DEPARTURE SCAN", "country_iso3"=>"HKG", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-28T12:22:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"DUBAI", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"DUBAI, AE", "country_name"=>"DUBAI, AE", "message"=>"ARRIVAL SCAN", "country_iso3"=>"ARE", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-28T16:00:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"DUBAI", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"DUBAI, AE", "country_name"=>"DUBAI, AE", "message"=>"DEPARTURE SCAN", "country_iso3"=>"ARE", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-28T20:30:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"KOELN (COLOGNE)", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"KOELN (COLOGNE), DE", "country_name"=>"KOELN (COLOGNE), DE", "message"=>"DEPARTURE SCAN", "country_iso3"=>"DEU", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-29T05:05:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"KOELN (COLOGNE)", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"KOELN (COLOGNE), DE", "country_name"=>"KOELN (COLOGNE), DE", "message"=>"DEPARTURE SCAN", "country_iso3"=>"DEU", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-31T02:34:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"EAST MIDLANDS AIRPOR", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"EAST MIDLANDS AIRPOR, GB", "country_name"=>"EAST MIDLANDS AIRPOR, GB", "message"=>"ARRIVAL SCAN", "country_iso3"=>"GBR", "tag"=>"InTransit", "checkpoint_time"=>"2015-08-31T18:00:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"EAST MIDLANDS AIRPOR", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"EAST MIDLANDS AIRPOR, GB", "country_name"=>"EAST MIDLANDS AIRPOR, GB", "message"=>"DEPARTURE SCAN", "country_iso3"=>"GBR", "tag"=>"InTransit", "checkpoint_time"=>"2015-09-01T00:59:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"TAMWORTH", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"TAMWORTH, GB", "country_name"=>"TAMWORTH, GB", "message"=>"ARRIVAL SCAN", "country_iso3"=>"GBR", "tag"=>"InTransit", "checkpoint_time"=>"2015-09-01T01:41:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"TAMWORTH", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"TAMWORTH, GB", "country_name"=>"TAMWORTH, GB", "message"=>"DEPARTURE SCAN", "country_iso3"=>"GBR", "tag"=>"InTransit", "checkpoint_time"=>"2015-09-01T03:17:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"NORTH RODE", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"NORTH RODE, GB", "country_name"=>"NORTH RODE, GB", "message"=>"ARRIVAL SCAN", "country_iso3"=>"GBR", "tag"=>"InTransit", "checkpoint_time"=>"2015-09-01T04:51:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"NORTH RODE", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"NORTH RODE, GB", "country_name"=>"NORTH RODE, GB", "message"=>"OUT FOR DELIVERY", "country_iso3"=>"GBR", "tag"=>"OutForDelivery", "checkpoint_time"=>"2015-09-01T04:56:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"NORTH RODE", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"NORTH RODE, GB", "country_name"=>"NORTH RODE, GB", "message"=>"THE DRIVER WAS UNABLE TO COLLECT FUNDS ON THE FIRST DELIVERY ATTEMPT. A SECOND ATTEMPT WILL BE MADE.", "country_iso3"=>"GBR", "tag"=>"AttemptFail", "checkpoint_time"=>"2015-09-01T14:18:00", "coordinates"=>[], "state"=>nil, "zip"=>nil}, {"slug"=>"ups", "city"=>"HYDE", "created_at"=>"2015-09-30T06:56:55+00:00", "location"=>"HYDE, GB, SK14 5", "country_name"=>"HYDE, GB, SK14 5", "message"=>"DELIVERED", "country_iso3"=>"GBR", "tag"=>"Delivered", "checkpoint_time"=>"2015-09-01T14:22:00", "coordinates"=>[], "state"=>nil, "zip"=>"SK14 5"}]] ["tracking_account_number", nil] ["tracking_destination_country", nil] ["tracking_key", nil] ["tracking_postal_code", nil] ["tracking_ship_date", nil]

Aucun commentaire:

Enregistrer un commentaire