Module: TumblRb::Client::Blogs

Included in:
TumblRb::Client
Defined in:
lib/tumbl_rb/client/blogs.rb

Instance Method Summary collapse

Instance Method Details

#avatar(blog) ⇒ Hashie::Mash

Get the avatar of a blog

Examples:

TumblRb.avatar("andrewpthorp")


24
25
26
# File 'lib/tumbl_rb/client/blogs.rb', line 24

def avatar(blog, size=64)
  get("/v2/blog/#{Blog.new blog}/avatar/#{size}", {}, false, false)
end

#followers(blog, limit = 20, offset = 0) ⇒ Hashie::Mash

Get the followers of a blog

Examples:

TumblRb.followers("andrewpthorp", 20, 0)


37
38
39
# File 'lib/tumbl_rb/client/blogs.rb', line 37

def followers(blog, limit=20, offset=0)
  get("/v2/blog/#{Blog.new blog}/followers", { :limit => limit, :offset => offset }, false, false)
end

#info(blog) ⇒ Hashie::Mash

Get the info of a blog

Examples:

TumblRb.info("andrewpthorp")


12
13
14
# File 'lib/tumbl_rb/client/blogs.rb', line 12

def info(blog)
  get("/v2/blog/#{Blog.new blog}/info", {}, false, false)
end

#posts(blog, options = {}) ⇒ Hashie::Mash

Get the posts of a blog

Examples:

TumblRb.posts("andrewpthorp", "text")


61
62
63
64
65
66
67
68
69
# File 'lib/tumbl_rb/client/blogs.rb', line 61

def posts(blog, options={})
  url = "/v2/blog/#{Blog.new blog}/posts"

  if !options[:type].nil?
    url += "/#{options[:type]}"
  end

  get(url, options, false)
end