Created
July 4, 2016 22:49
-
-
Save bethsecor/9409293c6a60ae9a3808d0a234e11c8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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