Я использую Embed.ly API, но при использовании примера кода я просто получаю длинную строку данных, а не объект, к которому я могу получить доступ к различным частям, вот мой код:
embedly_api = Embedly::API.new :key => 'HIDDEN', :user_agent => 'Mozilla/5.0 (compatible; mytestapp/1.0; my@email.com)'
url = 'http://www.guardian.co.uk/media/2011/jan/21/andy-coulson-phone-hacking-statement'
obj = embedly_api.oembed :url => url
obj[0].marshal_dump
Объект obj [0] возвращает:
{:provider_url=>"http://www.guardian.co.uk/", :description=>"11.25am: Andy Coulson, the the director of communications at No 10, is to make a \"personal statement\". He has been under pressure in recent months over the phone-hacking scandal, with a slew of revelations in a number of civil court cases that appeared to bring the scandal closer to his door.", :title=>"Andy Coulson resigns – as it happened", :url=>"http://www.guardian.co.uk/media/2011/jan/21/andy-coulson-phone-hacking-statement", :thumbnail_width=>140, :thumbnail_url=>"https://static-secure.guim.co.uk/sys-images/Guardian/Pix/pictures/2011/1/14/1295010840306/Andy-Coulson-003.jpg", :version=>"1.0", :provider_name=>"Guardian", :type=>"link", :thumbnail_height=>84}
Я хочу получить доступ к объекту obj [0] .provider_url, описанию и так далее ... как?