Method: Write::GG.fetch

Defined in:
app/models/write/gg.rb

.fetchObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/write/gg.rb', line 11

def self.fetch
  posts = []
  Write.accounts.each do |username, password|
    JSON.parse(open(url "/users/#{username}/gists").read).each do |p|
      next unless p["files"]["write.md"]
      post = new(p)
      posts.push post
    end
  end
  Rails.cache.write "write.posts", posts
end