Module: Tumblr::Client::Blog

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

Constant Summary collapse

@@standard_options =
[:type, :id, :tag, :limit, :offset, :reblog_info, :notes_info, :filter]

Instance Method Summary collapse

Instance Method Details

#avatar(blog_name, size = 64) ⇒ Object

Gets the avatar of specified size Defaults to 64



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

def avatar(blog_name, size=64)
  get("v2/blog/#{blog_name}/avatar", {:size => size})
end

#blog_info(blog_name) ⇒ Object

Gets the info about the blog



9
10
11
# File 'lib/tumblr/blog.rb', line 9

def blog_info(blog_name)
  get("v2/blog/#{blog_name}/info", {:api_key => Tumblr::consumer_key})
end

#draft(blog_name) ⇒ Object



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

def draft(blog_name)
  get("v2/blog/#{blog_name}/posts/draft", {})
end

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

Gets the list of followers for the blog



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

def followers(blog_name, options={})
  if valid_options([:limit, :offset], options)
     get("v2/blog/#{blog_name}/followers", options)
  end
end

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



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

def posts(blog_name, options={})
  url = "v2/blog/#{blog_name}/posts"
  
  if options.has_key?(:type)
    url = "#{url}/#{options[:type]}"
  end
  
  params = {:api_key => Tumblr::consumer_key}
  unless options.empty?
    params.merge!(options)
  end
  get(url, params)
end

#queue(blog_name) ⇒ Object



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

def queue(blog_name)
  get("v2/blog/#{blog_name}/posts/queue", {})
end

#submissions(blog_name) ⇒ Object



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

def submissions(blog_name)
  get("v2/blog/#{blog_name}/posts/submission", {})
end