Skip to content

Instantly share code, notes, and snippets.

@kimihito
Created December 15, 2012 11:15
Show Gist options
  • Save kimihito/4293882 to your computer and use it in GitHub Desktop.
Save kimihito/4293882 to your computer and use it in GitHub Desktop.
#file name is title of article.
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require 'tumblr_client'
Tumblr.configure do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.oauth_token = "YOUR_ACCESS_TOKEN"
config.oauth_token_secret = "YOUR_TOKEN_SECRET"
end
client = Tumblr.new
Dir::glob("./article/*.txt").each { |f|
file = open(f)
title = File.basename(f,".txt")
content = ""
File.foreach(file) do |article|
content << article
end
client.text("kimihito.tumblr.com", :state => "published", :title => title, :body => content)
}
puts "Posted!!"
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require 'tumblr_client'
Tumblr.configure do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.oauth_token = "YOUR_ACCESS_TOKEN"
config.oauth_token_secret = "YOUR_TOKEN_SECRET"
end
client = Tumblr.new
client.text("kimihito.tumblr.com", :state => "published", :title => "hoge", :body => "foo")
puts "Posted!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment