Question

I'm using Octokit.rb to search GitHub users and the response returns a Sawyer::Resource object. I'm currently accessing the data this way:

[].tap do |users|
  @results.items.each do |item|
    user = item.rels[:self].get.data
    user = { 
      location: user.location, 
      username: user.login, 
      name: user.name, 
      email: user.email 
    }

    users << user
  end
end

I'd like to iterate over the users array created and display the results, however, right now the method takes extremely long as a result of accessing the data thru #rels[:self].get.data and I'm not sure what to do. Any help would be greatly appreciated!

Was it helpful?

Solution

Hey so I started messing around with the Octokit.rb library yesterday after I saw your question and I actually ran into the same issue as Jason pointed out. You're on the right track about using concurrent requests. I'm not sure about the rate limit being an issue and if it is you could always contact Github and ask if they could up your limit. If you're still having issues I would recommend using the rest-more gem, which uses rest-core to make concurrent requests. Its really simple to setup just read the docs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top