Im doing:
me = FbGraph::User.new('me', :access_token => authentication.token);
puts me.accounts.to_yaml
Which returns:
--- !seq:FbGraph::Connection
- !ruby/object:FbGraph::Page
access_token: something_here
affiliation:
artists_we_like:
attire:
awards:
band_interests:
band_members:
bio:
booking_agent:
can_post:
category: Food/beverages
checkin_count:
company_overview:
culinary_team:
current_location:
directed_by:
endpoint: https://graph.facebook.com/foobar
... # and so forth
How can I parse through this so i can get access_token? i.e. "something_here"
puts me.accounts.access_token
returns
undefined method `access_token' for #<FbGraph::Connection:0x00000100dab938>
On the other hand.
puts me.accounts.inspect
returns:
[#<FbGraph::Page:0x00000103738120 @identifier="foobar", @endpoint="https://graph.facebook.com/foobar", @access_token="something_here", @name="foobar", @username=nil, @category="Food/beverages", @like_count=nil, @affiliation=nil, @artists_we_like=nil, @attire=nil, @awards=nil, @band_interests=nil, @band_members=nil, @bio=nil, @booking_agent=nil, @can_post=nil, @compa开发者_开发技巧ny_overview=nil, @culinary_team=nil, @current_location=nil, @directed_by=nil, @features=nil, @general_info=nil, @general_manager=nil, @genre=nil, @hometown=nil, @influences=nil, @is_community_page=nil, @link=nil, @location=nil, @mission=nil, @mpg=nil, @personal_info=nil, @personal_interests=nil, @phone=nil, @plot_outline=nil, @press_contact=nil, @price_range=nil, @produced_by=nil, @products=nil, @public_transit=nil, @record_label=nil, @screenplay_by=nil, @starring=nil, @studio=nil, @website=nil, @written_by=nil, @parking=[], @payment_options=[], @restaurant_services=[]
....
Anyone know how this can be achieved?
Oh silly me.
puts me.accounts.first.access_token
Works!
精彩评论