Class: ZooniverseSocial::Data

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

Class Method Summary collapse

Class Method Details

.currentObject



26
27
28
29
30
31
32
# File 'lib/zooniverse_social/data.rb', line 26

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

.postsObject



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

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

.sourcesObject



22
23
24
# File 'lib/zooniverse_social/data.rb', line 22

def self.sources
  [posts, tweets, statuses]
end

.startObject



38
39
40
41
# File 'lib/zooniverse_social/data.rb', line 38

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



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

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

.tweetsObject



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

def self.tweets
  @tweets ||= Tweets.new
end

.updateObject



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

def self.update
  sources.each &:update
end