Sha256: fc7a02652bdcf1a218b25743f9a9f3dd4ce20d8bece3fbb84ad6c815087ff9b8

Contents?: true

Size: 652 Bytes

Versions: 11

Compression:

Stored size: 652 Bytes

Contents

require 'zooniverse_social/updater'

module ZooniverseSocial
  class Statuses
    attr_reader :data

    def initialize
      @updater = Updater.new 'https://graph.facebook.com', '/v2.5/162907460488617/posts'
      update
    end

    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
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
zooniverse_social-1.3.1 lib/zooniverse_social/statuses.rb
zooniverse_social-1.2.0 lib/zooniverse_social/statuses.rb
zooniverse_social-1.1.0 lib/zooniverse_social/statuses.rb
zooniverse_social-1.0.6 lib/zooniverse_social/statuses.rb
zooniverse_social-1.0.5 lib/zooniverse_social/statuses.rb
zooniverse_social-1.0.4 lib/zooniverse_social/statuses.rb
zooniverse_social-1.0.3 lib/zooniverse_social/statuses.rb
zooniverse_social-1.0.2 lib/zooniverse_social/statuses.rb
zooniverse_social-1.0.1 lib/zooniverse_social/statuses.rb
zooniverse_social-1.0.0 lib/zooniverse_social/statuses.rb
zooniverse_social-0.1.0 lib/zooniverse_social/statuses.rb