Class: Broadcast::Medium::Tumblr

Inherits:
Oauth show all
Defined in:
lib/broadcast/media/tumblr.rb

Instance Method Summary collapse

Methods inherited from Oauth

#authorize, #consumer, #token

Methods inherited from Broadcast::Medium

#initialize, #namespace, #options

Constructor Details

This class inherits a constructor from Broadcast::Medium

Instance Method Details

#publish(message) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/broadcast/media/tumblr.rb', line 8

def publish(message)
  @consumer = OAuth::Consumer.new(options.consumer_key,
                                  options.consumer_secret,
                                  :site => "http://api.tumblr.com")

  params = {
    "state"     => "published",
    "title"     => message.subject,
    "body"      => message.body,
  }

  token.post "/v2/blog/#{options.hostname}/post", params
end