Permalink
Browse files

Update Posterous migrator to take an api_token instead of email and pass

The Posterous API call for retrieving a user's API token (`/api/2/auth/token`) is no longer supported and returns 410 GONE. This patch updates the #process method to accept an API token instead of an email address and password. A user's API token can be retrieved from http://posterous.com/api.
  • Loading branch information...
1 parent fa6d013 commit c3b12457a0e6b758af0a3611043f74602f18c2c7 @nfm committed Jan 17, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/jekyll/migrators/posterous.rb
@@ -27,12 +27,10 @@ def self.fetch(uri_str, limit = 10)
end
end
- def self.process(email, pass, blog = 'primary')
- @email, @pass = email, pass
- @api_token = JSON.parse(self.fetch("/api/2/auth/token").body)['api_token']
+ def self.process(api_token, blog = 'primary')
FileUtils.mkdir_p "_posts"
- posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}").body)
+ posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{api_token}").body)
page = 1
while posts.any?
@@ -61,7 +59,7 @@ def self.process(email, pass, blog = 'primary')
end
page += 1
- posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}&page=#{page}").body)
+ posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{api_token}&page=#{page}").body)
end
end
end

0 comments on commit c3b1245

Please sign in to comment.