If upon such request being made, such railroad shall fail, neglect or refuse to construct such crossing and gates, or to keep the same in repair, then the owner of such farm may, by appropriate action, compel such railroad to so construct, keep and maintain such crossing and gates, or such owner may construct or repair such crossing and gates, and then collect from such railroad the cost thereof.