class ZooniverseSocial::Statuses

Attributes

data[R]

Public Class Methods

new() click to toggle source
# File lib/zooniverse_social/statuses.rb, line 7
def initialize
  @updater = Updater.new 'https://graph.facebook.com', '/v2.5/162907460488617/posts'
  update
end

Public Instance Methods

update() click to toggle source
# File lib/zooniverse_social/statuses.rb, line 12
def update
  response = @updater.update access_token: ENV.fetch('FACEBOOK_TOKEN'), limit: 3
  @data = response.fetch('data', []).collect do |status|
    post_id = status['id'].split('_').last

    {
      message: status['message'],
      created_at: status['created_time'],
      link: "https://www.facebook.com/therealzooniverse/posts/#{ post_id }"
    }
  end
end