0
embed.ly API를 사용하고 있는데 예제 코드를 사용할 때 데이터의 길이가 길고 객체가 아닌 다른 부분에 액세스 할 수 있습니다. 여기 내 코드는embedly에서 반환 된 whats의 액세스 부분
입니다.embedly_api = Embedly::API.new :key => 'HIDDEN', :user_agent => 'Mozilla/5.0 (compatible; mytestapp/1.0; [email protected])'
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, 설명 및 액세스하는 것입니다 ... 어떻게?
감사합니다. 매우 명백한 지금 나는 대답을 본다 :) – hso
가끔은 당신이 이미 알고있는 것들을보기 위해 다른 눈이 필요하다. – lucapette