Firstly, I am new to rails, so I'm sorry if there is something that I do not understand correctly. I am wondering how I can populate a model using data mining via API.
Context: I use OAuth2 authentication with omniauth / devise.
On my client side of the client (opposite the provider), I selected all the users who logged in at least once, this is the "client application", and I want to display them. It is obvious that at any time when a new user is registered in the client application, I do not save all his information in the client database in order to avoid duplication. All I store is user_id along with its access token.
So I thought that after collecting all the user data, I could fill it in to the user model before passing it to the view. What would be the best way to do such a thing? I was looking for the Named Orb, but I donβt understand how to apply it to my specific scenario. For example, it would be great if you could populate all users of my model using something like this:
# ApiRequest is a container class for HTTParty get = ApiRequest.new.get_users(User.all) // here "get" is a JSON array of all users data response = get.parsed_response['users'] User.populate(response).all
Thank you very much for your help.
source share