Module: Tumblr::Blog

Included in:
Client
Defined in:
lib/tumblr/blog.rb

Instance Method Summary collapse

Instance Method Details

#avatar(blog_name, size = nil) ⇒ Object

Gets the avatar URL of specified size



10
11
12
13
14
# File 'lib/tumblr/blog.rb', line 10

def avatar(blog_name, size = nil)
  url = blog_path(blog_name, 'avatar')
  url = "#{url}/#{size}" if size
  get_redirect_url(url)
end

#blog_info(blog_name) ⇒ Object

Gets the info about the blog



5
6
7
# File 'lib/tumblr/blog.rb', line 5

def blog_info(blog_name)
  get(blog_path(blog_name, 'info'), :api_key => @consumer_key)
end

#blog_likes(blog_name, options = {}) ⇒ Object

Gets the list of likes for the blog



23
24
25
26
27
28
29
30
# File 'lib/tumblr/blog.rb', line 23

def blog_likes(blog_name, options = {})
  validate_options([:limit, :offset], options)
  url = blog_path(blog_name, 'likes')

  params = { :api_key => @consumer_key }
  params.merge! options
  get(url, params)
end

#draft(blog_name, options = {}) ⇒ Object



48
49
50
51
# File 'lib/tumblr/blog.rb', line 48

def draft(blog_name, options = {})
  validate_options([:limit, :offset], options)
  get(blog_path(blog_name, 'posts/draft'), options)
end

#followers(blog_name, options = {}) ⇒ Object

Gets the list of followers for the blog



17
18
19
20
# File 'lib/tumblr/blog.rb', line 17

def followers(blog_name, options = {})
  validate_options([:limit, :offset], options)
  get(blog_path(blog_name, 'followers'), options)
end

#posts(blog_name, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/tumblr/blog.rb', line 32

def posts(blog_name, options = {})
  url = blog_path(blog_name, 'posts')
  if options.has_key?(:type)
    url = "#{url}/#{options[:type]}"
  end

  params = { :api_key => @consumer_key }
  params.merge! options
  get(url, params)
end

#queue(blog_name, options = {}) ⇒ Object



43
44
45
46
# File 'lib/tumblr/blog.rb', line 43

def queue(blog_name, options = {})
  validate_options([:limit, :offset], options)
  get(blog_path(blog_name, 'posts/queue'), options)
end

#submissions(blog_name, options = {}) ⇒ Object



53
54
55
56
# File 'lib/tumblr/blog.rb', line 53

def submissions(blog_name, options = {})
  validate_options([:limit, :offset], options)
  get(blog_path(blog_name, 'posts/submission'), options)
end