Created
October 25, 2019 21:33
-
-
Save breim/49e593fceb33e8a31289b474907d22eb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# frozen_string_literal: true | |
module InstagramProviderHelper | |
def network | |
send(provider) | |
end | |
def last_photo | |
network&.dig(:medias, -1, :media_url) | |
end | |
def medias | |
network&.dig(:medias) | |
end | |
def medias_count | |
network&.dig(:metadata, :media_count) | |
end | |
def followers_count | |
network&.dig(:metadata, :followers_count) | |
end | |
def follows_count | |
network&.dig(:metadata, :follows_count) | |
end | |
def name | |
network&.dig(:metadata, :name) | |
end | |
def biography | |
network&.dig(:metadata, :biography) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment