Skip to content

Commit

Permalink
Merge pull request jekyll#472 from nfm/patch-1
Browse files Browse the repository at this point in the history
Update Posterous migrator to take an api_token
  • Loading branch information
mojombo committed Jan 23, 2012
2 parents 2da64d9 + 19fc8cb commit e27e255
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/jekyll/migrators/posterous.rb
Expand Up @@ -5,7 +5,7 @@
require 'uri'
require "json"

# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, blog)'
# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, api_key, blog)'

module Jekyll
module Posterous
Expand All @@ -27,9 +27,8 @@ 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(email, pass, api_token, blog = 'primary')
@email, @pass, @api_token = email, pass, api_token
FileUtils.mkdir_p "_posts"

posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}").body)
Expand Down

0 comments on commit e27e255

Please sign in to comment.