Sha256: 266db568abe069534a4ffd95c16b4b355ec7c357f193189cd80a08ac7057fe73
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require 'rubygems' require File.join(File.dirname(__FILE__), '..', 'lib', 'preposterous') # # creating a posterous object # # all requests need to be authenticated # this creates your client object and sets up # your posterous object for actions client = Preposterous::HTTPAuth.new("my@email.addre.ss", "password") posterous = Preposterous::Base.new(client) # # get and print a list of your posterous sites # posterous.getsites.each do |site| puts "#{site['id']} #{site['url']}" end # # standard post w/no files # # initialize the fields # field names are here: http://posterous.com/api/posting fields = { :site_id => 99999999, :title => "This is my post", :body => "This is some boring text for my autogenerated post." } # perform the actual post posterous.newpost(fields, *files) # # standard post w/files # # initialize array of files files = [ File.open("file_one.png"), File.open("file_two.png") ] # initialize fields fields = { :site_id => 1313830, :title => "Check out these sweet pics", :body => "I love these pics." } # perform the actual post posterous.newpost(fields, *files)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
preposterous-0.0.2 | examples/post.rb |