Class: InstagramFeedService

Inherits:
Object
  • Object
show all
Defined in:
app/services/instagram_feed_service.rb

Instance Method Summary collapse

Constructor Details

#initializeInstagramFeedService

Returns a new instance of InstagramFeedService.



3
4
5
# File 'app/services/instagram_feed_service.rb', line 3

def initialize
  @client = Instagram.client(:access_token => ENV['INSTAGRAM_ACCESS_TOKEN'])
end

Instance Method Details

#get_feed_for_tag(tag) ⇒ Object



7
8
9
10
11
12
# File 'app/services/instagram_feed_service.rb', line 7

def get_feed_for_tag(tag)
  tagged_posts = @client.user_recent_media.select{|post| post[:tags].include?(tag.downcase)}
  tagged_posts.map do |post|
    Social::InstagramPostPresenter.from_instagram_post(post)
  end
end