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")

Parameters:

  • blog (String, Hash)

Returns:

  • (Hashie::Mash)


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)

Parameters:

  • blog (String, Hash)

    to get followers of

  • number (Integer)

    of results (1-20, defaults 20)

  • result (Integer)

    to start at (defaults 0)

Returns:

  • (Hashie::Mash)


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")

Parameters:

  • blog (String, Hash)

    to get information for

Returns:

  • (Hashie::Mash)


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")

Parameters:

  • blog (String, Hash)
  • post (String)

    type

Returns:

  • (Hashie::Mash)


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