Sha256: 5f8263a59d09e31504e3bf621109d34732e76d8b110bcddc8e1932a6fe0a2f3d

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 Bytes

Contents

class Tumblr
  class Writer < Weary::Base
    
    def initialize(*credentials)
      @defaults = {:generator => Tumblr::GENERATOR}
      @defaults.merge!({:email => credentials[0], :password => credentials[1]}) unless credentials.blank?
    end
    
    # http://www.tumblr.com/docs/en/api#api_write
    post :write do |write|
      write.url = 'http://www.tumblr.com/api/write'
      write.requires = [:email, :password, :type]
      write.with = (Post::BASIC_PARAMS | Post::POST_PARAMS)
    end
    
    # http://www.tumblr.com/docs/en/api#editing_posts
    post :edit do |edit|
      edit.url = 'http://www.tumblr.com/api/write'
      edit.requires = [:email, :password, :'post-id']
      edit.with = (Post::BASIC_PARAMS | Post::POST_PARAMS)
    end
    
    # http://www.tumblr.com/docs/en/api#deleting_posts
    post :delete do |del|
      del.url = 'http://www.tumblr.com/api/delete'
      del.requires = [:email, :password, :'post-id']
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tumblr-rb-0.1.1 lib/tumblr/writer.rb
tumblr-rb-0.1.0 lib/tumblr/writer.rb