Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST Issue #7

Closed
sourcepad opened this issue Jul 23, 2010 · 4 comments
Closed

REST Issue #7

sourcepad opened this issue Jul 23, 2010 · 4 comments

Comments

@sourcepad
Copy link

Hi appoxy!

Thanks for developing this lightweight mini_fb. However, I came up with this problem when I was searching for my friends who are app users too. Here is the code I created:

@fb = MiniFB::OAuthSession.new(access_token, 'es_ES')
@fb.rest('friends.getAppUsers')
NoMethodError Exception: undefined method `each_pair' for XXXXXX:Fixnum

Thanks again and hoping for a quick response.

@appoxy
Copy link
Collaborator

appoxy commented Jul 23, 2010

Be sure to use the correct methods. Looks like you using the old Facebook API so use MiniFB.call, not rest.

@dpogue
Copy link
Contributor

dpogue commented Aug 14, 2010

This is still an issue. Any attempt to call MiniFB.rest(token, 'facebook.friends.get') results in Hashie errors.

> friends = MiniFB.rest(token, 'facebook.friends.get')
resp=[XXXXXXX,XXXXXXX]
NoMethodError: undefined method `each_pair' for XXXXXX:Fixnum
    from ./gems/gems/hashie-0.2.1/lib/hashie/mash.rb:105:in `deep_update'
    from ./gems/gems/hashie-0.2.1/lib/hashie/mash.rb:52:in `initialize'
    from ./gems/gems/mini_fb-1.1.3/lib/mini_fb.rb:681:in `new'
    from ./gems/gems/mini_fb-1.1.3/lib/mini_fb.rb:681:in `fetch'
    from ./gems/gems/mini_fb-1.1.3/lib/mini_fb.rb:681:in `collect!'
    from ./gems/gems/mini_fb-1.1.3/lib/mini_fb.rb:681:in `fetch'
    from ./gems/gems/mini_fb-1.1.3/lib/mini_fb.rb:642:in `rest'

@appoxy
Copy link
Collaborator

appoxy commented Aug 16, 2010

Seems like this change would fix it:

if res_hash.is_a? Array # fql return this
res_hash.collect! { |x| x.is_a?(Hash) ? Hashie::Mash.new(x) : x }
else
res_hash = Hashie::Mash.new(res_hash)
end

@dpogue
Copy link
Contributor

dpogue commented Aug 16, 2010

Yep, just checked and it is correctly giving me an Array of user IDs :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant