public

how to create a test blog post using the posterous gem

  • Download Gist
gistfile1.rb
Ruby
1 2
>> @post = @site.posts.create(:title => 'test post from posterous gem', :body => 'body of test post from posterous gem')
=> <#<Posterous::Post:0x101894840> {:likes=>[], :privatestring=>"zwxwhywuvJ", :body_cleaned=>"body of test post from posterous gem", :slug=>"test-post-from-posterous-gem", :author_display_name=>"Thunderbird Robot", :current_member=>"{{member_role_for, 4498863 }}", :allowed=>true, :media=>{"videos"=>[], "audio_files"=>[], "images"=>[]}, :scheduled=>false, :full_url=>"http://thunderbirdrobot.posterous.com/test-post-from-posterous-gem", :locations=>[], :tags=>[], :likes_count=>0, :replies_count=>0, :title=>"test post from posterous gem", :display_date=>"2011/11/24 15:49:29 -0800", :views_count=>"{{post_view_count, 81798571}}", :number_of_comments=>0, :body_full=>"body of test post from posterous gem", :post_image_500=>nil, :short_url=>"http://post.ly/40ztZ", :user=>{"profile_pic"=>"http://posterous.com/images/profile/missing-user-75.png", "body"=>"EXPERIMENTAL Mozilla Thunderbird Support automated reports and graphics generated by robots er scripts!", "last_activity"=>"2011/11/24 15:49:29 -0800", "nickname"=>"thunderbirdrobot", "id"=>2309575, "lastname"=>"Robot", "profile_url"=>"http://posterous.com/users/cQcurUxyrUTy2", "firstname"=>"Thunderbird", "profile_image_35"=>"http://posterous.com/images/profile/missing-user-75.png", "display_name"=>"Thunderbird Robot"}, :body_excerpt=>"body of test post from posterous gem", :is_owned_by_current_user=>"{{owned_by_current_user?, 2309575, 4498863 }}", :post_image_115=>nil, :twitter_account=>"", :site_id=>4498863, :comments_count=>0, :id=>81798571, :draft=>false, :site=>{"name"=>"thunderbirdrobot's Space", "header_image"=>nil, "is_group"=>false, "subhead"=>nil, "is_private"=>false, "profile_image_75"=>"http://files.posterous.com/user_profile_pics/473/RolandTanglaoN93GPS1232x1840.jpg", "current_user_notification_frequency"=>"{{member_notification_option_for, 4498863 }}", "current_user_role"=>"{{member_role_for, 4498863 }}", "id"=>4498863, "posts_count"=>42, "comment_permission"=>1, "full_hostname"=>"thunderbirdrobot.posterous.com", "hostname"=>"thunderbirdrobot", "profile_image_35"=>"http://files.posterous.com/user_profile_pics/473/RolandTanglaoN93GPS1232x1840_thumb.jpg", "time_zone"=>"Pacific Time (US & Canada)", "sharing_enabled"=>true}, :is_private=>false, :body_html=>"body of test post from posterous gem"}>
testBlogPostUsingPosterous.rb
Ruby
1 2 3 4 5 6 7 8 9
require 'posterous'
Posterous.config = {
'username' => 'blah@email.com',
'password' => 'blabblah',
'api_token' => 'blabblahblh'
}
include Posterous
@site = Site.primary
@post = @site.posts.create(:title => 'test post from posterous gem', :body => 'body of test post from posterous gem')

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.