Class: ZooniverseSocial::Statuses
- Inherits:
-
Object
- Object
- ZooniverseSocial::Statuses
- Defined in:
- lib/zooniverse_social/statuses.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize ⇒ Statuses
constructor
A new instance of Statuses.
- #update ⇒ Object
Constructor Details
#initialize ⇒ Statuses
Returns a new instance of Statuses.
7 8 9 10 |
# File 'lib/zooniverse_social/statuses.rb', line 7 def initialize @updater = Updater.new 'https://graph.facebook.com', '/v2.5/162907460488617/posts' update end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/zooniverse_social/statuses.rb', line 5 def data @data end |
Instance Method Details
#update ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 |