Class: Metalbird::Tumblr::Publisher

Inherits:
Object
  • Object
show all
Defined in:
lib/metalbird/tumblr/publisher.rb

Instance Method Summary collapse

Constructor Details

#initialize(auth) ⇒ Publisher

Returns a new instance of Publisher


4
5
6
# File 'lib/metalbird/tumblr/publisher.rb', line 4

def initialize(auth)
  @client = auth.client
end

Instance Method Details

#publish(blog_name, post) ⇒ Object


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

def publish(blog_name, post)
  result = @client.text(blog_name, post)

  {
    blog_name: blog_name,
    content: post,
    id: result['id']
  }

rescue => error
  puts error
end