Class: ZooniverseSocial::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/zooniverse_social/data.rb

Class Method Summary collapse

Class Method Details

.currentObject



23
24
25
26
27
28
# File 'lib/zooniverse_social/data.rb', line 23

def self.current
  {
    posts: posts.data,
    statuses: statuses.data
  }
end

.postsObject



11
12
13
# File 'lib/zooniverse_social/data.rb', line 11

def self.posts
  @posts ||= Posts.new
end

.sourcesObject



19
20
21
# File 'lib/zooniverse_social/data.rb', line 19

def self.sources
  [posts, statuses]
end

.startObject



34
35
36
37
# File 'lib/zooniverse_social/data.rb', line 34

def self.start
  task = Concurrent::TimerTask.new(execution_interval: 600, timeout_interval: 20, run_now: true){ update }.execute
  TaskObserver.new task, method(:start)
end

.statusesObject



15
16
17
# File 'lib/zooniverse_social/data.rb', line 15

def self.statuses
  @statuses ||= Statuses.new
end

.updateObject



30
31
32
# File 'lib/zooniverse_social/data.rb', line 30

def self.update
  sources.each &:update
end