Skip to content

Instantly share code, notes, and snippets.

@bethsecor
Created July 4, 2016 22:49
Show Gist options
  • Save bethsecor/9409293c6a60ae9a3808d0a234e11c8b to your computer and use it in GitHub Desktop.
Save bethsecor/9409293c6a60ae9a3808d0a234e11c8b to your computer and use it in GitHub Desktop.
class Friend
def self.service(current_user)
TwitterService.new(current_user)
end
def self.get_friends(current_user)
friends_json = service(current_user).friends
friends = friends_json.map do |friend|
build_object(friend)
end
friends.select { |friend| friend[:profile_banner_url] }
end
private
def self.build_object(data)
OpenStruct.new(data)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment