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

Exception when calling batch_api.get_object(id:number, {fields: 'email, ...'}) #621

Open
tscholz opened this issue Aug 19, 2017 · 0 comments

Comments

@tscholz
Copy link

tscholz commented Aug 19, 2017

Hi there

Thank you for the great gem!

Because of Facebook API 2.3 end of life we are forced to explicitly request extra info_fields like email, first_name etc. now. Our application depends on these extra fields.

By doing so we're running into an issue with the GraphBatchApi#graph_call method.

facebook = Koala::Facebook::API.new(oauth_token)

ids = [123456456, ...] # Some Facebook user ids of type Number, not String!

facebook.batch do |batch_api|
  ids.each do |id|
    batch_api.get_object(id, fields: 'first_name, last_name, email') # This will cause exception BatchOperation#to_batch_params when calling response[:relative_url] += (@url ... in line 55 
  end
end

From the documentation GraphAPIMethods#get_object accepts a number or string for the ID parameter but the parameter handling in BatchOperations isn't aware of this.

For now we are working around this issue by calling to_s on the id before passing it to #get_object.

We are using koala gem v3.0.

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